diff options
Diffstat (limited to 'drivers/parisc/lba_pci.c')
| -rw-r--r-- | drivers/parisc/lba_pci.c | 122 |
1 files changed, 12 insertions, 110 deletions
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 3fe4a77fa16a..ba6769934c77 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
| @@ -46,9 +46,9 @@ | |||
| 46 | #include <asm/page.h> | 46 | #include <asm/page.h> |
| 47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
| 48 | 48 | ||
| 49 | #include <asm/ropes.h> | ||
| 49 | #include <asm/hardware.h> /* for register_parisc_driver() stuff */ | 50 | #include <asm/hardware.h> /* for register_parisc_driver() stuff */ |
| 50 | #include <asm/parisc-device.h> | 51 | #include <asm/parisc-device.h> |
| 51 | #include <asm/iosapic.h> /* for iosapic_register() */ | ||
| 52 | #include <asm/io.h> /* read/write stuff */ | 52 | #include <asm/io.h> /* read/write stuff */ |
| 53 | 53 | ||
| 54 | #undef DEBUG_LBA /* general stuff */ | 54 | #undef DEBUG_LBA /* general stuff */ |
| @@ -100,113 +100,10 @@ | |||
| 100 | 100 | ||
| 101 | #define MODULE_NAME "LBA" | 101 | #define MODULE_NAME "LBA" |
| 102 | 102 | ||
| 103 | #define LBA_FUNC_ID 0x0000 /* function id */ | ||
| 104 | #define LBA_FCLASS 0x0008 /* function class, bist, header, rev... */ | ||
| 105 | #define LBA_CAPABLE 0x0030 /* capabilities register */ | ||
| 106 | |||
| 107 | #define LBA_PCI_CFG_ADDR 0x0040 /* poke CFG address here */ | ||
| 108 | #define LBA_PCI_CFG_DATA 0x0048 /* read or write data here */ | ||
| 109 | |||
| 110 | #define LBA_PMC_MTLT 0x0050 /* Firmware sets this - read only. */ | ||
| 111 | #define LBA_FW_SCRATCH 0x0058 /* Firmware writes the PCI bus number here. */ | ||
| 112 | #define LBA_ERROR_ADDR 0x0070 /* On error, address gets logged here */ | ||
| 113 | |||
| 114 | #define LBA_ARB_MASK 0x0080 /* bit 0 enable arbitration. PAT/PDC enables */ | ||
| 115 | #define LBA_ARB_PRI 0x0088 /* firmware sets this. */ | ||
| 116 | #define LBA_ARB_MODE 0x0090 /* firmware sets this. */ | ||
| 117 | #define LBA_ARB_MTLT 0x0098 /* firmware sets this. */ | ||
| 118 | |||
| 119 | #define LBA_MOD_ID 0x0100 /* Module ID. PDC_PAT_CELL reports 4 */ | ||
| 120 | |||
| 121 | #define LBA_STAT_CTL 0x0108 /* Status & Control */ | ||
| 122 | #define LBA_BUS_RESET 0x01 /* Deassert PCI Bus Reset Signal */ | ||
| 123 | #define CLEAR_ERRLOG 0x10 /* "Clear Error Log" cmd */ | ||
| 124 | #define CLEAR_ERRLOG_ENABLE 0x20 /* "Clear Error Log" Enable */ | ||
| 125 | #define HF_ENABLE 0x40 /* enable HF mode (default is -1 mode) */ | ||
| 126 | |||
| 127 | #define LBA_LMMIO_BASE 0x0200 /* < 4GB I/O address range */ | ||
| 128 | #define LBA_LMMIO_MASK 0x0208 | ||
| 129 | |||
| 130 | #define LBA_GMMIO_BASE 0x0210 /* > 4GB I/O address range */ | ||
| 131 | #define LBA_GMMIO_MASK 0x0218 | ||
| 132 | |||
| 133 | #define LBA_WLMMIO_BASE 0x0220 /* All < 4GB ranges under the same *SBA* */ | ||
| 134 | #define LBA_WLMMIO_MASK 0x0228 | ||
| 135 | |||
| 136 | #define LBA_WGMMIO_BASE 0x0230 /* All > 4GB ranges under the same *SBA* */ | ||
| 137 | #define LBA_WGMMIO_MASK 0x0238 | ||
| 138 | |||
| 139 | #define LBA_IOS_BASE 0x0240 /* I/O port space for this LBA */ | ||
| 140 | #define LBA_IOS_MASK 0x0248 | ||
| 141 | |||
| 142 | #define LBA_ELMMIO_BASE 0x0250 /* Extra LMMIO range */ | ||
| 143 | #define LBA_ELMMIO_MASK 0x0258 | ||
| 144 | |||
| 145 | #define LBA_EIOS_BASE 0x0260 /* Extra I/O port space */ | ||
| 146 | #define LBA_EIOS_MASK 0x0268 | ||
| 147 | |||
| 148 | #define LBA_GLOBAL_MASK 0x0270 /* Mercury only: Global Address Mask */ | ||
| 149 | #define LBA_DMA_CTL 0x0278 /* firmware sets this */ | ||
| 150 | |||
| 151 | #define LBA_IBASE 0x0300 /* SBA DMA support */ | ||
| 152 | #define LBA_IMASK 0x0308 | ||
| 153 | |||
| 154 | /* FIXME: ignore DMA Hint stuff until we can measure performance */ | ||
| 155 | #define LBA_HINT_CFG 0x0310 | ||
| 156 | #define LBA_HINT_BASE 0x0380 /* 14 registers at every 8 bytes. */ | ||
| 157 | |||
| 158 | #define LBA_BUS_MODE 0x0620 | ||
| 159 | |||
| 160 | /* ERROR regs are needed for config cycle kluges */ | ||
| 161 | #define LBA_ERROR_CONFIG 0x0680 | ||
| 162 | #define LBA_SMART_MODE 0x20 | ||
| 163 | #define LBA_ERROR_STATUS 0x0688 | ||
| 164 | #define LBA_ROPE_CTL 0x06A0 | ||
| 165 | |||
| 166 | #define LBA_IOSAPIC_BASE 0x800 /* Offset of IRQ logic */ | ||
| 167 | |||
| 168 | /* non-postable I/O port space, densely packed */ | 103 | /* non-postable I/O port space, densely packed */ |
| 169 | #define LBA_PORT_BASE (PCI_F_EXTEND | 0xfee00000UL) | 104 | #define LBA_PORT_BASE (PCI_F_EXTEND | 0xfee00000UL) |
| 170 | static void __iomem *astro_iop_base __read_mostly; | 105 | static void __iomem *astro_iop_base __read_mostly; |
| 171 | 106 | ||
| 172 | #define ELROY_HVERS 0x782 | ||
| 173 | #define MERCURY_HVERS 0x783 | ||
| 174 | #define QUICKSILVER_HVERS 0x784 | ||
| 175 | |||
| 176 | static inline int IS_ELROY(struct parisc_device *d) | ||
| 177 | { | ||
| 178 | return (d->id.hversion == ELROY_HVERS); | ||
| 179 | } | ||
| 180 | |||
| 181 | static inline int IS_MERCURY(struct parisc_device *d) | ||
| 182 | { | ||
| 183 | return (d->id.hversion == MERCURY_HVERS); | ||
| 184 | } | ||
| 185 | |||
| 186 | static inline int IS_QUICKSILVER(struct parisc_device *d) | ||
| 187 | { | ||
| 188 | return (d->id.hversion == QUICKSILVER_HVERS); | ||
| 189 | } | ||
| 190 | |||
| 191 | |||
| 192 | /* | ||
| 193 | ** lba_device: Per instance Elroy data structure | ||
| 194 | */ | ||
| 195 | struct lba_device { | ||
| 196 | struct pci_hba_data hba; | ||
| 197 | |||
| 198 | spinlock_t lba_lock; | ||
| 199 | void *iosapic_obj; | ||
| 200 | |||
| 201 | #ifdef CONFIG_64BIT | ||
| 202 | void __iomem * iop_base; /* PA_VIEW - for IO port accessor funcs */ | ||
| 203 | #endif | ||
| 204 | |||
| 205 | int flags; /* state/functionality enabled */ | ||
| 206 | int hw_rev; /* HW revision of chip */ | ||
| 207 | }; | ||
| 208 | |||
| 209 | |||
| 210 | static u32 lba_t32; | 107 | static u32 lba_t32; |
| 211 | 108 | ||
| 212 | /* lba flags */ | 109 | /* lba flags */ |
| @@ -1542,8 +1439,8 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1542 | default: version = "TR4+"; | 1439 | default: version = "TR4+"; |
| 1543 | } | 1440 | } |
| 1544 | 1441 | ||
| 1545 | printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n", | 1442 | printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n", |
| 1546 | MODULE_NAME, version, func_class & 0xf, dev->hpa.start); | 1443 | version, func_class & 0xf, dev->hpa.start); |
| 1547 | 1444 | ||
| 1548 | if (func_class < 2) { | 1445 | if (func_class < 2) { |
| 1549 | printk(KERN_WARNING "Can't support LBA older than " | 1446 | printk(KERN_WARNING "Can't support LBA older than " |
| @@ -1563,14 +1460,18 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1563 | } | 1460 | } |
| 1564 | 1461 | ||
| 1565 | } else if (IS_MERCURY(dev) || IS_QUICKSILVER(dev)) { | 1462 | } else if (IS_MERCURY(dev) || IS_QUICKSILVER(dev)) { |
| 1463 | int major, minor; | ||
| 1464 | |||
| 1566 | func_class &= 0xff; | 1465 | func_class &= 0xff; |
| 1567 | version = kmalloc(6, GFP_KERNEL); | 1466 | major = func_class >> 4, minor = func_class & 0xf; |
| 1568 | snprintf(version, 6, "TR%d.%d",(func_class >> 4),(func_class & 0xf)); | 1467 | |
| 1569 | /* We could use one printk for both Elroy and Mercury, | 1468 | /* We could use one printk for both Elroy and Mercury, |
| 1570 | * but for the mask for func_class. | 1469 | * but for the mask for func_class. |
| 1571 | */ | 1470 | */ |
| 1572 | printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n", | 1471 | printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n", |
| 1573 | MODULE_NAME, version, func_class & 0xff, dev->hpa.start); | 1472 | IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major, |
| 1473 | minor, func_class, dev->hpa.start); | ||
| 1474 | |||
| 1574 | cfg_ops = &mercury_cfg_ops; | 1475 | cfg_ops = &mercury_cfg_ops; |
| 1575 | } else { | 1476 | } else { |
| 1576 | printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start); | 1477 | printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start); |
| @@ -1600,6 +1501,7 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1600 | lba_dev->hba.dev = dev; | 1501 | lba_dev->hba.dev = dev; |
| 1601 | lba_dev->iosapic_obj = tmp_obj; /* save interrupt handle */ | 1502 | lba_dev->iosapic_obj = tmp_obj; /* save interrupt handle */ |
| 1602 | lba_dev->hba.iommu = sba_get_iommu(dev); /* get iommu data */ | 1503 | lba_dev->hba.iommu = sba_get_iommu(dev); /* get iommu data */ |
| 1504 | parisc_set_drvdata(dev, lba_dev); | ||
| 1603 | 1505 | ||
| 1604 | /* ------------ Second : initialize common stuff ---------- */ | 1506 | /* ------------ Second : initialize common stuff ---------- */ |
| 1605 | pci_bios = &lba_bios_ops; | 1507 | pci_bios = &lba_bios_ops; |
