[parisc-linux-cvs] Cujo fixes
Matthew Wilcox
willy@ldl.fc.hp.com
Wed, 29 Aug 2001 19:32:53 -0600
* Report Cujo as Cujo instead of Dino.
* Remove an unused include.
* Simplify the is_card_dino test
* Remove some unused defines
* Report the version number a little more elegantly
* Remove an unnecessary cast
* Add the future call to ccio to fix the cujo bug -- #ifdef out until we
have an iotree and can tell which ioc is cujo's parent.
Index: drivers/gsc/dino.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/dino.c,v
retrieving revision 1.36
diff -u -p -r1.36 dino.c
--- dino.c 2001/08/28 07:00:59 1.36
+++ dino.c 2001/08/30 01:22:32
@@ -55,7 +55,6 @@
#include <asm/pdc.h>
#include <asm/page.h>
-#include <asm/segment.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/hardware.h>
@@ -89,7 +88,7 @@
// REVISIT: 715 reports card-mode Dino IODC data wrong.
// May need to read it "by hand".
-#define is_card_dino(id) ((id)->sversion == 0x9d || (id)->sversion == 0x8080)
+#define is_card_dino(id) ((id)->hw_type == HPHW_A_DMA)
#define DINO_IAR0 0x004
#define DINO_IODC_ADDR 0x008
@@ -128,16 +127,6 @@
#define DINO_PCIWOR 0x828
#define DINO_TLTIM 0x830
-#define DINO_VERSION_20 0x0
-#define DINO_VERSION_21 0x1
-#define DINO_VERSION_30 0x2
-#define DINO_VERSION_31 0x3
-#define DINO_VERSION_UNKNOWN 0xf
-
-#define DINO_MODE_CARD 0
-#define DINO_MODE_BRIDGE 1
-#define DINO_MODE_UNKNOWN 2
-
#define DINO_IRQS 11 /* bits 0-10 are architected */
#define DINO_IRR_MASK 0x5ff /* only 10 bits are implemented */
@@ -377,7 +366,7 @@ dino_enable_irq(void *irq_dev, int irq)
** This does NOT change ILR state!
** See comments in dino_unmask_irq() for ILR usage.
*/
- (volatile void) gsc_readl(dino_dev->hba.base_addr+DINO_IPR);
+ gsc_readl(dino_dev->hba.base_addr+DINO_IPR);
dino_unmask_irq(irq_dev, irq);
}
@@ -858,7 +847,17 @@ dino_common_init(struct parisc_device *d
return(0);
}
+static const char *dino_vers[] = {
+ "2.0",
+ "2.1",
+ "3.0",
+ "3.1"
+};
+static const char *cujo_vers[] = {
+ "1.0",
+ "2.0"
+};
/*
** Determine if dino should claim this chip (return 0) or not (return 1).
@@ -869,21 +868,27 @@ static int __init
dino_driver_callback(struct parisc_device *dev)
{
struct dino_device *dino_dev; // Dino specific control struct
- char *version;
+ const char *version = "unknown";
+ const char *name = "Dino";
+ int is_cujo = 0;
- if (dev->id.hw_type == HPHW_A_DMA) {
+ if (is_card_dino(&dev->id)) {
version = "3.x (card mode)";
} else {
- switch (dev->id.hversion_rev) {
- case 0: version = "2.0"; break;
- case 1: version = "2.1"; break;
- case 2: version = "3.0"; break;
- case 3: version = "3.1"; break;
- default: version = "unknown"; return 1;
+ if(dev->id.hversion == 0x680) {
+ if (dev->id.hversion_rev < 4) {
+ version = dino_vers[dev->id.hversion_rev];
+ }
+ } else {
+ name = "Cujo";
+ is_cujo = 1;
+ if (dev->id.hversion_rev < 2) {
+ version = cujo_vers[dev->id.hversion_rev];
+ }
}
}
- printk("Dino version %s found at 0x%lx\n", version, dev->hpa);
+ printk("%s version %s found at 0x%lx\n", name, version, dev->hpa);
if (!request_mem_region(dev->hpa, PAGE_SIZE, "Dino HPA")) {
printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%ld)!\n",
@@ -891,20 +896,28 @@ dino_driver_callback(struct parisc_devic
return 1;
}
- /*
- ** Card-mode dino don't have the same problem as built-in.
- ** The data corruption problem in their case was fixed
- ** by changing the PAL.
- */
- if (!is_card_dino(&dev->id) && (dev->id.hversion_rev < 3)) {
+ /* Check for bugs */
+ if (is_cujo && dev->id.hversion_rev == 1) {
+#if 0
+ printk(KERN_WARNING "Enabling Cujo 2.0 bug workaround\n");
+ if (dev->hpa == CUJO_RAVEN_ADDR) {
+ ccio_cujo20_hack(dev->parent, CUJO_RAVEN_BADPAGE);
+ } else if (dev->hpa == CUJO_FIREHAWK_ADDR) {
+ ccio_cujo20_hack(dev->parent, CUJO_FIREHAWK_BADPAGE);
+ } else {
+ printk("Don't recognise Cujo at address 0x%lx, not enabling workaround\n", dev->hpa);
+ }
+#endif
+ } else if (!is_cujo && !is_card_dino(&dev->id) &&
+ dev->id.hversion_rev < 3) {
printk(KERN_WARNING
-"\n\nThe GSCtoPCI (Dino hrev %d) bus converter found may exhibit\n"
+"The GSCtoPCI (Dino hrev %d) bus converter found may exhibit\n"
"data corruption. See Service Note Numbers: A4190A-01, A4191A-01.\n"
"Systems shipped after Aug 20, 1997 will not exhibit this problem.\n"
"Models affected: C180, C160, C160L, B160L, and B132L workstations.\n\n",
dev->id.hversion_rev);
/* REVISIT: why are C200/C240 listed in the README table but not
-** "Models affected"? Could be an ommission in the original literature.
+** "Models affected"? Could be an omission in the original literature.
*/
}
@@ -946,8 +959,8 @@ dino_driver_callback(struct parisc_devic
*/
static struct parisc_device_id dino_tbl[] = {
- { HPHW_A_DMA, 0, 0x004, 0x0009D }, /* A180 card-mode Dino. Ver 3.x */
- { HPHW_A_DMA, 0, 0x444, 0x08080 }, /* Same card in a 715. Bug? */
+ { HPHW_A_DMA, HVERSION_REV_ANY_ID, 0x004, 0x0009D }, /* Card-mode Dino. */
+ { HPHW_A_DMA, HVERSION_REV_ANY_ID, 0x444, 0x08080 }, /* Same card in a 715. Bug? */
{ HPHW_BRIDGE, HVERSION_REV_ANY_ID, 0x680, 0xa }, /* Bridge-mode Dino */
{ HPHW_BRIDGE, HVERSION_REV_ANY_ID, 0x682, 0xa }, /* Bridge-mode Cujo */
{ HPHW_BRIDGE, 0x03, 0x05d, 0xa }, /* Dino in a J2240 */