VirtualBox

Changeset 81812 in vbox


Ignore:
Timestamp:
Nov 12, 2019 4:05:00 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134603
Message:

DevBusLogic.cpp: Converting it to the new PDM device style - BIOS I/O handlers. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r81810 r81812  
    486486    /** ISA compatibility I/O ports. */
    487487    IOMIOPORTHANDLE                 hIoPortsIsa;
     488    /** BIOS I/O ports for booting, optional.   */
     489    IOMIOPORTHANDLE                 hIoPortsBios;
    488490    /** PCI Region \#0: I/O ports. */
    489491    IOMIOPORTHANDLE                 hIoPortsPci;
     
    27442746
    27452747/**
    2746  * Port I/O Handler for IN operations - BIOS port.
    2747  *
    2748  * @returns VBox status code.
    2749  *
    2750  * @param   pDevIns     The device instance.
    2751  * @param   pvUser      User argument.
    2752  * @param   uPort       Port number used for the IN operation.
    2753  * @param   pu32        Where to store the result.
    2754  * @param   cb          Number of bytes read.
    2755  */
    2756 static DECLCALLBACK(int) buslogicR3BiosIoPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t *pu32, unsigned cb)
    2757 {
     2748 * @callback_method_impl{FNIOMIOPORTNEWIN, BIOS port.}
     2749 */
     2750static DECLCALLBACK(VBOXSTRICTRC)
     2751buslogicR3BiosIoPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb)
     2752{
     2753    PBUSLOGIC pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    27582754    RT_NOREF(pvUser, cb);
    2759     PBUSLOGIC pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    2760 
    2761     Assert(cb == 1);
    2762 
    2763     int rc = vboxscsiReadRegister(&pBusLogic->VBoxSCSI, (uPort - BUSLOGIC_BIOS_IO_PORT), pu32);
    2764 
    2765     //Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n",
    2766     //      __FUNCTION__, pu32, 1, pu32, (uPort - BUSLOGIC_BIOS_IO_PORT), rc));
     2755
     2756    ASSERT_GUEST(cb == 1);
     2757
     2758    int rc = vboxscsiReadRegister(&pBusLogic->VBoxSCSI, offPort, pu32);
     2759
     2760    //Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n", __FUNCTION__, pu32, 1, pu32, offPort, rc));
    27672761
    27682762    return rc;
     
    27702764
    27712765/**
    2772  * Port I/O Handler for OUT operations - BIOS port.
    2773  *
    2774  * @returns VBox status code.
    2775  *
    2776  * @param   pDevIns     The device instance.
    2777  * @param   pvUser      User argument.
    2778  * @param   uPort       Port number used for the IN operation.
    2779  * @param   u32         The value to output.
    2780  * @param   cb          The value size in bytes.
    2781  */
    2782 static DECLCALLBACK(int) buslogicR3BiosIoPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t u32, unsigned cb)
    2783 {
     2766 * @callback_method_impl{FNIOMIOPORTNEWOUT, BIOS port.}
     2767 */
     2768static DECLCALLBACK(VBOXSTRICTRC)
     2769buslogicR3BiosIoPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb)
     2770{
     2771    PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     2772    Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, offPort));
    27842773    RT_NOREF(pvUser, cb);
    2785     PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    2786     Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x uPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, uPort));
    27872774
    27882775    /*
     
    27932780        return VINF_SUCCESS;
    27942781
    2795     Assert(cb == 1);
    2796 
    2797     int rc = vboxscsiWriteRegister(&pThis->VBoxSCSI, (uPort - BUSLOGIC_BIOS_IO_PORT), (uint8_t)u32);
     2782    ASSERT_GUEST(cb == 1);
     2783
     2784    int rc = vboxscsiWriteRegister(&pThis->VBoxSCSI, offPort, (uint8_t)u32);
    27982785    if (rc == VERR_MORE_DATA)
    27992786    {
     
    28112798
    28122799/**
    2813  * Port I/O Handler for primary port range OUT string operations.
    2814  * @see FNIOMIOPORTOUTSTRING for details.
    2815  */
    2816 static DECLCALLBACK(int) buslogicR3BiosIoPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port,
    2817                                                       uint8_t const *pbSrc, uint32_t *pcTransfers, unsigned cb)
    2818 {
     2800 * @callback_method_impl{FNIOMIOPORTNEWOUTSTRING, BIOS port.}
     2801 */
     2802static DECLCALLBACK(VBOXSTRICTRC) buslogicR3BiosIoPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort,
     2803                                                               uint8_t const *pbSrc, uint32_t *pcTransfers, unsigned cb)
     2804{
     2805    PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     2806    Log2(("#%d %s: pvUser=%#p cb=%d offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, offPort));
    28192807    RT_NOREF(pvUser);
    2820     PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    2821     Log2(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port));
    28222808
    28232809    /*
     
    28282814        return VINF_SUCCESS;
    28292815
    2830     int rc = vboxscsiWriteString(pDevIns, &pThis->VBoxSCSI, (Port - BUSLOGIC_BIOS_IO_PORT), pbSrc, pcTransfers, cb);
     2816    int rc = vboxscsiWriteString(pDevIns, &pThis->VBoxSCSI, offPort, pbSrc, pcTransfers, cb);
    28312817    if (rc == VERR_MORE_DATA)
    28322818    {
     
    28432829
    28442830/**
    2845  * Port I/O Handler for primary port range IN string operations.
    2846  * @see FNIOMIOPORTINSTRING for details.
    2847  */
    2848 static DECLCALLBACK(int) buslogicR3BiosIoPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port,
    2849                                                      uint8_t *pbDst, uint32_t *pcTransfers, unsigned cb)
    2850 {
     2831 * @callback_method_impl{FNIOMIOPORTNEWINSTRING, BIOS port.}
     2832 */
     2833static DECLCALLBACK(VBOXSTRICTRC) buslogicR3BiosIoPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort,
     2834                                                              uint8_t *pbDst, uint32_t *pcTransfers, unsigned cb)
     2835{
     2836    PBUSLOGIC pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     2837    LogFlowFunc(("#%d %s: pvUser=%#p cb=%d offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, offPort));
    28512838    RT_NOREF(pvUser);
    2852     PBUSLOGIC pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    2853     LogFlowFunc(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port));
    2854 
    2855     return vboxscsiReadString(pDevIns, &pBusLogic->VBoxSCSI, (Port - BUSLOGIC_BIOS_IO_PORT),
    2856                               pbDst, pcTransfers, cb);
     2839
     2840    return vboxscsiReadString(pDevIns, &pBusLogic->VBoxSCSI, offPort, pbDst, pcTransfers, cb);
    28572841}
    28582842
     
    29902974}
    29912975
     2976/**
     2977 * @interface_method_impl{PDMIMEDIAPORT,pfnQueryDeviceLocation}
     2978 */
    29922979static DECLCALLBACK(int) buslogicR3QueryDeviceLocation(PPDMIMEDIAPORT pInterface, const char **ppcszController,
    29932980                                                       uint32_t *piInstance, uint32_t *piLUN)
     
    41924179    {
    41934180        /* Register I/O port space for BIOS access. */
    4194         rc = PDMDevHlpIOPortRegister(pDevIns, BUSLOGIC_BIOS_IO_PORT, 4, NULL,
    4195                                      buslogicR3BiosIoPortWrite, buslogicR3BiosIoPortRead,
    4196                                      buslogicR3BiosIoPortWriteStr, buslogicR3BiosIoPortReadStr,
    4197                                      "BusLogic BIOS");
     4181        rc = PDMDevHlpIoPortCreateExAndMap(pDevIns, BUSLOGIC_BIOS_IO_PORT, 4 /*cPorts*/,
     4182                                           buslogicR3BiosIoPortWrite, buslogicR3BiosIoPortRead,
     4183                                           buslogicR3BiosIoPortWriteStr, buslogicR3BiosIoPortReadStr, NULL /*pvUser*/,
     4184                                           "BusLogic BIOS" , NULL /*paExtDesc*/, &pThis->hIoPortsBios);
    41984185        if (RT_FAILURE(rc))
    41994186            return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register BIOS I/O handlers"));
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette