44
44
45
45
#include "cpqphp.h"
46
46
#include "cpqphp_nvram.h"
47
- #include <asm/pci_x86.h>
48
47
49
48
50
49
/* Global variables */
51
50
int cpqhp_debug ;
52
51
int cpqhp_legacy_mode ;
53
52
struct controller * cpqhp_ctrl_list ; /* = NULL */
54
53
struct pci_func * cpqhp_slot_list [256 ];
54
+ struct irq_routing_table * cpqhp_routing_table ;
55
55
56
56
/* local variables */
57
57
static void __iomem * smbios_table ;
@@ -154,40 +154,42 @@ static int init_SERR(struct controller * ctrl)
154
154
return 0 ;
155
155
}
156
156
157
- /* nice debugging output */
158
- static int pci_print_IRQ_route (void )
157
+ static int init_cpqhp_routing_table (void )
159
158
{
160
- struct irq_routing_table * routing_table ;
161
159
int len ;
162
- int loop ;
163
-
164
- u8 tbus , tdevice , tslot ;
165
160
166
- routing_table = pcibios_get_irq_routing_table ();
167
- if (routing_table == NULL ) {
168
- err ("No BIOS Routing Table??? Not good\n" );
161
+ cpqhp_routing_table = pcibios_get_irq_routing_table ();
162
+ if (cpqhp_routing_table == NULL )
169
163
return - ENOMEM ;
170
- }
171
164
172
- len = (routing_table -> size - sizeof (struct irq_routing_table )) /
173
- sizeof (struct irq_info );
174
- /* Make sure I got at least one entry */
165
+ len = cpqhp_routing_table_length ();
175
166
if (len == 0 ) {
176
- kfree (routing_table );
167
+ kfree (cpqhp_routing_table );
168
+ cpqhp_routing_table = NULL ;
177
169
return -1 ;
178
170
}
179
171
180
- dbg ("bus dev func slot\n" );
172
+ return 0 ;
173
+ }
174
+
175
+ /* nice debugging output */
176
+ static void pci_print_IRQ_route (void )
177
+ {
178
+ int len ;
179
+ int loop ;
180
+ u8 tbus , tdevice , tslot ;
181
+
182
+ len = cpqhp_routing_table_length ();
181
183
184
+ dbg ("bus dev func slot\n" );
182
185
for (loop = 0 ; loop < len ; ++ loop ) {
183
- tbus = routing_table -> slots [loop ].bus ;
184
- tdevice = routing_table -> slots [loop ].devfn ;
185
- tslot = routing_table -> slots [loop ].slot ;
186
+ tbus = cpqhp_routing_table -> slots [loop ].bus ;
187
+ tdevice = cpqhp_routing_table -> slots [loop ].devfn ;
188
+ tslot = cpqhp_routing_table -> slots [loop ].slot ;
186
189
dbg ("%d %d %d %d\n" , tbus , tdevice >> 3 , tdevice & 0x7 , tslot );
187
190
188
191
}
189
- kfree (routing_table );
190
- return 0 ;
192
+ return ;
191
193
}
192
194
193
195
@@ -331,7 +333,6 @@ static int ctrl_slot_cleanup (struct controller * ctrl)
331
333
static int
332
334
get_slot_mapping (struct pci_bus * bus , u8 bus_num , u8 dev_num , u8 * slot )
333
335
{
334
- struct irq_routing_table * PCIIRQRoutingInfoLength ;
335
336
u32 work ;
336
337
long len ;
337
338
long loop ;
@@ -342,26 +343,14 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
342
343
343
344
bridgeSlot = 0xFF ;
344
345
345
- PCIIRQRoutingInfoLength = pcibios_get_irq_routing_table ();
346
- if (!PCIIRQRoutingInfoLength )
347
- return -1 ;
348
-
349
- len = (PCIIRQRoutingInfoLength -> size -
350
- sizeof (struct irq_routing_table )) / sizeof (struct irq_info );
351
- /* Make sure I got at least one entry */
352
- if (len == 0 ) {
353
- kfree (PCIIRQRoutingInfoLength );
354
- return -1 ;
355
- }
356
-
346
+ len = cpqhp_routing_table_length ();
357
347
for (loop = 0 ; loop < len ; ++ loop ) {
358
- tbus = PCIIRQRoutingInfoLength -> slots [loop ].bus ;
359
- tdevice = PCIIRQRoutingInfoLength -> slots [loop ].devfn >> 3 ;
360
- tslot = PCIIRQRoutingInfoLength -> slots [loop ].slot ;
348
+ tbus = cpqhp_routing_table -> slots [loop ].bus ;
349
+ tdevice = cpqhp_routing_table -> slots [loop ].devfn >> 3 ;
350
+ tslot = cpqhp_routing_table -> slots [loop ].slot ;
361
351
362
352
if ((tbus == bus_num ) && (tdevice == dev_num )) {
363
353
* slot = tslot ;
364
- kfree (PCIIRQRoutingInfoLength );
365
354
return 0 ;
366
355
} else {
367
356
/* Did not get a match on the target PCI device. Check
@@ -396,10 +385,8 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
396
385
*/
397
386
if (bridgeSlot != 0xFF ) {
398
387
* slot = bridgeSlot ;
399
- kfree (PCIIRQRoutingInfoLength );
400
388
return 0 ;
401
389
}
402
- kfree (PCIIRQRoutingInfoLength );
403
390
/* Couldn't find an entry in the routing table for this PCI device */
404
391
return -1 ;
405
392
}
@@ -782,10 +769,13 @@ static int one_time_init(void)
782
769
783
770
power_mode = 0 ;
784
771
785
- retval = pci_print_IRQ_route ();
772
+ retval = init_cpqhp_routing_table ();
786
773
if (retval )
787
774
goto error ;
788
775
776
+ if (cpqhp_debug )
777
+ pci_print_IRQ_route ();
778
+
789
779
dbg ("Initialize + Start the notification mechanism \n" );
790
780
791
781
retval = cpqhp_event_start_thread ();
0 commit comments