- /* Basic Algorithm
- ** Should only get here on fully working LBA rev.
- ** This is how simple the original LBA code should have been.
- */
- LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
- switch(size) {
- case 1: *(u8 *) data = READ_REG8(d->hba.base_addr + LBA_PCI_CFG_DATA
- + (pos & 3));
- DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos,
- *(u8 *)data);
- return(*(u8 *)data == (u8) ~0U);
- case 2: *(u16 *) data = READ_REG16(d->hba.base_addr + LBA_PCI_CFG_DATA
- + (pos & 2));
- DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos,
- *(u16 *)data);
- return(*(u16 *)data == (u16) ~0U);
- case 4: *(u32 *) data = READ_REG32(d->hba.base_addr + LBA_PCI_CFG_DATA);
- DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos, *data);
- return(*data == ~0U);
- }
- DBG_CFG("%s(%x+%2x) -> bad size (%d)\n", __FUNCTION__, tok, pos, size);
- *data = ~0U;
- return(!PCIBIOS_SUCCESSFUL); /* failed */
-}
-
-/*
- * LBA 4.0 config write code implements non-postable semantics
- * by doing a read of CONFIG ADDR after the write.
- */
-
-static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data)
-{
- struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
- unsigned long data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
- u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
- u32 tok = LBA_CFG_TOK(local_bus,devfn);
-
- ASSERT((tok & 0xff) == 0);
- ASSERT(pos < 0x100);
-
- DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __FUNCTION__, tok, pos, data);
-
- /* Basic Algorithm */
- LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
- switch(size) {
- case 1: WRITE_REG8 (data, data_reg + (pos & 3)); break;
- case 2: WRITE_REG16(data, data_reg + (pos & 2)); break;
- case 4: WRITE_REG32(data, data_reg); break;
- default:
- DBG_CFG("%s(%x+%2x) WTF! size %d\n", __FUNCTION__, tok, pos,
- size);
- }
-
- /* flush posted write */
- lba_t32 = READ_U32(d->hba.base_addr + LBA_PCI_CFG_ADDR);
- return PCIBIOS_SUCCESSFUL;
-}
-
-
-static struct pci_ops mercury_cfg_ops = {
- .read = mercury_cfg_read,
- .write = mercury_cfg_write,
-};
-#else
-#define mercury_cfg_ops lba_cfg_ops
-#endif /* CONFIG_PARISC64 */
-
-
-static int lba_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data)
-{
- struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
- u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
- u32 tok = LBA_CFG_TOK(local_bus, devfn);