Rev 1029 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1029 | serge | 1 | |
2 | |||
1430 | serge | 3 | Bool retval = FALSE; |
1029 | serge | 4 | u32_t bus, last_bus; |
5 | PCITAG tag; |
||
6 | |||
7 | if( (last_bus = PciApi(1))==-1) |
||
8 | |||
9 | |||
10 | for(bus=0;bus<=last_bus;bus++) |
||
11 | |||
12 | u32_t devfn; |
||
13 | |||
14 | for(devfn=0;devfn<256;devfn++) |
||
15 | |||
16 | hc_t *hc; |
||
17 | |||
18 | u32_t id; |
||
19 | |||
20 | u16_t devclass; |
||
21 | u8_t interface; |
||
22 | int i; |
||
1430 | serge | 23 | |
1029 | serge | 24 | interface = PciRead8(bus,devfn, 0x09); |
25 | |||
1430 | serge | 26 | if( devclass != 0x0C03) |
1029 | serge | 27 | continue; |
28 | |||
29 | if( interface != 0) |
||
30 | |||
1430 | serge | 31 | |
32 | pcicmd = PciRead16(bus,devfn, PCI_COMMAND); |
||
33 | |||
1029 | serge | 34 | continue; |
35 | |||
36 | hc = (hc_t*)malloc(sizeof(hc_t)); |
||
37 | |||
38 | link_initialize(&hc->link); |
||
39 | |||
40 | hc->pciId = PciRead32(bus,devfn, 0); |
||
41 | |||
42 | |||
43 | for (i = 0; i < 6; i++) |
||
44 | |||
45 | u32_t base; |
||
46 | Bool validSize; |
||
47 | |||
48 | base = PciRead32(bus,devfn, PCI_MAP_REG_START + (i << 2)); |
||
49 | |||
50 | { |
||
51 | if (base & PCI_MAP_IO) { |
||
52 | hc->ioBase[i] = (addr_t)PCIGETIO(base); |
||
53 | hc->memType[i] = base & PCI_MAP_IO_ATTR_MASK; |
||
54 | } else { |
||
55 | hc->memBase[i] = (u32_t)PCIGETMEMORY(base); |
||
56 | hc->memType[i] = base & PCI_MAP_MEMORY_ATTR_MASK; |
||
57 | } |
||
58 | } |
||
59 | }; |
||
60 | list_prepend(&hc->link, &hc_list); |
||
61 | retval = TRUE; |
||
62 | }; |
||
63 | }; |
||
64 | return retval; |
||
65 | };><>>256;devfn++) |
||
66 | >=last_bus;bus++) |
||
67 | > |