- Timestamp:
- Nov 26, 2019 2:51:43 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/DevEFI.cpp
r81591 r82214 143 143 /** The flash device containing the NVRAM. */ 144 144 FLASHCORE Flash; 145 /** The 8 I/O ports at 0xEF10 (EFI_PORT_BASE). */ 146 IOMIOPORTHANDLE hIoPorts; 145 147 /** The flash MMIO handle. */ 146 148 IOMMMIOHANDLE hMmioFlash; … … 1338 1340 case EFI_IMAGE_EVT_CMD_COMPLETE: 1339 1341 { 1340 # ifdef IN_RING31342 # ifdef IN_RING3 1341 1343 AssertBreak(EFI_IMAGE_EVT_GET_PAYLOAD(u32) == 0); 1342 1344 … … 1386 1388 } 1387 1389 return VINF_SUCCESS; 1388 # else1390 # else 1389 1391 return VINF_IOM_R3_IOPORT_WRITE; 1390 # endif1392 # endif 1391 1393 } 1392 1394 … … 1431 1433 1432 1434 /** 1433 * Port I/O Handler for IN operations. 1434 * 1435 * @returns VBox status code. 1436 * 1437 * @param pDevIns The device instance. 1438 * @param pvUser User argument - ignored. 1439 * @param Port Port number used for the IN operation. 1440 * @param pu32 Where to store the result. 1441 * @param cb Number of bytes read. 1442 */ 1443 static DECLCALLBACK(int) efiIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) 1435 * @callback_method_impl{FNIOMIOPORTNEWIN} 1436 * 1437 * @note The @a offPort parameter is absolute! 1438 */ 1439 static DECLCALLBACK(VBOXSTRICTRC) efiR3IoPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb) 1444 1440 { 1445 1441 RT_NOREF(pvUser); 1446 1442 PDEVEFIR3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PDEVEFIR3); 1447 Log4(("EFI in: %x %x\n", Port, cb));1448 1449 switch ( Port)1443 Log4(("EFI in: %x %x\n", offPort, cb)); 1444 1445 switch (offPort) 1450 1446 { 1451 1447 case EFI_INFO_PORT: … … 1468 1464 1469 1465 case EFI_PANIC_PORT: 1470 # ifdef IN_RING31466 # ifdef IN_RING3 1471 1467 LogRel(("EFI panic port read!\n")); 1472 1468 /* Insert special code here on panic reads */ 1473 1469 return PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "EFI Panic: panic port read!\n"); 1474 # else1470 # else 1475 1471 /* Reschedule to R3 */ 1476 1472 return VINF_IOM_R3_IOPORT_READ; 1477 # endif1473 # endif 1478 1474 1479 1475 case EFI_PORT_VARIABLE_OP: … … 1517 1513 1518 1514 /** 1519 * Port I/O Handler for OUT operations. 1520 * 1521 * @returns VBox status code. 1522 * 1523 * @param pDevIns The device instance. 1524 * @param pvUser User argument - ignored. 1525 * @param Port Port number used for the IN operation. 1526 * @param u32 The value to output. 1527 * @param cb The value size in bytes. 1528 */ 1529 static DECLCALLBACK(int) efiIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) 1515 * @callback_method_impl{FNIOMIOPORTNEWOUT} 1516 * 1517 * @note The @a offPort parameter is absolute! 1518 */ 1519 static DECLCALLBACK(VBOXSTRICTRC) efiR3IoPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 1530 1520 { 1531 1521 RT_NOREF(pvUser); 1532 1522 PDEVEFIR3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PDEVEFIR3); 1533 int rc= VINF_SUCCESS;1534 Log4(("efi: out %x %x %d\n", Port, u32, cb));1535 1536 switch ( Port)1523 VBOXSTRICTRC rc = VINF_SUCCESS; 1524 Log4(("efi: out %x %x %d\n", offPort, u32, cb)); 1525 1526 switch (offPort) 1537 1527 { 1538 1528 case EFI_INFO_PORT: … … 1656 1646 1657 1647 case EFI_PORT_DEBUG_POINT: 1658 # ifdef IN_RING31648 # ifdef IN_RING3 1659 1649 if (u32 > EFIDBGPOINT_INVALID && u32 < EFIDBGPOINT_END) 1660 1650 { … … 1666 1656 rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "Invalid debug point %#x\n", u32); 1667 1657 break; 1668 # else1658 # else 1669 1659 return VINF_IOM_R3_IOPORT_WRITE; 1670 # endif1660 # endif 1671 1661 1672 1662 case EFI_PORT_IMAGE_EVENT: … … 1675 1665 1676 1666 default: 1677 Log(("EFI: Write to reserved port %RTiop: %#x (cb=%d)\n", Port, u32, cb));1667 Log(("EFI: Write to reserved port %RTiop: %#x (cb=%d)\n", offPort, u32, cb)); 1678 1668 break; 1679 1669 } … … 2640 2630 * Register our I/O ports. 2641 2631 */ 2642 rc = PDMDevHlpIOPortRegister(pDevIns, EFI_PORT_BASE, EFI_PORT_COUNT, NULL, 2643 efiIOPortWrite, efiIOPortRead, 2644 NULL, NULL, "EFI communication ports"); 2645 if (RT_FAILURE(rc)) 2646 return rc; 2632 rc = PDMDevHlpIoPortCreateFlagsAndMap(pDevIns, EFI_PORT_BASE, EFI_PORT_COUNT, IOM_IOPORT_F_ABS, 2633 efiR3IoPortWrite, efiR3IoPortRead, 2634 "EFI communication ports", NULL /*paExtDescs*/, &pThis->hIoPorts); 2635 AssertRCReturn(rc, rc); 2647 2636 2648 2637 /*
Note:
See TracChangeset
for help on using the changeset viewer.