Changeset 36268 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- Mar 11, 2011 4:37:25 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70538
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r36253 r36268 22 22 /* Hack to get PCIDEVICEINT declare at the right point - include "PCIInternal.h". */ 23 23 #define PCI_INCLUDE_PRIVATE 24 #define PCIBus ICH9PCIBus 24 25 #include <VBox/pci.h> 25 26 #include <VBox/msi.h> … … 43 44 * PCI Bus instance. 44 45 */ 45 typedef struct PCIBus46 typedef struct ICH9PCIBus 46 47 { 47 48 /** Bus number. */ … … 73 74 PCIDEVICE aPciDev; 74 75 75 } PCIBUS, *PPCIBUS;76 } ICH9PCIBUS, *PICH9PCIBUS; 76 77 77 78 … … 97 98 #endif 98 99 99 /** PCI bus which is attached to the host-to-PCI bridge. */100 PCIBUS aPciBus;100 /** Config register. */ 101 uint32_t uConfigReg; 101 102 102 103 /** I/O APIC irq levels */ … … 116 117 uint64_t u64PciConfigMMioLength; 117 118 118 119 /** Config register. */ 120 uint32_t uConfigReg; 121 } PCIGLOBALS, *PPCIGLOBALS; 119 /** PCI bus which is attached to the host-to-PCI bridge. */ 120 ICH9PCIBUS aPciBus; 121 } ICH9PCIGLOBALS, *PICH9PCIGLOBALS; 122 122 123 123 … … 129 129 } PciAddress; 130 130 131 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 131 132 132 133 /******************************************************************************* … … 143 144 /** Converts a bus instance pointer to a device instance pointer. */ 144 145 #define PCIBUS_2_DEVINS(pPciBus) ((pPciBus)->CTX_SUFF(pDevIns)) 145 /** Converts a device instance pointer to a PCIGLOBALS pointer. */146 #define DEVINS_2_PCIGLOBALS(pDevIns) ((P PCIGLOBALS)(PDMINS_2_DATA(pDevIns, PPCIGLOBALS)))146 /** Converts a device instance pointer to a ICH9PCIGLOBALS pointer. */ 147 #define DEVINS_2_PCIGLOBALS(pDevIns) ((PICH9PCIGLOBALS)(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS))) 147 148 /** Converts a device instance pointer to a PCIBUS pointer. */ 148 #define DEVINS_2_PCIBUS(pDevIns) ((P PCIBUS)(&PDMINS_2_DATA(pDevIns, PPCIGLOBALS)->aPciBus))149 #define DEVINS_2_PCIBUS(pDevIns) ((PICH9PCIBUS)(&PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS)->aPciBus)) 149 150 /** Converts a pointer to a PCI root bus instance to a PCIGLOBALS pointer. */ 150 #define PCIROOTBUS_2_PCIGLOBALS(pPciBus) ( (PPCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(PCIGLOBALS, aPciBus)) ) 151 151 #define PCIROOTBUS_2_PCIGLOBALS(pPciBus) ( (PICH9PCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(ICH9PCIGLOBALS, aPciBus)) ) 152 152 153 153 /** @def PCI_LOCK … … 164 164 DEVINS_2_PCIBUS(pDevIns)->CTX_SUFF(pPciHlp)->pfnUnlock(pDevIns) 165 165 166 #ifndef VBOX_DEVICE_STRUCT_TESTCASE167 168 166 RT_C_DECLS_BEGIN 169 167 … … 180 178 181 179 /* Prototypes */ 182 static void ich9pciSetIrqInternal(P PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel);180 static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel); 183 181 #ifdef IN_RING3 184 182 static void ich9pcibridgeReset(PPDMDEVINS pDevIns); 185 static int ich9pciRegisterInternal(P PCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName);183 static int ich9pciRegisterInternal(PICH9PCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName); 186 184 static void ich9pciUpdateMappings(PCIDevice *pDev); 187 185 static DECLCALLBACK(uint32_t) ich9pciConfigReadDev(PCIDevice *aDev, uint32_t u32Address, unsigned len); 188 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(P PCIBUS pBus, uint8_t iBus);189 static void ich9pciBiosInitDevice(P PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn);186 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(PICH9PCIBUS pBus, uint8_t iBus); 187 static void ich9pciBiosInitDevice(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn); 190 188 #endif 191 189 192 190 // See 7.2.2. PCI Express Enhanced Configuration Mechanism for details of address 193 191 // mapping, we take n=6 approach 194 DECLINLINE(void) ich9pciPhysToPciAddr(P PCIGLOBALS pGlobals, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr)192 DECLINLINE(void) ich9pciPhysToPciAddr(PICH9PCIGLOBALS pGlobals, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr) 195 193 { 196 194 pPciAddr->iBus = (GCPhysAddr >> 20) & ((1<<6) - 1); … … 199 197 } 200 198 201 DECLINLINE(void) ich9pciStateToPciAddr(P PCIGLOBALS pGlobals, RTGCPHYS addr, PciAddress* pPciAddr)199 DECLINLINE(void) ich9pciStateToPciAddr(PICH9PCIGLOBALS pGlobals, RTGCPHYS addr, PciAddress* pPciAddr) 202 200 { 203 201 pPciAddr->iBus = (pGlobals->uConfigReg >> 16) & 0xff; … … 208 206 PDMBOTHCBDECL(void) ich9pciSetIrq(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel) 209 207 { 210 ich9pciSetIrqInternal(PDMINS_2_DATA(pDevIns, P PCIGLOBALS), pPciDev->devfn, pPciDev, iIrq, iLevel);208 ich9pciSetIrqInternal(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS), pPciDev->devfn, pPciDev, iIrq, iLevel); 211 209 } 212 210 … … 220 218 * of our parent passing the device which asserted the interrupt instead of the device of the bridge. 221 219 */ 222 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);223 PPCIDEVICE pPciDevBus = pPciDev;224 int iIrqPinBridge = iIrq;225 uint8_t uDevFnBridge = 0;220 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 221 PPCIDEVICE pPciDevBus = pPciDev; 222 int iIrqPinBridge = iIrq; 223 uint8_t uDevFnBridge = 0; 226 224 227 225 /* Walk the chain until we reach the host bus. */ … … 257 255 if (cb == 4) 258 256 { 259 P PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);257 PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 260 258 261 259 PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE); … … 283 281 if (cb == 4) 284 282 { 285 P PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);283 PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 286 284 PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_READ); 287 285 *pu32 = pThis->uConfigReg; 288 286 PCI_UNLOCK(pDevIns); 289 LogFlow((" pciIOPortAddressRead: Port=%#x cb=%d -> %#x\n", Port, cb, *pu32));287 LogFlow(("ich9pciIOPortAddressRead: Port=%#x cb=%d -> %#x\n", Port, cb, *pu32)); 290 288 return VINF_SUCCESS; 291 289 } … … 296 294 } 297 295 298 static int ich9pciDataWriteAddr(P PCIGLOBALS pGlobals, PciAddress* pAddr,296 static int ich9pciDataWriteAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pAddr, 299 297 uint32_t val, int cb, int rcReschedule) 300 298 { … … 350 348 } 351 349 352 static int ich9pciDataWrite(P PCIGLOBALS pGlobals, uint32_t addr, uint32_t val, int len)350 static int ich9pciDataWrite(PICH9PCIGLOBALS pGlobals, uint32_t addr, uint32_t val, int len) 353 351 { 354 352 PciAddress aPciAddr; … … 387 385 PDMBOTHCBDECL(int) ich9pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) 388 386 { 389 LogFlow((" pciIOPortDataWrite: Port=%#x u32=%#x cb=%d\n", Port, u32, cb));387 LogFlow(("ich9pciIOPortDataWrite: Port=%#x u32=%#x cb=%d\n", Port, u32, cb)); 390 388 NOREF(pvUser); 391 389 int rc = VINF_SUCCESS; … … 393 391 { 394 392 PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE); 395 rc = ich9pciDataWrite(PDMINS_2_DATA(pDevIns, P PCIGLOBALS), Port, u32, cb);393 rc = ich9pciDataWrite(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS), Port, u32, cb); 396 394 PCI_UNLOCK(pDevIns); 397 395 } … … 401 399 } 402 400 403 static int ich9pciDataReadAddr(P PCIGLOBALS pGlobals, PciAddress* pPciAddr, int cb,401 static int ich9pciDataReadAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pPciAddr, int cb, 404 402 uint32_t *pu32, int rcReschedule) 405 403 { … … 458 456 } 459 457 460 static int ich9pciDataRead(P PCIGLOBALS pGlobals, uint32_t addr, int cb, uint32_t *pu32)458 static int ich9pciDataRead(PICH9PCIGLOBALS pGlobals, uint32_t addr, int cb, uint32_t *pu32) 461 459 { 462 460 PciAddress aPciAddr; … … 495 493 { 496 494 PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_READ); 497 int rc = ich9pciDataRead(PDMINS_2_DATA(pDevIns, P PCIGLOBALS), Port, cb, pu32);495 int rc = ich9pciDataRead(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS), Port, cb, pu32); 498 496 PCI_UNLOCK(pDevIns); 499 LogFlow((" pciIOPortDataRead: Port=%#x cb=%#x -> %#x (%Rrc)\n", Port, cb, *pu32, rc));497 LogFlow(("ich9pciIOPortDataRead: Port=%#x cb=%#x -> %#x (%Rrc)\n", Port, cb, *pu32, rc)); 500 498 return rc; 501 499 } … … 523 521 524 522 /* Add one more level up request on APIC input line */ 525 DECLINLINE(void) ich9pciApicLevelUp(P PCIGLOBALS pGlobals, int irq_num)523 DECLINLINE(void) ich9pciApicLevelUp(PICH9PCIGLOBALS pGlobals, int irq_num) 526 524 { 527 525 ASMAtomicIncU32(&pGlobals->uaPciApicIrqLevels[irq_num]); … … 529 527 530 528 /* Remove one level up request on APIC input line */ 531 DECLINLINE(void) ich9pciApicLevelDown(P PCIGLOBALS pGlobals, int irq_num)529 DECLINLINE(void) ich9pciApicLevelDown(PICH9PCIGLOBALS pGlobals, int irq_num) 532 530 { 533 531 ASMAtomicDecU32(&pGlobals->uaPciApicIrqLevels[irq_num]); 534 532 } 535 533 536 static void ich9pciApicSetIrq(P PCIBUS pBus, uint8_t uDevFn, PCIDevice *pPciDev, int irq_num1, int iLevel, int iForcedIrq)534 static void ich9pciApicSetIrq(PICH9PCIBUS pBus, uint8_t uDevFn, PCIDevice *pPciDev, int irq_num1, int iLevel, int iForcedIrq) 537 535 { 538 536 /* This is only allowed to be called with a pointer to the root bus. */ … … 542 540 { 543 541 int apic_irq, apic_level; 544 P PCIGLOBALS pGlobals = PCIROOTBUS_2_PCIGLOBALS(pBus);542 PICH9PCIGLOBALS pGlobals = PCIROOTBUS_2_PCIGLOBALS(pBus); 545 543 int irq_num = ich9pciSlot2ApicIrq(uDevFn >> 3, irq_num1); 546 544 … … 576 574 } 577 575 578 static void ich9pciSetIrqInternal(P PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel)576 static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel) 579 577 { 580 578 … … 595 593 } 596 594 597 P PCIBUS pBus= &pGlobals->aPciBus;595 PICH9PCIBUS pBus = &pGlobals->aPciBus; 598 596 const bool fIsAcpiDevice = PCIDevGetDeviceId(pPciDev) == 0x7113; 599 597 … … 620 618 PDMBOTHCBDECL(int) ich9pciMcfgMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) 621 619 { 622 P PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);620 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 623 621 PciAddress aDest; 624 622 uint32_t u32 = 0; … … 653 651 PDMBOTHCBDECL(int) ich9pciMcfgMMIORead (PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) 654 652 { 655 P PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);653 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 656 654 PciAddress aDest; 657 655 uint32_t rv; … … 690 688 #ifdef IN_RING3 691 689 692 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(P PCIBUS pBus, uint8_t iBus)690 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(PICH9PCIBUS pBus, uint8_t iBus) 693 691 { 694 692 /* Search for a fitting bridge. */ … … 745 743 PCIIORegion* pRegion = &pDev->Int.s.aIORegions[iRegion]; 746 744 int rc = VINF_SUCCESS; 747 P PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus);745 PICH9PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus); 748 746 749 747 Assert (pRegion->size != 0); … … 779 777 static void ich9pciUpdateMappings(PCIDevice* pDev) 780 778 { 781 P PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus);779 PICH9PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus); 782 780 uint64_t uLast, uNew; 783 781 … … 867 865 static DECLCALLBACK(int) ich9pciRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev) 868 866 { 869 P PCIBUS pBus = DEVINS_2_PCIBUS(pDevIns);867 PICH9PCIBUS pBus = DEVINS_2_PCIBUS(pDevIns); 870 868 871 869 /* … … 907 905 { 908 906 909 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);907 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 910 908 911 909 /* … … 996 994 } 997 995 998 static int ich9pciR3CommonSaveExec(P PCIBUS pBus, PSSMHANDLE pSSM)996 static int ich9pciR3CommonSaveExec(PICH9PCIBUS pBus, PSSMHANDLE pSSM) 999 997 { 1000 998 /* … … 1051 1049 static DECLCALLBACK(int) ich9pciR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1052 1050 { 1053 P PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);1051 PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 1054 1052 1055 1053 /* … … 1072 1070 static DECLCALLBACK(int) ich9pcibridgeR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1073 1071 { 1074 P PCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);1072 PICH9PCIBUS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 1075 1073 return ich9pciR3CommonSaveExec(pThis, pSSM); 1076 1074 } … … 1079 1077 static void ich9pcibridgeConfigWrite(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, uint32_t u32Value, unsigned cb) 1080 1078 { 1081 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);1079 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 1082 1080 1083 1081 LogFlowFunc((": pDevIns=%p iBus=%d iDevice=%d u32Address=%u u32Value=%u cb=%d\n", pDevIns, iBus, iDevice, u32Address, u32Value, cb)); … … 1107 1105 static uint32_t ich9pcibridgeConfigRead(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, unsigned cb) 1108 1106 { 1109 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);1107 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 1110 1108 uint32_t u32Value; 1111 1109 … … 1317 1315 * @param uPass The pass. 1318 1316 */ 1319 static DECLCALLBACK(int) ich9pciR3CommonLoadExec(P PCIBUS pBus, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)1317 static DECLCALLBACK(int) ich9pciR3CommonLoadExec(PICH9PCIBUS pBus, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 1320 1318 { 1321 1319 uint32_t u32; … … 1479 1477 static DECLCALLBACK(int) ich9pciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 1480 1478 { 1481 P PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);1482 P PCIBUS pBus = &pThis->aPciBus;1483 uint32_t u32;1484 int rc;1479 PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 1480 PICH9PCIBUS pBus = &pThis->aPciBus; 1481 uint32_t u32; 1482 int rc; 1485 1483 1486 1484 /* We ignore this version as there's no saved state with it anyway */ … … 1513 1511 static DECLCALLBACK(int) ich9pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 1514 1512 { 1515 P PCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);1513 PICH9PCIBUS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 1516 1514 if (uVersion > VBOX_ICH9PCI_SAVED_STATE_VERSION_MSI) 1517 1515 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; … … 1519 1517 } 1520 1518 1521 static uint32_t ich9pciConfigRead(P PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t len)1519 static uint32_t ich9pciConfigRead(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t len) 1522 1520 { 1523 1521 /* Will only work in LSB case */ … … 1535 1533 } 1536 1534 1537 static void ich9pciConfigWrite(P PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val, uint32_t len)1535 static void ich9pciConfigWrite(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val, uint32_t len) 1538 1536 { 1539 1537 PciAddress aPciAddr; … … 1548 1546 } 1549 1547 1550 static void ich9pciSetRegionAddress(P PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, int iRegion, uint64_t addr)1548 static void ich9pciSetRegionAddress(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, int iRegion, uint64_t addr) 1551 1549 { 1552 1550 uint32_t uReg = ich9pciGetRegionReg(iRegion); … … 1579 1577 1580 1578 1581 static void ich9pciBiosInitBridge(P PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn)1579 static void ich9pciBiosInitBridge(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn) 1582 1580 { 1583 1581 Log(("BIOS init bridge: %02x::%02x.%d\n", uBus, uDevFn >> 3, uDevFn & 7)); … … 1645 1643 } 1646 1644 1647 static void ich9pciBiosInitDevice(P PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn)1645 static void ich9pciBiosInitDevice(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn) 1648 1646 { 1649 1647 uint16_t uDevClass, uVendor, uDevice; … … 1774 1772 { 1775 1773 /* Find bus this device attached to. */ 1776 P PCIBUS pBus = &pGlobals->aPciBus;1774 PICH9PCIBUS pBus = &pGlobals->aPciBus; 1777 1775 while (1) 1778 1776 { … … 1788 1786 break; 1789 1787 } 1790 pBus = PDMINS_2_DATA(pBridge->pDevIns, P PCIBUS);1788 pBus = PDMINS_2_DATA(pBridge->pDevIns, PICH9PCIBUS); 1791 1789 } 1792 1790 … … 1810 1808 1811 1809 /* Initializes bridges registers used for routing. */ 1812 static void ich9pciInitBridgeTopology(P PCIGLOBALS pGlobals, PPCIBUS pBus)1810 static void ich9pciInitBridgeTopology(PICH9PCIGLOBALS pGlobals, PICH9PCIBUS pBus) 1813 1811 { 1814 1812 PPCIDEVICE pBridgeDev = &pBus->aPciDev; … … 1827 1825 AssertMsg(pBridge && pciDevIsPci2PciBridge(pBridge), 1828 1826 ("Device is not a PCI bridge but on the list of PCI bridges\n")); 1829 P PCIBUS pChildBus = PDMINS_2_DATA(pBridge->pDevIns, PPCIBUS);1827 PICH9PCIBUS pChildBus = PDMINS_2_DATA(pBridge->pDevIns, PICH9PCIBUS); 1830 1828 ich9pciInitBridgeTopology(pGlobals, pChildBus); 1831 1829 } … … 1844 1842 unsigned i; 1845 1843 uint8_t elcr[2] = {0, 0}; 1846 P PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);1844 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 1847 1845 PVM pVM = PDMDevHlpGetVM(pDevIns); 1848 1846 Assert(pVM); … … 1858 1856 * Assign bridge topology, for further routing to work. 1859 1857 */ 1860 P PCIBUS pBus = &pGlobals->aPciBus;1858 PICH9PCIBUS pBus = &pGlobals->aPciBus; 1861 1859 ich9pciInitBridgeTopology(pGlobals, pBus); 1862 1860 … … 2120 2118 }; 2121 2119 2122 static bool assignPosition(P PCIBUS pBus, PPCIDEVICE pPciDev, const char *pszName, int iDevFn, PciAddress* aPosition)2120 static bool assignPosition(PICH9PCIBUS pBus, PPCIDEVICE pPciDev, const char *pszName, int iDevFn, PciAddress* aPosition) 2123 2121 { 2124 2122 aPosition->iBus = 0; … … 2165 2163 } 2166 2164 2167 static bool hasHardAssignedDevsInSlot(P PCIBUS pBus, int iSlot)2165 static bool hasHardAssignedDevsInSlot(PICH9PCIBUS pBus, int iSlot) 2168 2166 { 2169 2167 PCIDevice** aSlot = &pBus->apDevices[iSlot << 3]; … … 2180 2178 } 2181 2179 2182 static int ich9pciRegisterInternal(P PCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName)2180 static int ich9pciRegisterInternal(PICH9PCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName) 2183 2181 { 2184 2182 PciAddress aPosition = {0, 0, 0}; … … 2272 2270 } 2273 2271 2274 static void ich9pciBusInfo(P PCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent, bool fRegisters)2272 static void ich9pciBusInfo(PICH9PCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent, bool fRegisters) 2275 2273 { 2276 2274 for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->apDevices); iDev++) … … 2362 2360 for (uint32_t iBridge = 0; iBridge < pBus->cBridges; iBridge++) 2363 2361 { 2364 P PCIBUS pBusSub = PDMINS_2_DATA(pBus->papBridgesR3[iBridge]->pDevIns, PPCIBUS);2362 PICH9PCIBUS pBusSub = PDMINS_2_DATA(pBus->papBridgesR3[iBridge]->pDevIns, PICH9PCIBUS); 2365 2363 ich9pciBusInfo(pBusSub, pHlp, iIndent + 1, fRegisters); 2366 2364 } … … 2377 2375 static DECLCALLBACK(void) ich9pciInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 2378 2376 { 2379 P PCIBUS pBus = DEVINS_2_PCIBUS(pDevIns);2377 PICH9PCIBUS pBus = DEVINS_2_PCIBUS(pDevIns); 2380 2378 2381 2379 if (pszArgs == NULL || !strcmp(pszArgs, "basic")) … … 2426 2424 return PDMDEV_SET_ERROR(pDevIns, rc, 2427 2425 N_("Configuration error: Failed to query boolean value \"GCEnabled\"")); 2428 2429 2426 /* check if R0 code is enabled. */ 2430 2427 bool fR0Enabled; … … 2439 2436 * Init data. 2440 2437 */ 2441 P PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);2442 P PCIBUS pBus = &pGlobals->aPciBus;2438 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 2439 PICH9PCIBUS pBus = &pGlobals->aPciBus; 2443 2440 /* Zero out everything */ 2444 2441 memset(pGlobals, 0, sizeof(*pGlobals)); … … 2623 2620 static void ich9pciResetDevice(PPCIDEVICE pDev) 2624 2621 { 2625 P PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus);2622 PICH9PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus); 2626 2623 int rc; 2627 2624 … … 2665 2662 static DECLCALLBACK(void) ich9pciReset(PPDMDEVINS pDevIns) 2666 2663 { 2667 P PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);2668 P PCIBUS pBus = &pGlobals->aPciBus;2664 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 2665 PICH9PCIBUS pBus = &pGlobals->aPciBus; 2669 2666 2670 2667 /* PCI-specific reset for each device. */ … … 2699 2696 static DECLCALLBACK(void) ich9pciRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2700 2697 { 2701 P PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);2702 P PCIBUS pBus = &pGlobals->aPciBus;2698 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 2699 PICH9PCIBUS pBus = &pGlobals->aPciBus; 2703 2700 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2704 2701 … … 2745 2742 * Init data and register the PCI bus. 2746 2743 */ 2747 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);2744 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 2748 2745 pBus->pDevInsR3 = pDevIns; 2749 2746 pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); … … 2841 2838 static void ich9pcibridgeReset(PPDMDEVINS pDevIns) 2842 2839 { 2843 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);2840 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 2844 2841 2845 2842 /* Reset config space to default values. */ … … 2862 2859 static DECLCALLBACK(void) ich9pcibridgeRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2863 2860 { 2864 P PCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);2861 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 2865 2862 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2866 2863 … … 2892 2889 1, 2893 2890 /* cbInstance */ 2894 sizeof( PCIGLOBALS),2891 sizeof(ICH9PCIGLOBALS), 2895 2892 /* pfnConstruct */ 2896 2893 ich9pciConstruct, … … 2948 2945 ~0, 2949 2946 /* cbInstance */ 2950 sizeof( PCIBUS),2947 sizeof(ICH9PCIBUS), 2951 2948 /* pfnConstruct */ 2952 2949 ich9pcibridgeConstruct,
Note:
See TracChangeset
for help on using the changeset viewer.