Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 131715
Collapse All | Expand All

(-)pciutils-2.2.1/lib/sysfs.c.devicetype (-3 / +2 lines)
Lines 164-170 Link Here
164
	  sysfs_get_resources(d);
164
	  sysfs_get_resources(d);
165
	  d->irq = sysfs_get_value(d, "irq");
165
	  d->irq = sysfs_get_value(d, "irq");
166
	  d->known_fields = PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES;
166
	  d->known_fields = PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES;
167
#if 0
168
	  /*
167
	  /*
169
	   *  We prefer reading these from the config registers, it's faster.
168
	   *  We prefer reading these from the config registers, it's faster.
170
	   *  However, it would be possible and maybe even useful to hack the kernel
169
	   *  However, it would be possible and maybe even useful to hack the kernel
Lines 173-180 Link Here
173
	   */
172
	   */
174
	  d->vendor_id = sysfs_get_value(d, "vendor");
173
	  d->vendor_id = sysfs_get_value(d, "vendor");
175
	  d->device_id = sysfs_get_value(d, "device");
174
	  d->device_id = sysfs_get_value(d, "device");
176
	  d->known_fields |= PCI_FILL_IDENT;
175
	  d->device_class = sysfs_get_value(d, "class") >> 8;
177
#endif
176
	  d->known_fields |= PCI_FILL_IDENT | PCI_FILL_CLASS;
178
	}
177
	}
179
      pci_link_dev(a, d);
178
      pci_link_dev(a, d);
180
    }
179
    }
(-)pciutils-2.2.1/lib/pci.h.devicetype (+2 lines)
Lines 84-89 Link Here
84
  /* These fields are set by pci_fill_info() */
84
  /* These fields are set by pci_fill_info() */
85
  int known_fields;			/* Set of info fields already known */
85
  int known_fields;			/* Set of info fields already known */
86
  u16 vendor_id, device_id;		/* Identity of the device */
86
  u16 vendor_id, device_id;		/* Identity of the device */
87
  u16 device_class;			/* PCI device class */
87
  int irq;				/* IRQ number */
88
  int irq;				/* IRQ number */
88
  pciaddr_t base_addr[6];		/* Base addresses */
89
  pciaddr_t base_addr[6];		/* Base addresses */
89
  pciaddr_t size[6];			/* Region sizes */
90
  pciaddr_t size[6];			/* Region sizes */
Lines 118-123 Link Here
118
#define PCI_FILL_BASES		4
119
#define PCI_FILL_BASES		4
119
#define PCI_FILL_ROM_BASE	8
120
#define PCI_FILL_ROM_BASE	8
120
#define PCI_FILL_SIZES		16
121
#define PCI_FILL_SIZES		16
122
#define PCI_FILL_CLASS		32
121
#define PCI_FILL_RESCAN		0x10000
123
#define PCI_FILL_RESCAN		0x10000
122
124
123
void pci_setup_cache(struct pci_dev *, u8 *cache, int len);
125
void pci_setup_cache(struct pci_dev *, u8 *cache, int len);
(-)pciutils-2.2.1/lib/generic.c.devicetype (-1 / +4 lines)
Lines 46-52 Link Here
46
	  d->func = t->func;
46
	  d->func = t->func;
47
	  d->vendor_id = vd & 0xffff;
47
	  d->vendor_id = vd & 0xffff;
48
	  d->device_id = vd >> 16U;
48
	  d->device_id = vd >> 16U;
49
	  d->known_fields = PCI_FILL_IDENT;
49
	  d->device_class = pci_read_byte(t,PCI_CLASS_DEVICE+1) << 8 | pci_read_byte(t, PCI_CLASS_DEVICE);
50
	  d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS;
50
	  d->hdrtype = ht;
51
	  d->hdrtype = ht;
51
	  pci_link_dev(a, d);
52
	  pci_link_dev(a, d);
52
	  switch (ht)
53
	  switch (ht)
Lines 86-91 Link Here
86
      d->vendor_id = pci_read_word(d, PCI_VENDOR_ID);
87
      d->vendor_id = pci_read_word(d, PCI_VENDOR_ID);
87
      d->device_id = pci_read_word(d, PCI_DEVICE_ID);
88
      d->device_id = pci_read_word(d, PCI_DEVICE_ID);
88
    }
89
    }
90
  if (flags & PCI_FILL_CLASS)
91
      d->device_class = pci_read_byte(d, PCI_CLASS_DEVICE+1) << 8 | pci_read_byte(d, PCI_CLASS_DEVICE);
89
  if (flags & PCI_FILL_IRQ)
92
  if (flags & PCI_FILL_IRQ)
90
    d->irq = pci_read_byte(d, PCI_INTERRUPT_LINE);
93
    d->irq = pci_read_byte(d, PCI_INTERRUPT_LINE);
91
  if (flags & PCI_FILL_BASES)
94
  if (flags & PCI_FILL_BASES)
(-)pciutils-2.2.1/lib/example.c.devicetype (-1 / +1 lines)
Lines 21-27 Link Here
21
  pci_scan_bus(pacc);		/* We want to get the list of devices */
21
  pci_scan_bus(pacc);		/* We want to get the list of devices */
22
  for(dev=pacc->devices; dev; dev=dev->next)	/* Iterate over all devices */
22
  for(dev=pacc->devices; dev; dev=dev->next)	/* Iterate over all devices */
23
    {
23
    {
24
      pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES);	/* Fill in header info we need */
24
      pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS);	/* Fill in header info we need */
25
      c = pci_read_word(dev, PCI_CLASS_DEVICE);	/* Read config register directly */
25
      c = pci_read_word(dev, PCI_CLASS_DEVICE);	/* Read config register directly */
26
      printf("%02x:%02x.%d vendor=%04x device=%04x class=%04x irq=%d base0=%lx\n",
26
      printf("%02x:%02x.%d vendor=%04x device=%04x class=%04x irq=%d base0=%lx\n",
27
	     dev->bus, dev->dev, dev->func, dev->vendor_id, dev->device_id,
27
	     dev->bus, dev->dev, dev->func, dev->vendor_id, dev->device_id,
(-)pciutils-2.2.1/lspci.c.devicetype (-7 / +7 lines)
Lines 123-129 Link Here
123
	d->config_cached += 64;
123
	d->config_cached += 64;
124
    }
124
    }
125
  pci_setup_cache(p, d->config, d->config_cached);
125
  pci_setup_cache(p, d->config, d->config_cached);
126
  pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
126
  pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
127
  return d;
127
  return d;
128
}
128
}
129
129
Lines 255-261 Link Here
255
  printf(" %s: %s",
255
  printf(" %s: %s",
256
	 pci_lookup_name(pacc, classbuf, sizeof(classbuf),
256
	 pci_lookup_name(pacc, classbuf, sizeof(classbuf),
257
			 PCI_LOOKUP_CLASS,
257
			 PCI_LOOKUP_CLASS,
258
			 get_conf_word(d, PCI_CLASS_DEVICE)),
258
			 p->device_class),
259
	 pci_lookup_name(pacc, devbuf, sizeof(devbuf),
259
	 pci_lookup_name(pacc, devbuf, sizeof(devbuf),
260
			 PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
260
			 PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
261
			 p->vendor_id, p->device_id));
261
			 p->vendor_id, p->device_id));
Lines 267-273 Link Here
267
      c = get_conf_byte(d, PCI_CLASS_PROG);
267
      c = get_conf_byte(d, PCI_CLASS_PROG);
268
      x = pci_lookup_name(pacc, devbuf, sizeof(devbuf),
268
      x = pci_lookup_name(pacc, devbuf, sizeof(devbuf),
269
			  PCI_LOOKUP_PROGIF | PCI_LOOKUP_NO_NUMBERS,
269
			  PCI_LOOKUP_PROGIF | PCI_LOOKUP_NO_NUMBERS,
270
			  get_conf_word(d, PCI_CLASS_DEVICE), c);
270
			  p->device_class, c);
271
      if (c || x)
271
      if (c || x)
272
	{
272
	{
273
	  printf(" (prog-if %02x", c);
273
	  printf(" (prog-if %02x", c);
Lines 1585-1591 Link Here
1585
  struct pci_dev *p = d->dev;
1585
  struct pci_dev *p = d->dev;
1586
  word status = get_conf_word(d, PCI_STATUS);
1586
  word status = get_conf_word(d, PCI_STATUS);
1587
  word cmd = get_conf_word(d, PCI_COMMAND);
1587
  word cmd = get_conf_word(d, PCI_COMMAND);
1588
  word class = get_conf_word(d, PCI_CLASS_DEVICE);
1588
  word class = p->device_class;
1589
  byte bist = get_conf_byte(d, PCI_BIST);
1589
  byte bist = get_conf_byte(d, PCI_BIST);
1590
  byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
1590
  byte htype = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
1591
  byte latency = get_conf_byte(d, PCI_LATENCY_TIMER);
1591
  byte latency = get_conf_byte(d, PCI_LATENCY_TIMER);
Lines 1783-1789 Link Here
1783
      show_slot_name(d);
1783
      show_slot_name(d);
1784
      putchar('\n');
1784
      putchar('\n');
1785
      printf("Class:\t%s\n",
1785
      printf("Class:\t%s\n",
1786
	     pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, get_conf_word(d, PCI_CLASS_DEVICE)));
1786
	     pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS, p->device_class));
1787
      printf("Vendor:\t%s\n",
1787
      printf("Vendor:\t%s\n",
1788
	     pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id));
1788
	     pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR, p->vendor_id, p->device_id));
1789
      printf("Device:\t%s\n",
1789
      printf("Device:\t%s\n",
Lines 1805-1811 Link Here
1805
      show_slot_name(d);
1805
      show_slot_name(d);
1806
      printf(" \"%s\" \"%s\" \"%s\"",
1806
      printf(" \"%s\" \"%s\" \"%s\"",
1807
	     pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS,
1807
	     pci_lookup_name(pacc, classbuf, sizeof(classbuf), PCI_LOOKUP_CLASS,
1808
			     get_conf_word(d, PCI_CLASS_DEVICE)),
1808
			     p->device_class),
1809
	     pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR,
1809
	     pci_lookup_name(pacc, vendbuf, sizeof(vendbuf), PCI_LOOKUP_VENDOR,
1810
			     p->vendor_id, p->device_id),
1810
			     p->vendor_id, p->device_id),
1811
	     pci_lookup_name(pacc, devbuf, sizeof(devbuf), PCI_LOOKUP_DEVICE,
1811
	     pci_lookup_name(pacc, devbuf, sizeof(devbuf), PCI_LOOKUP_DEVICE,
Lines 1929-1935 Link Here
1929
  last_br = &host_bridge.chain;
1929
  last_br = &host_bridge.chain;
1930
  for(d=first_dev; d; d=d->next)
1930
  for(d=first_dev; d; d=d->next)
1931
    {
1931
    {
1932
      word class = get_conf_word(d, PCI_CLASS_DEVICE);
1932
      word class = d->dev->device_class;
1933
      byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
1933
      byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f;
1934
      if (class == PCI_CLASS_BRIDGE_PCI &&
1934
      if (class == PCI_CLASS_BRIDGE_PCI &&
1935
	  (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS))
1935
	  (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS))

Return to bug 131715