summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/dev
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-05-20 20:54:44 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-05-20 20:54:44 +0000
commit00734d97f7edd6f8695cf8bd1ef96d4b8f43dc43 (patch)
tree81ef84d294d22534f4fcbda8e1c6624302421cb8 /sys/arch/hppa/dev
parentce043b44ad3927f4f567025663cf06dc3b3d2e23 (diff)
create a devine routine for devising the holy rom address and use it in both match and attach then
Diffstat (limited to 'sys/arch/hppa/dev')
-rw-r--r--sys/arch/hppa/dev/sti_sgc.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/sys/arch/hppa/dev/sti_sgc.c b/sys/arch/hppa/dev/sti_sgc.c
index 3cb738a0be4..dd07803d136 100644
--- a/sys/arch/hppa/dev/sti_sgc.c
+++ b/sys/arch/hppa/dev/sti_sgc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti_sgc.c,v 1.12 2003/05/19 09:32:16 mickey Exp $ */
+/* $OpenBSD: sti_sgc.c,v 1.13 2003/05/20 20:54:43 mickey Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -73,6 +73,26 @@ struct cfattach sti_phantom_ca = {
sizeof(struct sti_softc), sti_sgc_probe, sti_sgc_attach
};
+/*
+ * Locate STI ROM.
+ * On some machines it may not be part of the HPA space.
+ */
+paddr_t
+sti_sgc_getrom(struct confargs *ca)
+{
+ paddr_t rom;
+
+ if (PAGE0->pd_resv2[1] < HPPA_IOBEGIN)
+ if (ca->ca_type.iodc_revision == STI_INEG_REV)
+ rom = STI_INEG_PROM;
+ else
+ rom = ca->ca_hpa;
+ else
+ rom = PAGE0->pd_resv2[1];
+
+ return (rom);
+}
+
int
sti_sgc_probe(parent, match, aux)
struct device *parent;
@@ -80,7 +100,8 @@ sti_sgc_probe(parent, match, aux)
{
struct confargs *ca = aux;
bus_space_handle_t ioh, romh;
- u_int32_t id, rom;
+ paddr_t rom;
+ u_int32_t id;
u_char devtype;
int rv = 0, romunmapped = 0;
@@ -102,25 +123,16 @@ sti_sgc_probe(parent, match, aux)
return 0;
}
- /*
- * Locate STI ROM.
- * On some machines it may not be part of the HPA space.
- */
- if (PAGE0->pd_resv2[1] < HPPA_IOBEGIN) {
- if (ca->ca_type.iodc_revision == STI_INEG_REV)
- rom = STI_INEG_PROM;
- else {
- rom = ca->ca_hpa;
- romh = ioh;
- romunmapped++;
- }
- } else
- rom = PAGE0->pd_resv2[1];
-
+ rom = sti_sgc_getrom(ca);
#ifdef STIDEBUG
printf ("sti: hpa=%x, rom=%x\n", ca->ca_hpa, rom);
#endif
+ if (rom == ca->ca_hpa) {
+ romh = ioh;
+ romunmapped++;
+ }
+
/* if it does not map, probably part of the lasi space */
if (rom != ca->ca_hpa &&
(rv = bus_space_map(ca->ca_iot, rom, IOMOD_HPASIZE, 0, &romh))) {
@@ -185,16 +197,10 @@ sti_sgc_attach(parent, self, aux)
{
struct sti_softc *sc = (void *)self;
struct confargs *ca = aux;
- bus_addr_t addr;
+ paddr_t addr;
int rv;
- if (PAGE0->pd_resv2[1] < HPPA_IOBEGIN)
- if (ca->ca_type.iodc_revision == STI_INEG_REV)
- addr = STI_INEG_PROM;
- else
- addr = ca->ca_hpa;
- else
- addr = PAGE0->pd_resv2[1];
+ addr = sti_sgc_getrom(ca);
#ifdef STIDEBUG
printf("sti: hpa=%x, rom=%x\n", ca->ca_hpa, addr);