Ticket #5: acpi_routing_tables.patch
File acpi_routing_tables.patch, 4.2 KB (added by , 14 years ago) |
---|
-
src/system/kernel/arch/x86/irq_routing_table.cpp
11 11 #include <int.h> 12 12 13 13 14 //#define TRACE_PRT14 #define TRACE_PRT 15 15 #ifdef TRACE_PRT 16 16 # define TRACE(x...) dprintf("IRQRoutingTable: "x) 17 17 #else … … 67 67 dprintf("pin: %i\n", entry.pin); 68 68 dprintf("source: %x\n", int(entry.source)); 69 69 dprintf("source index: %i\n", entry.source_index); 70 71 dprintf("pci_bus: %i\n", entry.pci_bus);72 dprintf("pci_device: %i\n", entry.pci_device);73 70 } 74 71 } 75 72 76 73 77 74 static status_t 78 find_pci_device(pci_module_info *pci, irq_routing_entry* entry)79 {80 pci_info info;81 int pciN = 0;82 while ((*pci->get_nth_pci_info)(pciN, &info) == B_OK) {83 pciN ++;84 85 int16 deviceAddress = entry->device_address >> 16 & 0xFFFF;86 if (info.device == deviceAddress87 && info.u.h0.interrupt_pin == entry->pin + 1) {88 entry->pci_bus = info.bus;89 entry->pci_device = info.device;90 return B_OK;91 }92 }93 94 return B_ERROR;95 }96 97 98 static status_t99 75 read_device_irq_routing_table(pci_module_info *pci, acpi_module_info* acpi, 100 76 acpi_handle device, IRQRoutingTable* table) 101 77 { … … 107 83 return status; 108 84 109 85 irq_routing_entry irqEntry; 110 acpi_pci_routing_table* acpiTable 111 = (acpi_pci_routing_table*)buffer.pointer; 86 acpi_pci_routing_table* acpiTable = (acpi_pci_routing_table*)buffer.pointer; 112 87 while (acpiTable->length) { 113 88 irqEntry.device_address = acpiTable->address; 114 89 irqEntry.pin = acpiTable->pin; 115 90 acpi_handle source; 116 if (acpi->get_handle(device, acpiTable->source, &source) != B_OK) 117 continue; 91 if (acpi->get_handle(device, acpiTable->source, &source) == B_OK) { 92 irqEntry.source = source; 93 irqEntry.source_index = acpiTable->sourceIndex; 94 table->PushBack(irqEntry); 95 } 118 96 irqEntry.source = source; 119 97 irqEntry.source_index = acpiTable->sourceIndex; 120 121 // connect to pci device122 if (find_pci_device(pci, &irqEntry) != B_OK) {123 TRACE("no pci dev found, device %x, pin %i\n",124 irqEntry.device_address, irqEntry.pin);125 acpiTable = (acpi_pci_routing_table*)((uint8*)acpiTable126 + acpiTable->length);127 continue;128 }129 130 98 table->PushBack(irqEntry); 131 99 acpiTable = (acpi_pci_routing_table*)((uint8*)acpiTable 132 100 + acpiTable->length); … … 153 121 return status; 154 122 TRACE("Read root pci bus irq rooting table\n"); 155 123 status = read_device_irq_routing_table(pci, acpi, rootPciHandle, table); 156 if (status != B_OK)157 return status;158 124 159 TRACE("find p2p\n");125 TRACE("find routing tables \n"); 160 126 161 127 char result[255]; 162 128 result[0] = 0; … … 170 136 171 137 status = read_device_irq_routing_table(pci, acpi, brigde, table); 172 138 if (status == B_OK) 173 TRACE(" p2pfound %s\n", result);139 TRACE("routing table found %s\n", result); 174 140 } 175 141 176 return status;142 return table->Count() > 0 ? B_OK : B_ERROR; 177 143 } 178 144 179 145 -
src/system/kernel/arch/x86/arch_int.cpp
39 39 #include <stdio.h> 40 40 41 41 42 //#define TRACE_ARCH_INT42 #define TRACE_ARCH_INT 43 43 #ifdef TRACE_ARCH_INT 44 44 # define TRACE(x) dprintf x 45 45 #else … … 590 590 } 591 591 592 592 // disable io apic for now 593 return;593 //return; 594 594 595 595 // load acpi module 596 596 status_t status; … … 668 668 // configure apic interrupts assume 1:1 mapping 669 669 for (int i = 0; i < table.Count(); i++) { 670 670 irq_routing_entry& entry = table.ElementAt(i); 671 TRACE(("address: %x pin: %i source: %x source index: %i\n", 672 entry.device_address, entry.pin, int(entry.source), 673 entry.source_index)); 674 671 675 irq_descriptor irqDescriptor; 672 676 read_current_irq(acpiModule, entry.source, &irqDescriptor); 673 677 uint32 config = 0; -
src/system/kernel/arch/x86/irq_routing_table.h
19 19 20 20 acpi_handle source; 21 21 int source_index; 22 23 // pci busmanager connection24 uchar pci_bus;25 uchar pci_device;26 22 }; 27 23 28 24