Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1029 serge 1
 
2
 
3
    Bool retval = FALSE;
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
            int i;
22
23
            devclass = PciRead16(bus,devfn, 0x0A);
24
 
25
            if( devclass != 0x0C03)
26
 
27
28
            pcicmd = PciRead16(bus,devfn, PCI_COMMAND);
29
 
30
                continue;
31
32
            hc = (hc_t*)malloc(sizeof(hc_t));
33
 
34
            link_initialize(&hc->link);
35
36
            hc->pciId  = PciRead32(bus,devfn, 0);
37
 
38
39
            for (i = 0; i < 6; i++)
40
 
41
                u32_t base;
42
                Bool validSize;
43
44
                base = PciRead32(bus,devfn, PCI_MAP_REG_START + (i << 2));
45
 
46
                {
47
                    if (base & PCI_MAP_IO) {
48
                        hc->ioBase[i] = (addr_t)PCIGETIO(base);
49
                        hc->memType[i]   = base & PCI_MAP_IO_ATTR_MASK;
50
                    } else {
51
                        hc->memBase[i] = (u32_t)PCIGETMEMORY(base);
52
                        hc->memType[i] = base & PCI_MAP_MEMORY_ATTR_MASK;
53
                    }
54
                }
55
            };
56
            list_prepend(&hc->link, &hc_list);
57
            retval = TRUE;
58
        };
59
    };
60
    return retval;
61
};
62
>
63
>