This hopefully conveys the purpose much better than just "aux".
dd->allocated = len;
dd->len = 0;
memset(dd->data, 0xff, len);
- dev->aux = dd;
+ dev->backend_data = dd;
}
static int
dump_validate(buf, "#######: ") || dump_validate(buf, "########: ")) &&
sscanf(buf, "%x: ", &i) == 1)
{
- struct dump_data *dd = dev->aux;
+ struct dump_data *dd = dev->backend_data;
z = strchr(buf, ' ') + 1;
while (isxdigit(z[0]) && isxdigit(z[1]) && (!z[2] || z[2] == ' ') &&
sscanf(z, "%x", &j) == 1 && j < 256)
if (i >= dd->allocated) /* Need to re-allocate the buffer */
{
dump_alloc_data(dev, 4096);
- memcpy(((struct dump_data *) dev->aux)->data, dd->data, 256);
+ memcpy(((struct dump_data *) dev->backend_data)->data, dd->data, 256);
pci_mfree(dd);
- dd = dev->aux;
+ dd = dev->backend_data;
}
dd->data[i++] = j;
if (i > dd->len)
dump_read(struct pci_dev *d, int pos, byte *buf, int len)
{
struct dump_data *dd;
- if (!(dd = d->aux))
+ if (!(dd = d->backend_data))
{
struct pci_dev *e = d->access->devices;
while (e && (e->domain != d->domain || e->bus != d->bus || e->dev != d->dev || e->func != d->func))
e = e->next;
if (!e)
return 0;
- dd = e->aux;
+ dd = e->backend_data;
}
if (pos + len > dd->len)
return 0;
static void
dump_cleanup_dev(struct pci_dev *d)
{
- if (d->aux)
+ if (d->backend_data)
{
- pci_mfree(d->aux);
- d->aux = NULL;
+ pci_mfree(d->backend_data);
+ d->backend_data = NULL;
}
}
int w;
};
-struct ecam_aux
+// Back-end data linked to struct pci_access
+struct ecam_access
{
struct acpi_mcfg *mcfg;
struct mmap_cache *cache;
static void
munmap_reg(struct pci_access *a)
{
- struct ecam_aux *aux = a->aux;
- struct mmap_cache *cache = aux->cache;
+ struct ecam_access *eacc = a->backend_data;
+ struct mmap_cache *cache = eacc->cache;
if (!cache)
return;
munmap(cache->map, cache->length + (cache->addr & (pagesize-1)));
pci_mfree(cache);
- aux->cache = NULL;
+ eacc->cache = NULL;
}
static int
mmap_reg(struct pci_access *a, int w, int domain, u8 bus, u8 dev, u8 func, int pos, volatile void **reg)
{
- struct ecam_aux *aux = a->aux;
- struct mmap_cache *cache = aux->cache;
+ struct ecam_access *eacc = a->backend_data;
+ struct mmap_cache *cache = eacc->cache;
const char *addrs;
void *map;
off_t addr;
else
{
addrs = pci_get_param(a, "ecam.addrs");
- if (!get_bus_addr(aux->mcfg, addrs, domain, bus, &addr, &length))
+ if (!get_bus_addr(eacc->mcfg, addrs, domain, bus, &addr, &length))
return 0;
map = mmap(NULL, length + (addr & (pagesize-1)), w ? PROT_WRITE : PROT_READ, MAP_SHARED, a->fd, addr & ~(pagesize-1));
if (cache)
munmap(cache->map, cache->length + (cache->addr & (pagesize-1)));
else
- cache = aux->cache = pci_malloc(a, sizeof(*cache));
+ cache = eacc->cache = pci_malloc(a, sizeof(*cache));
cache->map = map;
cache->addr = addr;
#endif
const char *addrs = pci_get_param(a, "ecam.addrs");
struct acpi_mcfg *mcfg = NULL;
- struct ecam_aux *aux = NULL;
+ struct ecam_access *eacc = NULL;
int use_bsd = 0;
int use_x86bios = 0;
int test_domain = 0;
a->error("Option ecam.addrs was not specified and ACPI MCFG table cannot be found.");
}
- aux = pci_malloc(a, sizeof(*aux));
- aux->mcfg = mcfg;
- aux->cache = NULL;
- a->aux = aux;
+ eacc = pci_malloc(a, sizeof(*eacc));
+ eacc->mcfg = mcfg;
+ eacc->cache = NULL;
+ a->backend_data = eacc;
if (mcfg)
get_mcfg_allocation(mcfg, 0, &test_domain, &test_bus, NULL, NULL, NULL);
static void
ecam_cleanup(struct pci_access *a)
{
- struct ecam_aux *aux = a->aux;
+ struct ecam_access *eacc = a->backend_data;
if (a->fd < 0)
return;
munmap_reg(a);
- pci_mfree(aux->mcfg);
- pci_mfree(aux);
+ pci_mfree(eacc->mcfg);
+ pci_mfree(eacc);
+ a->backend_data = NULL;
close(a->fd);
a->fd = -1;
ecam_scan(struct pci_access *a)
{
const char *addrs = pci_get_param(a, "ecam.addrs");
- struct ecam_aux *aux = a->aux;
+ struct ecam_access *eacc = a->backend_data;
u32 *segments;
int i, j, count;
int domain;
segments = pci_malloc(a, 0xFFFF/8);
memset(segments, 0, 0xFFFF/8);
- if (aux->mcfg)
+ if (eacc->mcfg)
{
- count = get_mcfg_allocations_count(aux->mcfg);
+ count = get_mcfg_allocations_count(eacc->mcfg);
for (i = 0; i < count; i++)
- segments[aux->mcfg->allocations[i].pci_segment / 32] |= 1 << (aux->mcfg->allocations[i].pci_segment % 32);
+ segments[eacc->mcfg->allocations[i].pci_segment / 32] |= 1 << (eacc->mcfg->allocations[i].pci_segment % 32);
}
else
{
static void
hurd_init_dev(struct pci_dev *d)
{
- d->aux = pci_malloc(d->access, sizeof(mach_port_t));
- *((mach_port_t *) d->aux) = MACH_PORT_NULL;
+ d->backend_data = pci_malloc(d->access, sizeof(mach_port_t));
+ *((mach_port_t *) d->backend_data) = MACH_PORT_NULL;
}
/* Deallocate the port and free its space */
{
mach_port_t device_port;
- device_port = *((mach_port_t *) d->aux);
+ device_port = *((mach_port_t *) d->backend_data);
mach_port_deallocate(mach_task_self(), device_port);
- pci_mfree(d->aux);
+ pci_mfree(d->backend_data);
+ d->backend_data = NULL;
}
static mach_port_t
device_port_lookup(struct pci_dev *d)
{
char server[NAME_MAX];
- mach_port_t device_port = *((mach_port_t *) d->aux);
+ mach_port_t device_port = *((mach_port_t *) d->backend_data);
if (device_port != MACH_PORT_NULL)
return device_port;
if (device_port == MACH_PORT_NULL)
d->access->error("Cannot find the PCI arbiter");
- *((mach_port_t *) d->aux) = device_port;
+ *((mach_port_t *) d->backend_data) = device_port;
return device_port;
}
static void
munmap_regs(struct pci_access *a)
{
- struct mmio_cache *cache = a->aux;
+ struct mmio_cache *cache = a->backend_data;
if (!cache)
return;
if (cache->addr_page != cache->data_page)
munmap(cache->data_map, pagesize);
- pci_mfree(a->aux);
- a->aux = NULL;
+ pci_mfree(a->backend_data);
+ a->backend_data = NULL;
}
static int
mmap_regs(struct pci_access *a, off_t addr_reg, off_t data_reg, int data_off, volatile void **addr, volatile void **data)
{
- struct mmio_cache *cache = a->aux;
+ struct mmio_cache *cache = a->backend_data;
off_t addr_page = addr_reg & ~(pagesize-1);
off_t data_page = data_reg & ~(pagesize-1);
void *addr_map = MAP_FAILED;
munmap(cache->data_map, pagesize);
if (!cache)
- cache = a->aux = pci_malloc(a, sizeof(*cache));
+ cache = a->backend_data = pci_malloc(a, sizeof(*cache));
cache->addr_page = addr_page;
cache->data_page = data_page;
int fd_rw; /* proc/sys: fd opened read-write */
int fd_vpd; /* sys: fd for VPD */
struct pci_dev *cached_dev; /* proc/sys: device the fds are for */
- void *aux; /* Auxiliary data for use by the back-end */
+ void *backend_data; /* Private data of the back end */
};
/* Initialize PCI access */
u8 *cache; /* Cached config registers */
int cache_len;
int hdrtype; /* Cached low 7 bits of header type, -1 if unknown */
- void *aux; /* Auxiliary data for use by the back-end */
+ void *backend_data; /* Private data for of the back end */
struct pci_property *properties; /* A linked list of extra properties */
struct pci_cap *last_cap; /* Last capability in the list */
};
LPWSTR service_name = NULL;
ULONG devinst_id_len = 0;
char *driver_path = NULL;
- DEVINST devinst = (DEVINST)d->aux;
+ DEVINST devinst = (DEVINST)d->backend_data;
ULONG problem = 0;
ULONG status = 0;
HKEY key = NULL;
d = pci_get_dev(a, domain, bus, dev, func);
pci_link_dev(a, d);
- if (!d->access->aux)
+ if (!d->access->backend_data)
d->no_config_access = 1;
- d->aux = (void *)devinst;
+ d->backend_data = (void *)devinst;
/* Parse device id part of devinst id and fill details into pci_dev. */
if (!a->buscentric)
fill_resources(d, devinst, devinst_id);
/*
- * Set parent field to cfgmgr32 parent devinst handle and aux field to current
+ * Set parent field to cfgmgr32 parent devinst handle and backend_data field to current
* devinst handle. At later stage in win32_cfgmgr32_scan() when all pci_dev
* devices are linked, change every devinst handle by pci_dev.
*/
for (d1 = a->devices; d1; d1 = d1->next)
{
for (d2 = a->devices; d2; d2 = d2->next)
- if ((DEVINST)d1->parent == (DEVINST)d2->aux)
+ if ((DEVINST)d1->parent == (DEVINST)d2->backend_data)
break;
d1->parent = d2;
if (d1->parent)
}
}
- /* devinst stored in ->aux is not needed anymore, clear it. */
+ /* devinst stored in ->backend_data is not needed anymore, clear it. */
for (d = a->devices; d; d = d->next)
- d->aux = NULL;
+ d->backend_data = NULL;
pci_mfree(devinst_id_list);
}
* All available flags were filled by win32_cfgmgr32_scan().
* Filling more flags is possible only from config space.
*/
- if (!d->access->aux)
+ if (!d->access->backend_data)
return;
pci_generic_fill_info(d, flags);
win32_cfgmgr32_read(struct pci_dev *d, int pos, byte *buf, int len)
{
struct pci_access *a = d->access;
- struct pci_access *acfg = a->aux;
- struct pci_dev *dcfg = d->aux;
+ struct pci_access *acfg = a->backend_data;
+ struct pci_dev *dcfg = d->backend_data;
if (!acfg)
return pci_emulated_read(d, pos, buf, len);
if (!dcfg)
- d->aux = dcfg = pci_get_dev(acfg, d->domain, d->bus, d->dev, d->func);
+ d->backend_data = dcfg = pci_get_dev(acfg, d->domain, d->bus, d->dev, d->func);
return pci_read_block(dcfg, pos, buf, len);
}
win32_cfgmgr32_write(struct pci_dev *d, int pos, byte *buf, int len)
{
struct pci_access *a = d->access;
- struct pci_access *acfg = a->aux;
- struct pci_dev *dcfg = d->aux;
+ struct pci_access *acfg = a->backend_data;
+ struct pci_dev *dcfg = d->backend_data;
if (!acfg)
return 0;
if (!dcfg)
- d->aux = dcfg = pci_get_dev(acfg, d->domain, d->bus, d->dev, d->func);
+ d->backend_data = dcfg = pci_get_dev(acfg, d->domain, d->bus, d->dev, d->func);
return pci_write_block(dcfg, pos, buf, len);
}
static void
win32_cfgmgr32_cleanup_dev(struct pci_dev *d)
{
- struct pci_dev *dcfg = d->aux;
+ struct pci_dev *dcfg = d->backend_data;
if (dcfg)
pci_free_dev(dcfg);
return;
}
- a->aux = acfg;
+ a->backend_data = acfg;
}
static void
win32_cfgmgr32_cleanup(struct pci_access *a)
{
- struct pci_access *acfg = a->aux;
+ struct pci_access *acfg = a->backend_data;
if (acfg)
pci_cleanup(acfg);