Append [enhanced] to Regions that contain the BEI flag in sysfs.
To do this, we need to add the resource flags to the pci_dev struct.
This struct is passed through the libpci API, so we increment the API version number.
Don't truncate least significant bits of the region size.
ex: a 2000 byte region should display [size=2000] instead of [size=1K]
Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
}
int
-pci_fill_info_v34(struct pci_dev *d, int flags)
+pci_fill_info_v35(struct pci_dev *d, int flags)
{
if (flags & PCI_FILL_RESCAN)
{
}
/* In version 3.1, pci_fill_info got new flags => versioned alias */
-/* In versions 3.2, 3.3 and 3.4, the same has happened */
-STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v34(d, flags));
-DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v34);
-DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v34);
-DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v34);
-DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v34);
+/* In versions 3.2, 3.3, 3.4 and 3.5, the same has happened */
+STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v35(d, flags));
+DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v35);
+DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v35);
+DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v35);
+DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v35);
+DEFINE_ALIAS(int pci_fill_info_v34(struct pci_dev *d, int flags), pci_fill_info_v35);
SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@LIBPCI_3.1);
SYMBOL_VERSION(pci_fill_info_v32, pci_fill_info@LIBPCI_3.2);
SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@LIBPCI_3.3);
-SYMBOL_VERSION(pci_fill_info_v34, pci_fill_info@@LIBPCI_3.4);
+SYMBOL_VERSION(pci_fill_info_v34, pci_fill_info@LIBPCI_3.4);
+SYMBOL_VERSION(pci_fill_info_v35, pci_fill_info@@LIBPCI_3.5);
void
pci_setup_cache(struct pci_dev *d, byte *cache, int len)
{
struct pci_cap *c;
- pci_fill_info_v34(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
+ pci_fill_info_v35(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
for (c=d->first_cap; c; c=c->next)
if (c->type == type && c->id == id)
return c;
return 0;
if (f->device >= 0 || f->vendor >= 0)
{
- pci_fill_info_v34(d, PCI_FILL_IDENT);
+ pci_fill_info_v35(d, PCI_FILL_IDENT);
if ((f->device >= 0 && f->device != d->device_id) ||
(f->vendor >= 0 && f->vendor != d->vendor_id))
return 0;
#define PCI_VENDOR_ID_INTEL 0x8086
#define PCI_VENDOR_ID_COMPAQ 0x0e11
+
+/* taken from <include/linux/ioport.h> */
+
+#define IORESOURCE_PCI_EA_BEI (1<<5)
global:
pci_fill_info;
};
+
+LIBPCI_3.5 {
+ global:
+ pci_fill_info;
+};
char *module_alias; /* Linux kernel module alias */
char *label; /* Device name as exported by BIOS */
int numa_node; /* NUMA node */
+ pciaddr_t flags[6]; /* Region IORESOURCE flags */
+ pciaddr_t rom_flags; /* Expansion ROM IORESOURCE flags */
/* Fields used internally: */
struct pci_access *access;
#define PCI_FILL_MODULE_ALIAS 0x0200
#define PCI_FILL_LABEL 0x0400
#define PCI_FILL_NUMA_NODE 0x0800
+#define PCI_FILL_IO_FLAGS 0x1000
#define PCI_FILL_RESCAN 0x00010000
void pci_setup_cache(struct pci_dev *, u8 *cache, int len) PCI_ABI;
size = end - start + 1;
else
size = 0;
- flags &= PCI_ADDR_FLAG_MASK;
if (i < 6)
{
+ d->flags[i] = flags;
+ flags &= PCI_ADDR_FLAG_MASK;
d->base_addr[i] = start | flags;
d->size[i] = size;
}
else
{
+ d->rom_flags = flags;
+ flags &= PCI_ADDR_FLAG_MASK;
d->rom_base_addr = start | flags;
d->rom_size = size;
}
d->vendor_id = sysfs_get_value(d, "vendor", 1);
d->device_id = sysfs_get_value(d, "device", 1);
d->device_class = sysfs_get_value(d, "class", 1) >> 8;
- d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES;
+ d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_IO_FLAGS;
}
pci_link_dev(a, d);
}
if (!x)
return;
for (i = 0; i < (sizeof(suffix) / sizeof(*suffix) - 1); i++) {
- if (x < 1024)
+ if (x % 1024)
break;
x /= 1024;
}
{
pciaddr_t pos = p->base_addr[i];
pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->size[i] : 0;
+ pciaddr_t ioflg = (p->known_fields & PCI_FILL_IO_FLAGS) ? p->flags[i] : 0;
u32 flg = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
if (flg == 0xffffffff)
flg = 0;
printf("\tRegion %d: ", i);
else
putchar('\t');
- if (pos && !flg) /* Reported by the OS, but not by the device */
+ if (ioflg & IORESOURCE_PCI_EA_BEI)
+ printf("[enhanced] ");
+ else if (pos && !flg) /* Reported by the OS, but not by the device */
{
printf("[virtual] ");
flg = pos;
struct pci_dev *p = d->dev;
pciaddr_t rom = p->rom_base_addr;
pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->rom_size : 0;
+ pciaddr_t ioflg = (p->known_fields & PCI_FILL_IO_FLAGS) ? p->rom_flags : 0;
u32 flg = get_conf_long(d, reg);
word cmd = get_conf_word(d, PCI_COMMAND);
int virtual = 0;
if (!rom && !flg && !len)
return;
putchar('\t');
- if ((rom & PCI_ROM_ADDRESS_MASK) && !(flg & PCI_ROM_ADDRESS_MASK))
+ if (ioflg & IORESOURCE_PCI_EA_BEI)
+ printf("[enhanced] ");
+ else if ((rom & PCI_ROM_ADDRESS_MASK) && !(flg & PCI_ROM_ADDRESS_MASK))
{
printf("[virtual] ");
flg = rom;