summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hp300/dev/sti_sgc.c28
-rw-r--r--sys/arch/hp300/hp300/wscons_machdep.c3
-rw-r--r--sys/arch/hppa/dev/sti_sgc.c13
-rw-r--r--sys/dev/ic/sti.c23
-rw-r--r--sys/dev/ic/stivar.h9
5 files changed, 47 insertions, 29 deletions
diff --git a/sys/arch/hp300/dev/sti_sgc.c b/sys/arch/hp300/dev/sti_sgc.c
index 56f86728dac..33c6d70b840 100644
--- a/sys/arch/hp300/dev/sti_sgc.c
+++ b/sys/arch/hp300/dev/sti_sgc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti_sgc.c,v 1.9 2006/08/22 21:04:31 miod Exp $ */
+/* $OpenBSD: sti_sgc.c,v 1.10 2006/12/18 18:57:24 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -54,6 +54,10 @@ struct cfattach sti_sgc_ca = {
sizeof(struct sti_softc), sti_sgc_match, sti_sgc_attach
};
+/* Console data */
+struct sti_screen stifb_cn;
+bus_addr_t stifb_cn_bases[STI_REGION_MAX];
+
int
sti_sgc_match(struct device *parent, void *match, void *aux)
{
@@ -77,26 +81,27 @@ sti_sgc_attach(struct device *parent, struct device *self, void *aux)
{
struct sti_softc *sc = (void *)self;
struct sgc_attach_args *saa = aux;
+ bus_addr_t base;
bus_space_tag_t iot;
bus_space_handle_t ioh;
u_int romend;
+ int i;
/*
* If we already probed it succesfully as a console device, go ahead,
* since we will not be able to bus_space_map() again.
*/
if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode) {
- extern struct sti_screen stifb_cn;
-
sc->sc_flags |= STI_CONSOLE | STI_ATTACHED;
sc->sc_scr = &stifb_cn;
+ bcopy(stifb_cn_bases, sc->bases, sizeof(sc->bases));
sti_describe(sc);
} else {
iot = HP300_BUS_TAG(HP300_BUS_SGC, saa->saa_slot);
- sc->base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
+ base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
- if (bus_space_map(iot, sc->base, PAGE_SIZE, 0, &ioh)) {
+ if (bus_space_map(iot, base, PAGE_SIZE, 0, &ioh)) {
printf(": can't map frame buffer");
return;
}
@@ -108,13 +113,16 @@ sti_sgc_attach(struct device *parent, struct device *self, void *aux)
bus_space_unmap(iot, ioh, PAGE_SIZE);
- if (bus_space_map(iot, sc->base, romend, 0, &ioh)) {
+ if (bus_space_map(iot, base, romend, 0, &ioh)) {
printf(": can't map frame buffer");
return;
}
sc->memt = sc->iot = iot;
sc->romh = ioh;
+ sc->bases[0] = sc->romh;
+ for (i = 1; i < STI_REGION_MAX; i++)
+ sc->bases[i] = base;
sti_attach_common(sc, STI_CODEBASE_M68K);
}
@@ -168,9 +176,9 @@ sti_console_scan(int slot)
void
sticninit()
{
- extern struct sti_screen stifb_cn;
bus_space_tag_t iot;
bus_addr_t base;
+ int i;
/*
* We are not interested by the *first* console pass.
@@ -181,7 +189,11 @@ sticninit()
iot = HP300_BUS_TAG(HP300_BUS_SGC, CONSCODE_TO_SGC_SLOT(conscode));
base = (bus_addr_t)sgc_slottopa(CONSCODE_TO_SGC_SLOT(conscode));
- sti_cnattach(&stifb_cn, iot, base, STI_CODEBASE_M68K);
+ /* stifb_cn_bases[0] will be fixed in sti_cnattach() */
+ for (i = 0; i < STI_REGION_MAX; i++)
+ stifb_cn_bases[i] = base;
+
+ sti_cnattach(&stifb_cn, iot, stifb_cn_bases, STI_CODEBASE_M68K);
sti_clear(&stifb_cn);
/*
diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c
index ea700592f65..8a97876dde8 100644
--- a/sys/arch/hp300/hp300/wscons_machdep.c
+++ b/sys/arch/hp300/hp300/wscons_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wscons_machdep.c,v 1.7 2006/04/14 21:05:44 miod Exp $ */
+/* $OpenBSD: wscons_machdep.c,v 1.8 2006/12/18 18:57:26 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -97,7 +97,6 @@ struct diofb diofb_cn;
#include <dev/ic/stivar.h>
extern int sti_console_scan(int);
extern void sticninit(void);
-struct sti_screen stifb_cn;
#endif
extern caddr_t internalhpib;
diff --git a/sys/arch/hppa/dev/sti_sgc.c b/sys/arch/hppa/dev/sti_sgc.c
index ed70920aa16..4729b8e9e1f 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.33 2006/11/30 11:25:11 mickey Exp $ */
+/* $OpenBSD: sti_sgc.c,v 1.34 2006/12/18 18:57:26 miod Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -63,8 +63,9 @@ char sti_sgc_opt[] = { 0x17, 0x20, 0x30, 0x40, 0x70, 0xc0, 0xd0 };
extern struct cfdriver sti_cd;
-int sti_sgc_probe(struct device *, void *, void *);
-void sti_sgc_attach(struct device *, struct device *, void *);
+int sti_sgc_probe(struct device *, void *, void *);
+void sti_sgc_attach(struct device *, struct device *, void *);
+paddr_t sti_sgc_getrom(int, struct confargs *);
struct cfattach sti_gedoens_ca = {
sizeof(struct sti_softc), sti_sgc_probe, sti_sgc_attach
@@ -201,9 +202,9 @@ sti_sgc_attach(parent, self, aux)
paddr_t rom;
u_int32_t romlen;
int rv;
+ int i;
sc->memt = sc->iot = ca->ca_iot;
- sc->base = ca->ca_hpa;
/* we stashed rom addr/len into the last slot during probe */
rom = ca->ca_addrs[ca->ca_naddrs - 1].addr;
@@ -217,6 +218,10 @@ sti_sgc_attach(parent, self, aux)
}
}
+ sc->bases[0] = sc->romh;
+ for (i = 1; i < STI_REGION_MAX; i++)
+ sc->bases[i] = ca->ca_hpa;
+
#ifdef HP7300LC_CPU
/* PCXL2: enable accel i/o for this space */
if (cpu_type == hpcxl2)
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
index 1afdcd29872..5f462c44794 100644
--- a/sys/dev/ic/sti.c
+++ b/sys/dev/ic/sti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti.c,v 1.48 2006/12/16 15:52:30 miod Exp $ */
+/* $OpenBSD: sti.c,v 1.49 2006/12/18 18:57:26 miod Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -121,7 +121,7 @@ int sti_setcment(struct sti_screen *scr, u_int i, u_char r, u_char g, u_char b);
int sti_fetchfonts(struct sti_screen *scr, struct sti_inqconfout *cfg,
u_int32_t addr);
void sti_screen_setup(struct sti_screen *scr, bus_space_tag_t iot,
- bus_space_tag_t memt, bus_space_handle_t romh, bus_addr_t base,
+ bus_space_tag_t memt, bus_space_handle_t romh, bus_addr_t *bases,
u_int codebase);
void
@@ -140,14 +140,14 @@ sti_attach_common(sc, codebase)
bzero(scr, sizeof(struct sti_screen));
sc->sc_scr = scr;
- sti_screen_setup(scr, sc->iot, sc->memt, sc->romh, sc->base,
+ sti_screen_setup(scr, sc->iot, sc->memt, sc->romh, sc->bases,
codebase);
sti_describe(sc);
}
void
sti_screen_setup(struct sti_screen *scr, bus_space_tag_t iot,
- bus_space_tag_t memt, bus_space_handle_t romh, bus_addr_t base,
+ bus_space_tag_t memt, bus_space_handle_t romh, bus_addr_t *bases,
u_int codebase)
{
struct sti_inqconfout cfg;
@@ -161,6 +161,7 @@ sti_screen_setup(struct sti_screen *scr, bus_space_tag_t iot,
scr->iot = iot;
scr->memt = memt;
scr->romh = romh;
+ scr->bases = bases;
scr->scr_devtype = bus_space_read_1(memt, romh, 3);
/* { extern int pmapdebug; pmapdebug = 0xfffff; } */
@@ -335,10 +336,9 @@ sti_screen_setup(struct sti_screen *scr, bus_space_tag_t iot,
else
*(u_int *)&r = bus_space_read_4(memt, romh, i), i += 4;
- *p = (p == cc->regions? romh : base) +
- (r.offset << PGSHIFT);
+ *p = bases[p - cc->regions] + (r.offset << PGSHIFT);
#ifdef STIDEBUG
- printf("%x @ 0x%x%s%s%s%s\n",
+ printf("%08x @ 0x%08x%s%s%s%s\n",
r.length << PGSHIFT, *p, r.sys_only? " sys" : "",
r.cache? " cache" : "", r.btlb? " btlb" : "",
r.last? " last" : "");
@@ -1105,7 +1105,7 @@ sti_clear(struct sti_screen *scr)
}
int
-sti_cnattach(struct sti_screen *scr, bus_space_tag_t iot, bus_addr_t base,
+sti_cnattach(struct sti_screen *scr, bus_space_tag_t iot, bus_addr_t *bases,
u_int codebase)
{
bus_space_handle_t ioh;
@@ -1113,7 +1113,7 @@ sti_cnattach(struct sti_screen *scr, bus_space_tag_t iot, bus_addr_t base,
int error;
long defattr;
- if ((error = bus_space_map(iot, base, PAGE_SIZE, 0, &ioh)) != 0)
+ if ((error = bus_space_map(iot, bases[0], PAGE_SIZE, 0, &ioh)) != 0)
return (error);
/*
@@ -1123,10 +1123,11 @@ sti_cnattach(struct sti_screen *scr, bus_space_tag_t iot, bus_addr_t base,
bus_space_unmap(iot, ioh, PAGE_SIZE);
- if ((error = bus_space_map(iot, base, romend, 0, &ioh)) != 0)
+ if ((error = bus_space_map(iot, bases[0], romend, 0, &ioh)) != 0)
return (error);
- sti_screen_setup(scr, iot, iot, ioh, base, codebase);
+ bases[0] = ioh;
+ sti_screen_setup(scr, iot, iot, ioh, bases, codebase);
sti_alloc_attr(scr, 0, 0, 0, &defattr);
wsdisplay_cnattach(&sti_default_screen, scr, 0, 0, defattr);
diff --git a/sys/dev/ic/stivar.h b/sys/dev/ic/stivar.h
index 6f246d50af5..3b4e1d5ed52 100644
--- a/sys/dev/ic/stivar.h
+++ b/sys/dev/ic/stivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stivar.h,v 1.19 2006/08/22 21:04:32 miod Exp $ */
+/* $OpenBSD: stivar.h,v 1.20 2006/12/18 18:57:26 miod Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -34,7 +34,8 @@ struct sti_screen {
bus_space_tag_t iot, memt;
bus_space_handle_t romh;
- bus_addr_t base, fbaddr;
+ bus_addr_t *bases;
+ bus_addr_t fbaddr;
bus_size_t fblen;
int scr_bpp;
@@ -84,7 +85,7 @@ struct sti_softc {
bus_space_tag_t iot, memt;
bus_space_handle_t romh;
- bus_addr_t base;
+ bus_addr_t bases[STI_REGION_MAX];
struct sti_screen *sc_scr;
u_int sc_wsmode;
@@ -92,7 +93,7 @@ struct sti_softc {
void sti_attach_common(struct sti_softc *sc, u_int codebase);
void sti_clear(struct sti_screen *);
-int sti_cnattach(struct sti_screen *, bus_space_tag_t, bus_addr_t, u_int);
+int sti_cnattach(struct sti_screen *, bus_space_tag_t, bus_addr_t *, u_int);
void sti_describe(struct sti_softc *);
void sti_end_attach(void *);
u_int sti_rom_size(bus_space_tag_t, bus_space_handle_t);