Magellan Linux

Contents of /trunk/pciutils/patches/pciutils-2.2.0-devicetype.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years ago) by niro
File size: 6155 byte(s)
-import

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