- Timestamp:
- Feb 27, 2010 3:58:25 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r26861 r26883 476 476 AssertCompileSize(ACPITBLIOAPIC, 12); 477 477 478 /** Interrupt Source Override Structure */ 479 struct ACPITBLISO 480 { 481 uint8_t u8Type; /**< 2 == Interrupt Source Override*/ 482 uint8_t u8Length; /**< 10 */ 483 uint8_t u8Bus; /**< Bus */ 484 uint8_t u8Source; /**< Bus-relative interrupt source (IRQ) */ 485 uint32_t u32GSI; /**< Global System Interrupt */ 486 uint16_t u16Flags; /**< MPS INTI flags Global */ 487 }; 488 AssertCompileSize(ACPITBLISO, 10); 489 #define NUMBER_OF_IRQ_SOURCE_OVERRIDES 1 478 490 479 491 /** HPET Descriptor Structure */ … … 519 531 uint32_t m_cCpus; 520 532 533 /** 534 * Number of interrupt overrides. 535 */ 536 uint32_t m_cIsos; 537 521 538 public: 522 539 /** … … 546 563 547 564 /** 565 * Address of ISO description 566 */ 567 inline ACPITBLISO *ISO_addr(void) const 568 { 569 return (ACPITBLISO *)(u32Flags_addr() + 1); 570 } 571 572 /** 548 573 * Address of per-CPU LAPIC descriptions 549 574 */ 550 575 inline ACPITBLLAPIC *LApics_addr(void) const 551 576 { 552 return (ACPITBLLAPIC *)( u32Flags_addr() + 1);577 return (ACPITBLLAPIC *)(ISO_addr() + m_cIsos); 553 578 } 554 579 … … 581 606 * Size of MADT for given ACPI config, useful to compute layout. 582 607 */ 583 static uint32_t sizeFor(ACPIState *s )584 { 585 return AcpiTableMADT(s->cCpus ).size();608 static uint32_t sizeFor(ACPIState *s, uint32_t cIsos) 609 { 610 return AcpiTableMADT(s->cCpus, cIsos).size(); 586 611 } 587 612 … … 589 614 * Constructor, only works in Ring 3, doesn't look like a big deal. 590 615 */ 591 AcpiTableMADT(uint32_t cCpus )616 AcpiTableMADT(uint32_t cCpus, uint32_t cIsos) 592 617 { 593 618 m_cCpus = cCpus; 619 m_cIsos = cIsos; 594 620 m_pbData = NULL; /* size() uses this and gcc will complain if not initilized. */ 595 621 uint32_t cb = size(); … … 875 901 { 876 902 uint16_t cpus = s->cCpus; 877 AcpiTableMADT madt(cpus );903 AcpiTableMADT madt(cpus, 1 /* one source override */ ); 878 904 879 905 acpiPrepareHeader(madt.header_addr(), "APIC", madt.size(), 2); … … 882 908 *madt.u32Flags_addr() = RT_H2LE_U32(PCAT_COMPAT); 883 909 910 /* LAPICs records */ 884 911 ACPITBLLAPIC* lapic = madt.LApics_addr(); 885 912 for (uint16_t i = 0; i < cpus; i++) … … 888 915 lapic->u8Length = sizeof(ACPITBLLAPIC); 889 916 lapic->u8ProcId = i; 917 /** Must match numbering convention in MPTABLES */ 890 918 lapic->u8ApicId = i; 891 919 lapic->u32Flags = VMCPUSET_IS_PRESENT(&s->CpuSetAttached, i) ? RT_H2LE_U32(LAPIC_ENABLED) : 0; … … 893 921 } 894 922 923 /* IO-APIC record */ 895 924 ACPITBLIOAPIC* ioapic = madt.IOApic_addr(); 896 897 925 ioapic->u8Type = 1; 898 926 ioapic->u8Length = sizeof(ACPITBLIOAPIC); 899 /** @todo is this the right id?*/927 /** Must match MP tables ID */ 900 928 ioapic->u8IOApicId = cpus; 901 929 ioapic->u8Reserved = 0; 902 930 ioapic->u32Address = RT_H2LE_U32(0xfec00000); 903 931 ioapic->u32GSIB = RT_H2LE_U32(0); 932 933 /* Interrupt Source Overrides */ 934 ACPITBLISO* isos = madt.ISO_addr(); 935 isos[0].u8Type = 2; 936 isos[0].u8Length = sizeof(ACPITBLISO); 937 isos[0].u8Bus = 0; /* Must be 0 */ 938 isos[0].u8Source = 0; /* IRQ0 */ 939 isos[0].u32GSI = 2; /* connected to pin 2 */ 940 isos[0].u16Flags = 0; /* conform to the bus */ 941 Assert(NUMBER_OF_IRQ_SOURCE_OVERRIDES == 1); 904 942 905 943 madt.header_addr()->u8Checksum = acpiChecksum(madt.data(), madt.size()); … … 2044 2082 { 2045 2083 GCPhysApic = GCPhysCur; 2046 GCPhysCur = RT_ALIGN_32(GCPhysCur + AcpiTableMADT::sizeFor(s ), 16);2084 GCPhysCur = RT_ALIGN_32(GCPhysCur + AcpiTableMADT::sizeFor(s, NUMBER_OF_IRQ_SOURCE_OVERRIDES), 16); 2047 2085 } 2048 2086 if (s->fUseHpet) -
trunk/src/VBox/Devices/PC/DevFwCommon.cpp
r26728 r26883 232 232 uint32_t u32AddrLocalApic; 233 233 uint16_t u16ExtTableLength; 234 uint8_t u8ExtTableChecks xum;234 uint8_t u8ExtTableChecksum; 235 235 uint8_t u8Reserved; 236 236 } *PMPSCFGTBLHEADER; … … 733 733 pCfgTab->u16EntryCount = cCpus /* Processors */ 734 734 + 1 /* ISA Bus */ 735 + 1 /* PCI Bus */ 735 736 + 1 /* I/O-APIC */ 736 + 16 /* Interrupts */; 737 + 16 /* Interrupts */ 738 + 1 /* Local interrupts */; 737 739 pCfgTab->u32AddrLocalApic = 0xfee00000; 738 740 pCfgTab->u16ExtTableLength = 0; 739 pCfgTab->u8ExtTableChecks xum= 0;741 pCfgTab->u8ExtTableChecksum = 0; 740 742 pCfgTab->u8Reserved = 0; 741 743 … … 757 759 { 758 760 pProcEntry->u8EntryType = 0; /* processor entry */ 759 pProcEntry->u8LocalApicId = i ;760 pProcEntry->u8LocalApicVersion = 0x1 1;761 pProcEntry->u8LocalApicId = i + 1; 762 pProcEntry->u8LocalApicVersion = 0x14; 761 763 pProcEntry->u8CPUFlags = (i == 0 ? 2 /* bootstrap processor */ : 0 /* application processor */) | 1 /* enabled */; 762 764 pProcEntry->u32CPUSignature = u32CPUSignature; … … 767 769 } 768 770 771 uint32_t iBusIdPci0 = 0; 772 uint32_t iBusIdIsa = 1; 773 769 774 /* ISA bus */ 770 775 PMPSBUSENTRY pBusEntry = (PMPSBUSENTRY)pProcEntry; 771 776 pBusEntry->u8EntryType = 1; /* bus entry */ 772 pBusEntry->u8BusId = 0; /* this ID is referenced by the interrupt entries */777 pBusEntry->u8BusId = iBusIdIsa; /* this ID is referenced by the interrupt entries */ 773 778 memcpy(pBusEntry->au8BusTypeStr, "ISA ", 6); 774 775 /* PCI bus? */ 779 pBusEntry++; 780 781 /* PCI bus */ 782 pBusEntry->u8EntryType = 1; /* bus entry */ 783 pBusEntry->u8BusId = iBusIdPci0; /* this ID can be referenced by the interrupt entries */ 784 memcpy(pBusEntry->au8BusTypeStr, "PCI ", 6); 785 776 786 777 787 /* I/O-APIC. … … 779 789 * ... At least one I/O APIC must be enabled." */ 780 790 PMPSIOAPICENTRY pIOAPICEntry = (PMPSIOAPICENTRY)(pBusEntry+1); 781 uint16_t apicId = cCpus;791 uint16_t iApicId = 0; 782 792 pIOAPICEntry->u8EntryType = 2; /* I/O-APIC entry */ 783 pIOAPICEntry->u8Id = apicId; /* this ID is referenced by the interrupt entries */793 pIOAPICEntry->u8Id = iApicId; /* this ID is referenced by the interrupt entries */ 784 794 pIOAPICEntry->u8Version = 0x11; 785 795 pIOAPICEntry->u8Flags = 1 /* enable */; 786 796 pIOAPICEntry->u32Addr = 0xfec00000; 787 797 798 /* Interrupt tables */ 799 /* Bus vectors */ 788 800 PMPSIOIRQENTRY pIrqEntry = (PMPSIOIRQENTRY)(pIOAPICEntry+1); 789 for (int i = 0; i < 16; i++, pIrqEntry++)801 for (int iPin = 0; iPin < 16; iPin++, pIrqEntry++) 790 802 { 791 803 pIrqEntry->u8EntryType = 3; /* I/O interrupt entry */ 792 pIrqEntry->u8Type = 0; /* INT, vectored interrupt */ 793 pIrqEntry->u16Flags = 0; /* polarity of APIC I/O input signal = conforms to bus, 794 trigger mode = conforms to bus */ 795 pIrqEntry->u8SrcBusId = 0; /* ISA bus */ 796 pIrqEntry->u8SrcBusIrq = i; 797 pIrqEntry->u8DstIOAPICId = apicId; 798 pIrqEntry->u8DstIOAPICInt = i; 799 } 804 /* 805 * 0 - INT, vectored interrupt, 806 * 3 - ExtINT, vectored interrupt provided by PIC 807 * As we emulate system with both APIC and PIC, it's needed for their coexistence. 808 */ 809 pIrqEntry->u8Type = (iPin == 0) ? 3 : 0; 810 pIrqEntry->u16Flags = 0; /* polarity of APIC I/O input signal = conforms to bus, 811 trigger mode = conforms to bus */ 812 pIrqEntry->u8SrcBusId = iBusIdIsa; /* ISA bus */ 813 /* IRQ0 mapped to pin 2, other are identity mapped */ 814 pIrqEntry->u8SrcBusIrq = (iPin == 2) ? 0 : iPin; /* IRQ on the bus */ 815 pIrqEntry->u8DstIOAPICId = iApicId; /* destintion IO-APIC */ 816 pIrqEntry->u8DstIOAPICInt = iPin; /* pin on destination IO-APIC */ 817 } 818 /* Local delivery */ 819 pIrqEntry->u8EntryType = 4; /* Local interrupt entry */ 820 pIrqEntry->u8Type = 3; /* ExtINT */ 821 pIrqEntry->u16Flags = (1 << 2) | 1; /* active-high, edge-triggered */ 822 pIrqEntry->u8SrcBusId = iBusIdIsa; 823 pIrqEntry->u8SrcBusIrq = 0; 824 pIrqEntry->u8DstIOAPICId = 0xff; 825 pIrqEntry->u8DstIOAPICInt = 0; 826 pIrqEntry++; 800 827 801 828 pCfgTab->u16Length = (uint8_t*)pIrqEntry - pTable;
Note:
See TracChangeset
for help on using the changeset viewer.