SOURCES: pciutils-deviceclass.patch (NEW) - added PCI device class...
charles
charles at pld-linux.org
Mon Oct 17 04:12:32 CEST 2005
Author: charles Date: Mon Oct 17 02:12:32 2005 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- added PCI device class support
---- Files affected:
SOURCES:
pciutils-deviceclass.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/pciutils-deviceclass.patch
diff -u /dev/null SOURCES/pciutils-deviceclass.patch:1.1
--- /dev/null Mon Oct 17 04:12:32 2005
+++ SOURCES/pciutils-deviceclass.patch Mon Oct 17 04:12:27 2005
@@ -0,0 +1,144 @@
+diff -U 3 -H -d -r -N -- pciutils-2.2.0.orig/lib/access.c pciutils-2.2.0/lib/access.c
+--- pciutils-2.2.0.orig/lib/access.c 2004-08-13 22:15:11.000000000 +0200
++++ pciutils-2.2.0/lib/access.c 2005-10-17 01:10:38.000000000 +0200
+@@ -183,7 +183,8 @@
+ void
+ pci_scan_bus(struct pci_access *a)
+ {
+- a->methods->scan(a);
++ if (a->methods)
++ a->methods->scan(a);
+ }
+
+ struct pci_dev *
+diff -U 3 -H -d -r -N -- pciutils-2.2.0.orig/lib/example.c pciutils-2.2.0/lib/example.c
+--- pciutils-2.2.0.orig/lib/example.c 2000-03-09 09:38:33.000000000 +0100
++++ pciutils-2.2.0/lib/example.c 2005-10-17 01:14:31.000000000 +0200
+@@ -21,7 +21,7 @@
+ pci_scan_bus(pacc); /* We want to get the list of devices */
+ for(dev=pacc->devices; dev; dev=dev->next) /* Iterate over all devices */
+ {
+- pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES); /* Fill in header info we need */
++ pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS); /* Fill in header info we need */
+ c = pci_read_word(dev, PCI_CLASS_DEVICE); /* Read config register directly */
+ printf("%02x:%02x.%d vendor=%04x device=%04x class=%04x irq=%d base0=%lx\n",
+ dev->bus, dev->dev, dev->func, dev->vendor_id, dev->device_id,
+diff -U 3 -H -d -r -N -- pciutils-2.2.0.orig/lib/generic.c pciutils-2.2.0/lib/generic.c
+--- pciutils-2.2.0.orig/lib/generic.c 2004-08-13 22:15:23.000000000 +0200
++++ pciutils-2.2.0/lib/generic.c 2005-10-17 01:17:02.000000000 +0200
+@@ -46,7 +46,8 @@
+ d->func = t->func;
+ d->vendor_id = vd & 0xffff;
+ d->device_id = vd >> 16U;
+- d->known_fields = PCI_FILL_IDENT;
++ d->device_class = pci_read_byte(t,PCI_CLASS_DEVICE+1) << 8 | pci_read_byte(t, PCI_CLASS_DEVICE);
++ d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS;
+ d->hdrtype = ht;
+ pci_link_dev(a, d);
+ switch (ht)
+@@ -86,6 +87,8 @@
+ d->vendor_id = pci_read_word(d, PCI_VENDOR_ID);
+ d->device_id = pci_read_word(d, PCI_DEVICE_ID);
+ }
++ if (flags & PCI_FILL_CLASS)
++ d->device_class = pci_read_byte(d, PCI_CLASS_DEVICE+1) << 8 | pci_read_byte(d, PCI_CLASS_DEVICE);
+ if (flags & PCI_FILL_IRQ)
+ d->irq = pci_read_byte(d, PCI_INTERRUPT_LINE);
+ if (flags & PCI_FILL_BASES)
+diff -U 3 -H -d -r -N -- pciutils-2.2.0.orig/lib/pci.h pciutils-2.2.0/lib/pci.h
+--- pciutils-2.2.0.orig/lib/pci.h 2005-09-10 14:10:54.000000000 +0200
++++ pciutils-2.2.0/lib/pci.h 2005-10-17 01:18:55.000000000 +0200
+@@ -84,6 +84,7 @@
+ /* These fields are set by pci_fill_info() */
+ int known_fields; /* Set of info fields already known */
+ u16 vendor_id, device_id; /* Identity of the device */
++ u16 device_class; /* PCI device class */
+ int irq; /* IRQ number */
+ pciaddr_t base_addr[6]; /* Base addresses */
+ pciaddr_t size[6]; /* Region sizes */
+@@ -118,6 +119,7 @@
+ #define PCI_FILL_BASES 4
+ #define PCI_FILL_ROM_BASE 8
+ #define PCI_FILL_SIZES 16
++#define PCI_FILL_CLASS 32
+ #define PCI_FILL_RESCAN 0x10000
+
+ void pci_setup_cache(struct pci_dev *, u8 *cache, int len);
+diff -U 3 -H -d -r -N -- pciutils-2.2.0.orig/lib/sysfs.c pciutils-2.2.0/lib/sysfs.c
+--- pciutils-2.2.0.orig/lib/sysfs.c 2005-09-21 13:51:00.000000000 +0200
++++ pciutils-2.2.0/lib/sysfs.c 2005-10-17 01:23:46.000000000 +0200
+@@ -175,6 +175,8 @@
+ d->device_id = sysfs_get_value(d, "device");
+ d->known_fields |= PCI_FILL_IDENT;
+ #endif
++ d->device_class = sysfs_get_value(d, "class") >> 8;
++ d->known_fields |= PCI_FILL_CLASS;
+ }
+ pci_link_dev(a, d);
+ }
+diff -U 3 -H -d -r -N -- pciutils-2.2.0.orig/lspci.c pciutils-2.2.0/lspci.c
+--- pciutils-2.2.0.orig/lspci.c 2005-09-21 13:56:18.000000000 +0200
++++ pciutils-2.2.0/lspci.c 2005-10-17 01:29:51.000000000 +0200
+@@ -123,7 +123,7 @@
+ d->config_cached += 64;
+ }
+ pci_setup_cache(p, d->config, d->config_cached);
+- pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
++ pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_CLASS);
+ return d;
+ }
+
+@@ -255,7 +255,7 @@
+ printf(" %s: %s",
+ pci_lookup_name(pacc, classbuf, sizeof(classbuf),
+ PCI_LOOKUP_CLASS,
+- get_conf_word(d, PCI_CLASS_DEVICE)),
++ p->device_class, 0, 0, 0),
+ pci_lookup_name(pacc, devbuf, sizeof(devbuf),
+ PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
+ p->vendor_id, p->device_id));
+@@ -267,7 +267,7 @@
+ c = get_conf_byte(d, PCI_CLASS_PROG);
+ x = pci_lookup_name(pacc, devbuf, sizeof(devbuf),
+ PCI_LOOKUP_PROGIF | PCI_LOOKUP_NO_NUMBERS,
+- get_conf_word(d, PCI_CLASS_DEVICE), c);
++ p->device_class, c, 0, 0);
+ if (c || x)
+ {
+ printf(" (prog-if %02x", c);
+@@ -1585,7 +1585,7 @@
+ struct pci_dev *p = d->dev;
+ word status = get_conf_word(d, PCI_STATUS);
+ word cmd = get_conf_word(d, PCI_COMMAND);
+- word class = get_conf_word(d, PCI_CLASS_DEVICE);
++ word class = p->device_class;
+ byte bist = get_conf_byte(d, PCI_BIST);
+ byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
+ byte latency = get_conf_byte(d, PCI_LATENCY_TIMER);
+@@ -1783,7 +1783,7 @@
+ show_slot_name(d);
+ putchar('\n');
+ printf("Class:\t%s\n",
+- pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, get_conf_word(d, PCI_CLASS_DEVICE)));
++ pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, p->device_class, 0, 0, 0));
+ printf("Vendor:\t%s\n",
+ pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id));
+ printf("Device:\t%s\n",
+@@ -1805,7 +1805,7 @@
+ show_slot_name(d);
+ printf(" \"%s\" \"%s\" \"%s\"",
+ pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS,
+- get_conf_word(d, PCI_CLASS_DEVICE)),
++ p->device_class, 0, 0, 0),
+ pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR,
+ p->vendor_id, p->device_id),
+ pci_lookup_name(pacc, devbuf, sizeof(devbuf), PCI_LOOKUP_DEVICE,
+@@ -1931,7 +1931,7 @@
+ last_br = &host_bridge.chain;
+ for(d=first_dev; d; d=d->next)
+ {
+- word class = get_conf_word(d, PCI_CLASS_DEVICE);
++ word class = d->dev->device_class;
+ byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
+ if (class == PCI_CLASS_BRIDGE_PCI &&
+ (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS))
================================================================
More information about the pld-cvs-commit
mailing list