static int mcpcia_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) { struct pci_controller *hose = bus->sysdata; unsigned long addr, w; unsigned char type1; if (mk_conf_addr(bus, devfn, where, hose, &addr, &type1)) return PCIBIOS_DEVICE_NOT_FOUND; addr |= (size - 1) * 8; w = conf_read(addr, type1, hose); switch (size) { case 1: *value = __kernel_extbl(w, where & 3); break; case 2: *value = __kernel_extwl(w, where & 3); break; case 4: *value = w; break; } return PCIBIOS_SUCCESSFUL; }
static int mcpcia_read_config_word(struct pci_dev *dev, int where, u16 *value) { struct pci_controler *hose = dev->sysdata; unsigned long addr, w; unsigned char type1; if (mk_conf_addr(dev, where, hose, &addr, &type1)) return PCIBIOS_DEVICE_NOT_FOUND; addr |= 0x08; w = conf_read(addr, type1, hose); *value = __kernel_extwl(w, where & 3); return PCIBIOS_SUCCESSFUL; }