]>
Commit | Line | Data |
---|---|---|
72d80898 MT |
1 | --- pciutils-2.2.1/lib/sysfs.c.devicetype 2005-09-21 07:51:00.000000000 -0400 |
2 | +++ pciutils-2.2.1/lib/sysfs.c 2005-12-13 17:02:12.000000000 -0500 | |
3 | @@ -164,7 +164,6 @@ | |
4 | sysfs_get_resources(d); | |
5 | d->irq = sysfs_get_value(d, "irq"); | |
6 | d->known_fields = PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES; | |
7 | -#if 0 | |
8 | /* | |
9 | * We prefer reading these from the config registers, it's faster. | |
10 | * However, it would be possible and maybe even useful to hack the kernel | |
11 | @@ -173,8 +172,8 @@ | |
12 | */ | |
13 | d->vendor_id = sysfs_get_value(d, "vendor"); | |
14 | d->device_id = sysfs_get_value(d, "device"); | |
15 | - d->known_fields |= PCI_FILL_IDENT; | |
16 | -#endif | |
17 | + d->device_class = sysfs_get_value(d, "class") >> 8; | |
18 | + d->known_fields |= PCI_FILL_IDENT | PCI_FILL_CLASS; | |
19 | } | |
20 | pci_link_dev(a, d); | |
21 | } | |
22 | --- pciutils-2.2.1/lib/pci.h.devicetype 2005-09-10 08:10:54.000000000 -0400 | |
23 | +++ pciutils-2.2.1/lib/pci.h 2005-12-13 17:02:12.000000000 -0500 | |
24 | @@ -84,6 +84,7 @@ | |
25 | /* These fields are set by pci_fill_info() */ | |
26 | int known_fields; /* Set of info fields already known */ | |
27 | u16 vendor_id, device_id; /* Identity of the device */ | |
28 | + u16 device_class; /* PCI device class */ | |
29 | int irq; /* IRQ number */ | |
30 | pciaddr_t base_addr[6]; /* Base addresses */ | |
31 | pciaddr_t size[6]; /* Region sizes */ | |
32 | @@ -118,6 +119,7 @@ | |
33 | #define PCI_FILL_BASES 4 | |
34 | #define PCI_FILL_ROM_BASE 8 | |
35 | #define PCI_FILL_SIZES 16 | |
36 | +#define PCI_FILL_CLASS 32 | |
37 | #define PCI_FILL_RESCAN 0x10000 | |
38 | ||
39 | void pci_setup_cache(struct pci_dev *, u8 *cache, int len); | |
40 | --- pciutils-2.2.1/lib/generic.c.devicetype 2004-08-13 16:15:23.000000000 -0400 | |
41 | +++ pciutils-2.2.1/lib/generic.c 2005-12-13 17:02:12.000000000 -0500 | |
42 | @@ -46,7 +46,8 @@ | |
43 | d->func = t->func; | |
44 | d->vendor_id = vd & 0xffff; | |
45 | d->device_id = vd >> 16U; | |
46 | - d->known_fields = PCI_FILL_IDENT; | |
47 | + d->device_class = pci_read_byte(t,PCI_CLASS_DEVICE+1) << 8 | pci_read_byte(t, PCI_CLASS_DEVICE); | |
48 | + d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS; | |
49 | d->hdrtype = ht; | |
50 | pci_link_dev(a, d); | |
51 | switch (ht) | |
52 | @@ -86,6 +87,8 @@ | |
53 | d->vendor_id = pci_read_word(d, PCI_VENDOR_ID); | |
54 | d->device_id = pci_read_word(d, PCI_DEVICE_ID); | |
55 | } | |
56 | + if (flags & PCI_FILL_CLASS) | |
57 | + d->device_class = pci_read_byte(d, PCI_CLASS_DEVICE+1) << 8 | pci_read_byte(d, PCI_CLASS_DEVICE); | |
58 | if (flags & PCI_FILL_IRQ) | |
59 | d->irq = pci_read_byte(d, PCI_INTERRUPT_LINE); | |
60 | if (flags & PCI_FILL_BASES) | |
61 | --- pciutils-2.2.1/lib/example.c.devicetype 2000-03-09 03:38:33.000000000 -0500 | |
62 | +++ pciutils-2.2.1/lib/example.c 2005-12-13 17:02:12.000000000 -0500 | |
63 | @@ -21,7 +21,7 @@ | |
64 | pci_scan_bus(pacc); /* We want to get the list of devices */ | |
65 | for(dev=pacc->devices; dev; dev=dev->next) /* Iterate over all devices */ | |
66 | { | |
67 | - pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES); /* Fill in header info we need */ | |
68 | + pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS); /* Fill in header info we need */ | |
69 | c = pci_read_word(dev, PCI_CLASS_DEVICE); /* Read config register directly */ | |
70 | printf("%02x:%02x.%d vendor=%04x device=%04x class=%04x irq=%d base0=%lx\n", | |
71 | dev->bus, dev->dev, dev->func, dev->vendor_id, dev->device_id, | |
72 | --- pciutils-2.2.1/lspci.c.devicetype 2005-11-26 06:48:29.000000000 -0500 | |
73 | +++ pciutils-2.2.1/lspci.c 2005-12-13 17:04:39.000000000 -0500 | |
74 | @@ -123,7 +123,7 @@ | |
75 | d->config_cached += 64; | |
76 | } | |
77 | pci_setup_cache(p, d->config, d->config_cached); | |
78 | - pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES); | |
79 | + pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES); | |
80 | return d; | |
81 | } | |
82 | ||
83 | @@ -255,7 +255,7 @@ | |
84 | printf(" %s: %s", | |
85 | pci_lookup_name(pacc, classbuf, sizeof(classbuf), | |
86 | PCI_LOOKUP_CLASS, | |
87 | - get_conf_word(d, PCI_CLASS_DEVICE)), | |
88 | + p->device_class), | |
89 | pci_lookup_name(pacc, devbuf, sizeof(devbuf), | |
90 | PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, | |
91 | p->vendor_id, p->device_id)); | |
92 | @@ -267,7 +267,7 @@ | |
93 | c = get_conf_byte(d, PCI_CLASS_PROG); | |
94 | x = pci_lookup_name(pacc, devbuf, sizeof(devbuf), | |
95 | PCI_LOOKUP_PROGIF | PCI_LOOKUP_NO_NUMBERS, | |
96 | - get_conf_word(d, PCI_CLASS_DEVICE), c); | |
97 | + p->device_class, c); | |
98 | if (c || x) | |
99 | { | |
100 | printf(" (prog-if %02x", c); | |
101 | @@ -1585,7 +1585,7 @@ | |
102 | struct pci_dev *p = d->dev; | |
103 | word status = get_conf_word(d, PCI_STATUS); | |
104 | word cmd = get_conf_word(d, PCI_COMMAND); | |
105 | - word class = get_conf_word(d, PCI_CLASS_DEVICE); | |
106 | + word class = p->device_class; | |
107 | byte bist = get_conf_byte(d, PCI_BIST); | |
108 | byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; | |
109 | byte latency = get_conf_byte(d, PCI_LATENCY_TIMER); | |
110 | @@ -1783,7 +1783,7 @@ | |
111 | show_slot_name(d); | |
112 | putchar('\n'); | |
113 | printf("Class:\t%s\n", | |
114 | - pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, get_conf_word(d, PCI_CLASS_DEVICE))); | |
115 | + pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, p->device_class)); | |
116 | printf("Vendor:\t%s\n", | |
117 | pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id)); | |
118 | printf("Device:\t%s\n", | |
119 | @@ -1805,7 +1805,7 @@ | |
120 | show_slot_name(d); | |
121 | printf(" \"%s\" \"%s\" \"%s\"", | |
122 | pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, | |
123 | - get_conf_word(d, PCI_CLASS_DEVICE)), | |
124 | + p->device_class), | |
125 | pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR, | |
126 | p->vendor_id, p->device_id), | |
127 | pci_lookup_name(pacc, devbuf, sizeof(devbuf), PCI_LOOKUP_DEVICE, | |
128 | @@ -1929,7 +1929,7 @@ | |
129 | last_br = &host_bridge.chain; | |
130 | for(d=first_dev; d; d=d->next) | |
131 | { | |
132 | - word class = get_conf_word(d, PCI_CLASS_DEVICE); | |
133 | + word class = d->dev->device_class; | |
134 | byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; | |
135 | if (class == PCI_CLASS_BRIDGE_PCI && | |
136 | (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS)) |