Created
December 20, 2020 06:48
-
-
Save tsutsui/011662baf7689e565ed1c95b26a3a77e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /s/cvs/src/sys/arch/hp300/dev/sti_sgc.c 2020-12-19 10:35:47.860896348 +0900 | |
+++ /s/netbsd-9/src/sys/arch/hp300/dev/sti_sgc.c 2020-12-20 13:42:55.710995744 +0900 | |
@@ -49,31 +49,32 @@ | |
struct sti_softc sc_sti; | |
paddr_t sc_bitmap; | |
- bus_space_tag_t sc_bst; | |
- bus_space_handle_t sc_ramdach; | |
}; | |
/* | |
* 425e EVRX specific hardware | |
*/ | |
-#define STI_EVRX_RAMDACOFFSET 0x060000 | |
-#define STI_EVRX_RAMDACSIZE 0x000800 | |
+/* | |
+ * EVRX RAMDAC (Bt458) is found at offset 0x060000 from SGC bus PA and | |
+ * offset 0x040000 length 0x1c0000 is mapped in MI sti via ROM regions 2 | |
+ */ | |
+#define STI_EVRX_REGNO2OFFSET 0x020000 | |
#define STI_EVRX_FBOFFSET 0x200000 | |
-#define EVRX_BT458_ADDR (0x200 + 2) | |
-#define EVRX_BT458_CMAP (0x204 + 2) | |
-#define EVRX_BT458_CTRL (0x208 + 2) | |
-#define EVRX_BT458_OMAP (0x20C + 2) | |
+#define EVRX_BT458_ADDR (STI_EVRX_REGNO2OFFSET + 0x200 + 2) | |
+#define EVRX_BT458_CMAP (STI_EVRX_REGNO2OFFSET + 0x204 + 2) | |
+#define EVRX_BT458_CTRL (STI_EVRX_REGNO2OFFSET + 0x208 + 2) | |
+#define EVRX_BT458_OMAP (STI_EVRX_REGNO2OFFSET + 0x20C + 2) | |
/* from HP-UX /usr/lib/libddevrx.a */ | |
-#define EVRX_MAGIC00 0x600 | |
-#define EVRX_MAGIC04 0x604 | |
-#define EVRX_MAGIC08 0x608 | |
-#define EVRX_MAGIC0C 0x60c | |
-#define EVRX_MAGIC10 0x610 | |
+#define EVRX_MAGIC00 (STI_EVRX_REGNO2OFFSET + 0x600) | |
+#define EVRX_MAGIC04 (STI_EVRX_REGNO2OFFSET + 0x604) | |
+#define EVRX_MAGIC08 (STI_EVRX_REGNO2OFFSET + 0x608) | |
+#define EVRX_MAGIC0C (STI_EVRX_REGNO2OFFSET + 0x60c) | |
+#define EVRX_MAGIC10 (STI_EVRX_REGNO2OFFSET + 0x610) | |
#define EVRX_MAGIC10_BSY 0x00010000 | |
-#define EVRX_MAGIC18 0x618 | |
-#define EVRX_MAGIC1C 0x61c | |
+#define EVRX_MAGIC18 (STI_EVRX_REGNO2OFFSET + 0x618) | |
+#define EVRX_MAGIC1C (STI_EVRX_REGNO2OFFSET + 0x61c) | |
/* | |
* HP A1659A CRX specific hardware | |
@@ -96,8 +97,8 @@ | |
/* 425e EVRX/CRX specific access functions */ | |
static int sti_evrx_putcmap(struct sti_screen *, u_int, u_int); | |
-static void sti_evrx_resetramdac(struct sti_sgc_softc *); | |
-static void sti_evrx_resetcmap(struct sti_sgc_softc *); | |
+static void sti_evrx_resetramdac(struct sti_screen *); | |
+static void sti_evrx_resetcmap(struct sti_screen *); | |
static void sti_evrx_setupfb(struct sti_screen *); | |
static paddr_t sti_m68k_mmap(void *, void *, off_t, int); | |
@@ -142,6 +143,7 @@ | |
struct sti_softc *ssc = &sc->sc_sti; | |
struct sgc_attach_args *saa = aux; | |
struct sti_screen *scr; | |
+ bus_space_tag_t bst; | |
bus_space_handle_t romh; | |
bus_addr_t base; | |
struct wsemuldisplaydev_attach_args waa; | |
@@ -151,7 +153,7 @@ | |
int i; | |
ssc->sc_dev = self; | |
- sc->sc_bst = saa->saa_iot; | |
+ bst = saa->saa_iot; | |
base = (bus_addr_t)sgc_slottopa(saa->saa_slot); | |
if (saa->saa_slot == sticonslot) { | |
@@ -164,18 +166,18 @@ | |
sti_describe(ssc); | |
} else { | |
- if (bus_space_map(sc->sc_bst, base, PAGE_SIZE, 0, &romh)) { | |
+ if (bus_space_map(bst, base, PAGE_SIZE, 0, &romh)) { | |
aprint_error(": can't map ROM"); | |
return; | |
} | |
/* | |
* Compute real PROM size | |
*/ | |
- romend = sti_rom_size(sc->sc_bst, romh); | |
+ romend = sti_rom_size(bst, romh); | |
- bus_space_unmap(sc->sc_bst, romh, PAGE_SIZE); | |
+ bus_space_unmap(bst, romh, PAGE_SIZE); | |
- if (bus_space_map(sc->sc_bst, base, romend, 0, &romh)) { | |
+ if (bus_space_map(bst, base, romend, 0, &romh)) { | |
aprint_error(": can't map frame buffer"); | |
return; | |
} | |
@@ -184,7 +186,7 @@ | |
for (i = 0; i < STI_REGION_MAX; i++) | |
ssc->bases[i] = base; | |
- if (sti_attach_common(ssc, sc->sc_bst, sc->sc_bst, romh, | |
+ if (sti_attach_common(ssc, bst, bst, romh, | |
STI_CODEBASE_ALT) != 0) | |
return; | |
} | |
@@ -202,23 +204,13 @@ | |
*/ | |
sc->sc_bitmap = base + STI_EVRX_FBOFFSET; | |
- /* | |
- * Bt458 RAMDAC can be accessed at offset +0x60200 and | |
- * unknown control registers are around +0x60600. | |
- */ | |
- if (bus_space_map(sc->sc_bst, base + STI_EVRX_RAMDACOFFSET, | |
- STI_EVRX_RAMDACSIZE, 0, &sc->sc_ramdach)) { | |
- aprint_error_dev(self, "can't map RAMDAC\n"); | |
- return; | |
- } | |
- | |
aprint_normal_dev(self, "Enable mmap support\n"); | |
/* | |
* initialize Bt458 RAMDAC and preserve initial color map | |
*/ | |
- sti_evrx_resetramdac(sc); | |
- sti_evrx_resetcmap(sc); | |
+ sti_evrx_resetramdac(scr); | |
+ sti_evrx_resetcmap(scr); | |
scr->setupfb = sti_evrx_setupfb; | |
scr->putcmap = sti_evrx_putcmap; | |
@@ -289,10 +281,8 @@ | |
sti_evrx_putcmap(struct sti_screen *scr, u_int index, u_int count) | |
{ | |
struct sti_rom *rom = scr->scr_rom; | |
- struct sti_softc *ssc = rom->rom_softc; | |
- struct sti_sgc_softc *sc = device_private(ssc->sc_dev); | |
- bus_space_tag_t bst = sc->sc_bst; | |
- bus_space_handle_t bsh = sc->sc_ramdach; | |
+ bus_space_tag_t bst = rom->memt; | |
+ bus_space_handle_t bsh = rom->regh[2]; | |
int i; | |
/* magic setup from HP-UX */ | |
@@ -312,10 +302,11 @@ | |
} | |
static void | |
-sti_evrx_resetramdac(struct sti_sgc_softc *sc) | |
+sti_evrx_resetramdac(struct sti_screen *scr) | |
{ | |
- bus_space_tag_t bst = sc->sc_bst; | |
- bus_space_handle_t bsh = sc->sc_ramdach; | |
+ struct sti_rom *rom = scr->scr_rom; | |
+ bus_space_tag_t bst = rom->memt; | |
+ bus_space_handle_t bsh = rom->regh[2]; | |
#if 0 | |
int i; | |
#endif | |
@@ -361,12 +352,11 @@ | |
} | |
static void | |
-sti_evrx_resetcmap(struct sti_sgc_softc *sc) | |
+sti_evrx_resetcmap(struct sti_screen *scr) | |
{ | |
- struct sti_softc *ssc = &sc->sc_sti; | |
- struct sti_screen *scr = ssc->sc_scr; | |
- bus_space_tag_t bst = sc->sc_bst; | |
- bus_space_handle_t bsh = sc->sc_ramdach; | |
+ struct sti_rom *rom = scr->scr_rom; | |
+ bus_space_tag_t bst = rom->memt; | |
+ bus_space_handle_t bsh = rom->regh[2]; | |
int i; | |
/* magic setup from HP-UX */ | |
@@ -389,12 +379,9 @@ | |
static void | |
sti_evrx_setupfb(struct sti_screen *scr) | |
{ | |
- struct sti_rom *rom = scr->scr_rom; | |
- struct sti_softc *ssc = rom->rom_softc; | |
- struct sti_sgc_softc *sc = device_private(ssc->sc_dev); | |
sti_init(scr, 0); | |
- sti_evrx_resetramdac(sc); | |
+ sti_evrx_resetramdac(scr); | |
} | |
static paddr_t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment