summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hppa/dev/sti_sgc.c76
1 files changed, 52 insertions, 24 deletions
diff --git a/sys/arch/hppa/dev/sti_sgc.c b/sys/arch/hppa/dev/sti_sgc.c
index 08ae51f64ab..cf70711f187 100644
--- a/sys/arch/hppa/dev/sti_sgc.c
+++ b/sys/arch/hppa/dev/sti_sgc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: sti_sgc.c,v 1.9 2002/03/14 01:26:31 millert Exp $ */
+/* $OpenBSD: sti_sgc.c,v 1.10 2003/03/29 00:56:08 mickey Exp $ */
/*
- * Copyright (c) 2000 Michael Shalayeff
+ * Copyright (c) 2000-2003 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,28 +56,40 @@
#include <hppa/dev/cpudevs.h>
#define STI_MEMSIZE 0x1000000
+#define STI_ROMSIZE 0x30000
+#define STI_ID_FDDI 0x280b31af /* Medusa FDDI ROM id */
-int sti_sgc_probe(struct device *, void *, void *);
+int sti_sgc_probe(struct device *, void *, void *);
void sti_sgc_attach(struct device *, struct device *, void *);
struct cfattach sti_sgc_ca = {
sizeof(struct sti_softc), sti_sgc_probe, sti_sgc_attach
};
+struct cfattach sti_phantom_ca = {
+ sizeof(struct sti_softc), sti_sgc_probe, sti_sgc_attach
+};
+
int
sti_sgc_probe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- register struct confargs *ca = aux;
+ struct confargs *ca = aux;
bus_space_handle_t ioh, romh;
- u_int rom;
+ u_int32_t id, rom;
u_char devtype;
int rv = 0, romunmapped = 0;
- if (ca->ca_type.iodc_type != HPPA_TYPE_FIO ||
- (ca->ca_type.iodc_sv_model != HPPA_FIO_GSGC &&
- ca->ca_type.iodc_sv_model != HPPA_FIO_SGC))
+ if (ca->ca_type.iodc_type != HPPA_TYPE_FIO)
+ return (0);
+
+ /* these can only be graphics anyway */
+ if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC)
+ return (1);
+
+ /* these need futher checking for the graphics id */
+ if (ca->ca_type.iodc_sv_model != HPPA_FIO_SGC)
return 0;
if ((rv = bus_space_map(ca->ca_iot, ca->ca_hpa, STI_MEMSIZE, 0, &ioh))) {
@@ -127,21 +139,36 @@ sti_sgc_probe(parent, match, aux)
#ifdef STIDEBUG
printf("sti: devtype=%d\n", devtype);
#endif
-#if 0 /* ignore this for now */
- if ((ca->ca_type.iodc_sv_model == HPPA_FIO_SGC &&
- STI_ID_HI(STI_TYPE_BWGRF, rioh) == STI_ID_FDDI) ||
- (devtype != STI_TYPE_BWGRF && devtype != STI_TYPE_WWGRF)) {
+ rv = 1;
+ switch (devtype) {
+ case STI_DEVTYPE4:
+ id = bus_space_read_4(ca->ca_iot, romh, 0x8);
+ break;
+ case STI_DEVTYPE1:
+ id = (bus_space_read_1(ca->ca_iot, romh, 0x10 + 3) << 24) |
+ (bus_space_read_1(ca->ca_iot, romh, 0x10 + 7) << 16) |
+ (bus_space_read_1(ca->ca_iot, romh, 0x10 + 11) << 8) |
+ (bus_space_read_1(ca->ca_iot, romh, 0x10 + 15));
+
+ break;
+ default:
#ifdef STIDEBUG
- printf("sti: not a graphics device (%x)\n", devtype);
+ printf("sti: unknown type (%x)\n", devtype);
#endif
- } else
+ rv = 0;
+ }
+
+ if (ca->ca_type.iodc_sv_model == HPPA_FIO_SGC && id == STI_ID_FDDI) {
+#ifdef STIDEBUG
+ printf("sti: not a graphics device\n");
#endif
- rv = 1;
+ rv = 0;
+ }
bus_space_unmap(ca->ca_iot, ioh, STI_MEMSIZE);
if (!romunmapped)
bus_space_unmap(ca->ca_iot, romh, IOMOD_HPASIZE);
- return rv;
+ return (rv);
}
void
@@ -159,12 +186,15 @@ sti_sgc_attach(parent, self, aux)
else
addr = PAGE0->pd_resv2[1];
+#ifdef STIDEBUG
+ printf("sti: hpa=%x, rom=%x\n", ca->ca_hpa, addr);
+#endif
sc->memt = sc->iot = ca->ca_iot;
if ((rv = bus_space_map(ca->ca_iot, ca->ca_hpa, STI_MEMSIZE, 0,
&sc->ioh))) {
#ifdef STIDEBUG
- printf("st: cannot map io space (%d)\n", rv);
+ printf(": cannot map io space (%d)\n", rv);
#endif
return;
}
@@ -172,26 +202,24 @@ sti_sgc_attach(parent, self, aux)
/* if it does not map, probably part of the lasi space */
if (addr == ca->ca_hpa)
sc->romh = sc->ioh;
- else if ((rv = bus_space_map(ca->ca_iot, addr, IOMOD_HPASIZE, 0, &sc->romh))) {
-#ifdef STIDEBUG
- printf ("sti: cannot map rom space (%d)\n", rv);
-#endif
+ else if ((rv = bus_space_map(ca->ca_iot, addr, STI_ROMSIZE, 0, &sc->romh))) {
if ((addr & HPPA_IOBEGIN) == HPPA_IOBEGIN)
sc->romh = addr;
else {
+#ifdef STIDEBUG
+ printf (": cannot map rom space (%d)\n", rv);
+#endif
/* in this case i have no freaking idea */
bus_space_unmap(ca->ca_iot, sc->ioh, STI_MEMSIZE);
return;
}
}
- sc->sc_devtype = bus_space_read_1(sc->iot, sc->romh, 3);
#ifdef STIDEBUG
- printf("sti: hpa=%x, rom=%x\n", ca->ca_hpa, addr);
printf("sti: ioh=%x, romh=%x\n", sc->ioh, sc->romh);
#endif
+ sc->sc_devtype = bus_space_read_1(sc->iot, sc->romh, 3);
if (ca->ca_hpa == (hppa_hpa_t)PAGE0->mem_cons.pz_hpa)
sc->sc_flags |= STI_CONSOLE;
sti_attach_common(sc);
}
-