diff options
author | Martin Reindl <martin@cvs.openbsd.org> | 2005-05-01 17:04:53 +0000 |
---|---|---|
committer | Martin Reindl <martin@cvs.openbsd.org> | 2005-05-01 17:04:53 +0000 |
commit | 6fecd2bbab6c7bd90f9b2f64f4cf012f04ad98fc (patch) | |
tree | 58888c033c1a87336e329efd32e81a670f18ac78 /sys/arch/mac68k | |
parent | ed8e57ce7bdd4579246cbae2c1ffaacee3731003 (diff) |
- Sync nubus IDs with NetBSD and add some more
- add support for reading sMemory resources from nubus cards (currently unused)
- support a bunch more nubus video cards. The Miro PRISMA GX seems to handle
interrupts like the Radius DirectColor/GX, so just treat it the same.
ok miod@
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r-- | sys/arch/mac68k/dev/grf_mv.c | 367 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/nubus.c | 86 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/nubus.h | 169 |
3 files changed, 534 insertions, 88 deletions
diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index 939c3a8a29d..3660ee02950 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_mv.c,v 1.21 2005/04/26 21:09:35 martin Exp $ */ -/* $NetBSD: grf_mv.c,v 1.24 1997/05/03 02:29:54 briggs Exp $ */ +/* $OpenBSD: grf_mv.c,v 1.22 2005/05/01 17:04:52 martin Exp $ */ +/* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -12,10 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Allen Briggs. - * 4. The name of the author may not be used to endorse or promote products + * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR @@ -48,16 +45,28 @@ #include <machine/grfioctl.h> #include <machine/viareg.h> -#include "nubus.h" -#include "grfvar.h" +#include <mac68k/dev/nubus.h> +#include <mac68k/dev/grfvar.h> static void load_image_data(caddr_t data, struct image_data *image); -static int grfmv_intr_generic(void *vsc); -static int grfmv_intr_radius(void *vsc); -static int grfmv_intr_cti(void *vsc); +static int grfmv_intr_generic_write1(void *vsc); +static int grfmv_intr_generic_write4(void *vsc); +static int grfmv_intr_generic_or4(void *vsc); + static int grfmv_intr_cb264(void *vsc); static int grfmv_intr_cb364(void *vsc); +static int grfmv_intr_cmax(void *vsc); +static int grfmv_intr_cti(void *vsc); +static int grfmv_intr_radius(void *vsc); +static int grfmv_intr_radius24(void *vsc); +static int grfmv_intr_supermacgfx(void *vsc); +static int grfmv_intr_lapis(void *vsc); +static int grfmv_intr_formac(void *vsc); +static int grfmv_intr_vimage(void *vsc); +static int grfmv_intr_gvimage(void *vsc); +static int grfmv_intr_radius_gsc(void *vsc); +static int grfmv_intr_radius_gx(void *vsc); static int grfmv_mode(struct grf_softc *gp, int cmd, void *arg); static caddr_t grfmv_phys(struct grf_softc *gp, vm_offset_t addr); @@ -137,11 +146,11 @@ grfmv_attach(parent, self, aux) nubus_dir dir, mode_dir; int mode; + bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot)); + sc->sc_tag = na->na_tag; sc->card_id = na->drhw; - bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot)); - if (bus_space_map(sc->sc_tag, NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &sc->sc_regh)) { printf(": grfmv_attach: failed to map slot %d\n", na->slot); @@ -193,17 +202,16 @@ bad: gm = &sc->curr_mode; gm->mode_id = mode; - gm->fbbase = (caddr_t)(sc->sc_regh + - m68k_trunc_page(image.offset)); /* XXX evil! */ - gm->fboff = image.offset & PGOFSET; - gm->rowbytes = image.rowbytes; + gm->ptype = image.pixelType; + gm->psize = image.pixelSize; gm->width = image.right - image.left; gm->height = image.bottom - image.top; - gm->fbsize = sc->curr_mode.height * sc->curr_mode.rowbytes; + gm->rowbytes = image.rowbytes; gm->hres = image.hRes; gm->vres = image.vRes; - gm->ptype = image.pixelType; - gm->psize = image.pixelSize; + gm->fbsize = gm->height * gm->rowbytes; + gm->fbbase = (caddr_t)sc->sc_regh; /* XXX evil hack */ + gm->fboff = image.offset; strncpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_regh, &sc->sc_slot), CARD_NAME_LEN); @@ -225,51 +233,142 @@ bad: } switch (sc->card_id) { - case NUBUS_DRHW_M2HRVC: case NUBUS_DRHW_TFB: + case NUBUS_DRHW_M2HRVC: + case NUBUS_DRHW_PVC: sc->cli_offset = 0xa0000; sc->cli_value = 0; - add_nubus_intr(na->slot, grfmv_intr_generic, sc, + add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc, sc->sc_dev.dv_xname); break; case NUBUS_DRHW_WVC: sc->cli_offset = 0xa00000; sc->cli_value = 0; - add_nubus_intr(na->slot, grfmv_intr_generic, sc, + add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_COLORMAX: + add_nubus_intr(na->slot, grfmv_intr_cmax, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_SE30: + /* Do nothing--SE/30 interrupts are disabled */ + break; + case NUBUS_DRHW_MDC: + sc->cli_offset = 0x200148; + sc->cli_value = 1; + add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc, + sc->sc_dev.dv_xname); + + /* Enable interrupts; to disable, write 0x7 to this location */ + bus_space_write_4(sc->sc_tag, sc->sc_regh, 0x20013C, 5); + break; + case NUBUS_DRHW_CB264: + add_nubus_intr(na->slot, grfmv_intr_cb264, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_CB364: + add_nubus_intr(na->slot, grfmv_intr_cb364, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_RPC8: + sc->cli_offset = 0xfdff8f; + sc->cli_value = 0xff; + add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc, sc->sc_dev.dv_xname); break; case NUBUS_DRHW_RPC8XJ: + sc->cli_value = 0x66; + add_nubus_intr(na->slot, grfmv_intr_radius, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_RPC24X: + case NUBUS_DRHW_BOOGIE: + sc->cli_value = 0x64; add_nubus_intr(na->slot, grfmv_intr_radius, sc, sc->sc_dev.dv_xname); break; + case NUBUS_DRHW_RPC24XP: + add_nubus_intr(na->slot, grfmv_intr_radius24, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_RADGSC: + add_nubus_intr(na->slot, grfmv_intr_radius_gsc, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_RDCGX: + case NUBUS_DRHW_MPGX: + add_nubus_intr(na->slot, grfmv_intr_radius_gx, sc, + sc->sc_dev.dv_xname); + break; case NUBUS_DRHW_FIILX: case NUBUS_DRHW_FIISXDSP: + case NUBUS_DRHW_FUTURASX: sc->cli_offset = 0xf05000; sc->cli_value = 0x80; - add_nubus_intr(na->slot, grfmv_intr_generic, sc, + add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc, sc->sc_dev.dv_xname); break; case NUBUS_DRHW_SAM768: add_nubus_intr(na->slot, grfmv_intr_cti, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_SUPRGFX: + add_nubus_intr(na->slot, grfmv_intr_supermacgfx, sc, sc->sc_dev.dv_xname); break; - case NUBUS_DRHW_CB264: - add_nubus_intr(na->slot, grfmv_intr_cb264, sc, + case NUBUS_DRHW_SPECTRM8: + sc->cli_offset = 0x0de178; + sc->cli_value = 0x80; + add_nubus_intr(na->slot, grfmv_intr_generic_or4, sc, sc->sc_dev.dv_xname); break; - case NUBUS_DRHW_CB364: - add_nubus_intr(na->slot, grfmv_intr_cb364, sc, + case NUBUS_DRHW_LAPIS: + add_nubus_intr(na->slot, grfmv_intr_lapis, sc, sc->sc_dev.dv_xname); break; - case NUBUS_DRHW_SE30: - /* Do nothing--SE/30 interrupts are disabled */ + case NUBUS_DRHW_FORMAC: + add_nubus_intr(na->slot, grfmv_intr_formac, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_ROPS24LXI: + case NUBUS_DRHW_ROPS24XLTV: + case NUBUS_DRHW_ROPS24MXTV: + sc->cli_offset = 0xfb0010; + sc->cli_value = 0x00; + add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_ROPSPPGT: + sc->cli_offset = 0xf50010; + sc->cli_value = 0x02; + add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_VIMAGE: + add_nubus_intr(na->slot, grfmv_intr_vimage, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_GVIMAGE: + add_nubus_intr(na->slot, grfmv_intr_gvimage, sc, + sc->sc_dev.dv_xname); + break; + case NUBUS_DRHW_MC2124NB: + sc->cli_offset = 0xfd1000; + sc->cli_value = 0x00; + add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc, + sc->sc_dev.dv_xname); break; case NUBUS_DRHW_MICRON: - /* What do we know about this one? */ + sc->cli_offset = 0xa00014; + sc->cli_value = 0; + add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc, + sc->sc_dev.dv_xname); + break; default: - printf("%s: Unknown video card 0x%x--", + printf("%s: Unknown video card ID 0x%x --", sc->sc_dev.dv_xname, sc->card_id); - printf("Not installing interrupt routine.\n"); + printf(" Not installing interrupt routine.\n"); break; } @@ -309,22 +408,58 @@ grfmv_phys(gp, addr) /* Interrupt handlers... */ /* * Generic routine to clear interrupts for cards where it simply takes - * a CLR.B to clear the interrupt. The offset of this byte varies between - * cards. + * a MOV.B to clear the interrupt. The offset and value of this byte + * varies between cards. */ /*ARGSUSED*/ static int -grfmv_intr_generic(vsc) +grfmv_intr_generic_write1(vsc) void *vsc; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; bus_space_write_1(sc->sc_tag, sc->sc_regh, + sc->cli_offset, (u_int8_t)sc->cli_value); + return (1); +} + +/* + * Generic routine to clear interrupts for cards where it simply takes + * a MOV.L to clear the interrupt. The offset and value of this byte + * varies between cards. + */ +/*ARGSUSED*/ +static int +grfmv_intr_generic_write4(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + + bus_space_write_4(sc->sc_tag, sc->sc_regh, sc->cli_offset, sc->cli_value); return (1); } /* + * Generic routine to clear interrupts for cards where it simply takes + * an OR.L to clear the interrupt. The offset and value of this byte + * varies between cards. + */ +/*ARGSUSED*/ +static int +grfmv_intr_generic_or4(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + unsigned long scratch; + + scratch = bus_space_read_4(sc->sc_tag, sc->sc_regh, sc->cli_offset); + scratch |= 0x80; + bus_space_write_4(sc->sc_tag, sc->sc_regh, sc->cli_offset, scratch); + return (1); +} + +/* * Routine to clear interrupts for the Radius PrecisionColor 8xj card. */ /*ARGSUSED*/ @@ -335,12 +470,7 @@ grfmv_intr_radius(vsc) struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; - /* - * The value 0x66 was the observed value on one card. It is read - * from the driver's information block, so this may not be sufficient. - * Then again, we're not setting up any other interrupts... - */ - c = 0x66; + c = sc->cli_value; c |= 0x80; bus_space_write_1(sc->sc_tag, sc->sc_regh, 0xd00403, c); @@ -350,6 +480,25 @@ grfmv_intr_radius(vsc) } /* + * Routine to clear interrupts for the Radius PrecisionColor 24Xp card. + * Is this what the 8xj routine is doing, too? + */ +/*ARGSUSED*/ +static int +grfmv_intr_radius24(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + u_int8_t c; + + c = 0x80 | bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xfffd8); + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0xd00403, c); + c &= 0x7f; + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0xd00403, c); + return (1); +} + +/* * Routine to clear interrupts on Samsung 768x1006 video controller. * This controller was manufactured by Cornerstone Technology, Inc., * now known as Cornerstone Imaging. @@ -376,13 +525,14 @@ grfmv_intr_cti(vsc) /*ARGSUSED*/ static int -grfmv_intr_cb264(void *vsc) +grfmv_intr_cb264(vsc) + void *vsc; { struct grfbus_softc *sc; volatile char *slotbase; sc = (struct grfbus_softc *)vsc; - slotbase = (volatile char *)sc->sc_regh; /* XXX evil hack */ + slotbase = (volatile char *)sc->sc_regh; /* XXX evil hack */ asm volatile(" movl %0,a0 movl a0@(0xff6028),d0 andl #0x2,d0 @@ -430,13 +580,14 @@ grfmv_intr_cb264(void *vsc) */ /*ARGSUSED*/ static int -grfmv_intr_cb364(void *vsc) +grfmv_intr_cb364(vsc) + void *vsc; { struct grfbus_softc *sc; volatile char *slotbase; sc = (struct grfbus_softc *)vsc; - slotbase = (volatile char *)sc->sc_regh; /* XXX evil hack */ + slotbase = (volatile char *)sc->sc_regh; /* XXX evil hack */ asm volatile(" movl %0,a0 movl a0@(0xfe6028),d0 andl #0x2,d0 @@ -512,3 +663,127 @@ grfmv_intr_cb364(void *vsc) " : : "g" (slotbase) : "a0","d0","d1","d2"); return (1); } + +/* + * Interrupt clearing routine for SuperMac GFX card. + */ +/*ARGSUSED*/ +static int +grfmv_intr_supermacgfx(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + u_int8_t dummy; + + dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xE70D3); + return (1); +} + +/* + * Routine to clear interrupts for the Sigma Designs ColorMax card. + */ +/*ARGSUSED*/ +static int +grfmv_intr_cmax(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + u_int32_t dummy; + + dummy = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0xf501c); + dummy = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0xf5018); + return (1); +} + +/* + * Routine to clear interrupts for the Lapis ProColorServer 8 PDS card + * (for the SE/30). + */ +/*ARGSUSED*/ +static int +grfmv_intr_lapis(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0xff7000, 0x08); + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0xff7000, 0x0C); + return (1); +} + +/* + * Routine to clear interrupts for the Formac Color Card II + */ +/*ARGSUSED*/ +static int +grfmv_intr_formac(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + u_int8_t dummy; + + dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xde80db); + dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xde80d3); + return (1); +} + +/* + * Routine to clear interrupts for the Vimage by Interware Co., Ltd. + */ +/*ARGSUSED*/ +static int +grfmv_intr_vimage(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0x800000, 0x67); + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0x800000, 0xE7); + return (1); +} + +/* + * Routine to clear interrupts for the Grand Vimage by Interware Co., Ltd. + */ +/*ARGSUSED*/ +static int +grfmv_intr_gvimage(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + u_int8_t dummy; + + dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xf00000); + return (1); +} + +/* + * Routine to clear interrupts for the Radius GS/C + */ +/*ARGSUSED*/ +static int +grfmv_intr_radius_gsc(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + u_int8_t dummy; + + dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xfb802); + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0xfb802, 0xff); + return (1); +} + +/* + * Routine to clear interrupts for the Radius GS/C + */ +/*ARGSUSED*/ +static int +grfmv_intr_radius_gx(vsc) + void *vsc; +{ + struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0x600000, 0x00); + bus_space_write_1(sc->sc_tag, sc->sc_regh, 0x600000, 0x20); + return (1); +} diff --git a/sys/arch/mac68k/dev/nubus.c b/sys/arch/mac68k/dev/nubus.c index 81d6f4f18b3..da9de238c84 100644 --- a/sys/arch/mac68k/dev/nubus.c +++ b/sys/arch/mac68k/dev/nubus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: nubus.c,v 1.30 2005/04/26 21:09:35 martin Exp $ */ -/* $NetBSD: nubus.c,v 1.45 1998/06/02 02:24:03 scottr Exp $ */ +/* $OpenBSD: nubus.c,v 1.31 2005/05/01 17:04:52 martin Exp $ */ +/* $NetBSD: nubus.c,v 1.53 2002/04/13 17:49:41 briggs Exp $ */ /* * Copyright (c) 1995, 1996 Allen Briggs. All rights reserved. @@ -32,6 +32,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/malloc.h> #include <sys/device.h> #include <sys/buf.h> #include <sys/conf.h> @@ -52,7 +53,7 @@ #define NDB_PROBE 0x1 #define NDB_FOLLOW 0x2 #define NDB_ARITH 0x4 -static int nubus_debug = 0 /* | NDB_PROBE */; +static int nubus_debug = 0 /* | NDB_PROBE | NDB_FOLLOW | NDB_ARITH */ ; #endif static int nubus_print(void *, const char *); @@ -152,10 +153,16 @@ notfound: * of video resources given to us by the booter. If that * doesn't work either, take the first resource following * the board resource. + * If we only find a board resource, report that. + * There are cards that do not have anything else; their + * driver then has to match on the board resource and + * the card name. */ if (nubus_find_rsrc(bst, bsh, &fmtblock, &dir, rsrcid, &dirent) <= 0) { if ((rsrcid = nubus_video_resource(i)) == -1) { + int has_board_rsrc = 0; + /* * Since nubus_find_rsrc failed, the directory * is back at its base. @@ -165,21 +172,27 @@ notfound: /* * All nubus cards should have a board * resource, but be sure that's what it - * is before we skip it. + * is before we skip it, and note the fact. */ rsrcid = nubus_read_1(bst, bsh, lanes, entry); - if (rsrcid == 0x1) + if (rsrcid == 0x1) { + has_board_rsrc = 1; entry = nubus_adjust_ptr(lanes, dir.curr_ent, 4); - + } rsrcid = nubus_read_1(bst, bsh, lanes, entry); + /* end of chain? */ + if (rsrcid == 0xff) { + if (!has_board_rsrc) + goto notfound; + else + rsrcid = 0x01; + } #ifdef DEBUG if (nubus_debug & NDB_FOLLOW) printf("\tUsing rsrc 0x%x.\n", rsrcid); #endif - if (rsrcid == 0xff) /* end of chain */ - goto notfound; } /* * Try to find the resource passed by the booter @@ -724,6 +737,63 @@ nubus_get_c_string(bst, bsh, fmt, dirent, data_return, max_bytes) return 0; } +/* + * Get list of address ranges for an sMemory resource + * -> DC&D, p.171 + */ +int +nubus_get_smem_addr_rangelist(bst, bsh, fmt, dirent, data_return) + bus_space_tag_t bst; + bus_space_handle_t bsh; + nubus_slot *fmt; + nubus_dirent *dirent; + caddr_t data_return; +{ + u_long loc; + u_int8_t lanes = fmt->bytelanes; + long blocklen; + caddr_t blocklist; + +#ifdef DEBUG + if (nubus_debug & NDB_FOLLOW) + printf("nubus_get_smem_addr_rangelist(%p, %p, %p).\n", + fmt, dirent, data_return); +#endif + if ((loc = dirent->offset) & 0x800000) { + loc |= 0xff000000; + } + loc = nubus_adjust_ptr(lanes, dirent->myloc, loc); + + /* Obtain the block length from the head of the list */ + blocklen = nubus_read_4(bst, bsh, lanes, loc); + + /* + * malloc a block of (blocklen) bytes + * caller must recycle block after use + */ + MALLOC(blocklist,caddr_t,blocklen,M_TEMP,M_WAITOK); + + /* read ((blocklen - 4) / 8) (length,offset) pairs into block */ + nubus_get_ind_data(bst, bsh, fmt, dirent, blocklist, blocklen); +#ifdef DEBUG + if (nubus_debug & NDB_FOLLOW) { + int ii; + nubus_smem_rangelist *rlist; + + rlist = (nubus_smem_rangelist *)blocklist; + printf("\tblock@%p, len 0x0%X\n", rlist, rlist->length); + + for (ii=0; ii < ((blocklen - 4) / 8); ii++) { + printf("\tRange %d: base addr 0x%X [0x%X]\n", ii, + rlist->range[ii].offset, rlist->range[ii].length); + } + } +#endif + *(caddr_t *)data_return = blocklist; + + return 1; +} + static char *huh = "???"; char * diff --git a/sys/arch/mac68k/dev/nubus.h b/sys/arch/mac68k/dev/nubus.h index 20c50ac3996..670750c0d3e 100644 --- a/sys/arch/mac68k/dev/nubus.h +++ b/sys/arch/mac68k/dev/nubus.h @@ -1,5 +1,4 @@ -/* $OpenBSD: nubus.h,v 1.20 2005/04/26 21:09:35 martin Exp $ */ -/* $NetBSD: nubus.h,v 1.25 1997/05/02 00:54:28 briggs Exp $ */ +/* $NetBSD: nubus.h,v 1.59 2005/01/15 16:00:59 chs Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -47,22 +46,52 @@ #include <machine/cpu.h> #define NUBUS_CATEGORY_BOARD 0x0001 +#define NUBUS_TYPE_BOARD 0x0000 /* We want these for minimal board */ +#define NUBUS_DRSW_BOARD 0x0000 /* ROMs that come with nothing but */ +#define NUBUS_DRHW_BOARD 0x0000 /* a board resource (old NI_GPIB) */ #define NUBUS_CATEGORY_DISPLAY 0x0003 #define NUBUS_TYPE_VIDEO 0x0001 #define NUBUS_TYPE_LCD 0x0002 #define NUBUS_DRSW_APPLE 0x0001 #define NUBUS_DRHW_TFB 0x0001 /* Apple Toby Frame Buffer */ +#define NUBUS_DRHW_BAER 0x0002 /* Formac Baers color card */ #define NUBUS_DRHW_WVC 0x0006 /* Apple Workstation Video Card */ -#define NUBUS_DRHW_SE30 0x0009 +#define NUBUS_DRHW_COLORMAX 0x0007 /* Sigma Designs ColorMax */ +#define NUBUS_DRHW_SE30 0x0009 /* Apple SE/30 pseudo-slot video */ #define NUBUS_DRHW_M2HRVC 0x0013 /* Apple Mac II High-Res Video Card */ +#define NUBUS_DRHW_PVC 0x0017 /* Apple Mac II Portrait Video Card */ +#define NUBUS_DRHW_MDC 0x0019 /* Apple Macintosh Display Card */ +#define NUBUS_DRHW_VSC 0x0020 /* Apple Macintosh Duo MiniDock */ +#define NUBUS_DRHW_JET 0x0029 /* Apple Macintosh DuoDock II */ +#define NUBUS_DRHW_BOOGIE 0x002b /* Apple Macintosh 24AC Video Card */ +#define NUBUS_DRHW_SUPRGFX 0x0105 /* SuperMac GFX */ +#define NUBUS_DRHW_FORMAC 0x013A /* Formac color card II */ #define NUBUS_DRHW_CB264 0x013B /* RasterOps ColorBoard 264 */ -#define NUBUS_DRHW_MICRON 0x0146 +#define NUBUS_DRHW_MICRON 0x0146 /* Micron Exceed color */ +#define NUBUS_DRHW_RADGSC 0x0153 /* Radius GS/C */ +#define NUBUS_DRHW_SPECTRM8 0x017b /* SuperMac Spectrum/8 Series III */ +#define NUBUS_DRHW_SPECTRUM 0x017c /* SuperMac Spectrum/24 Series III */ +#define NUBUS_DRHW_VIMAGE 0x026E /* Interware Co., Ltd. Vimage */ #define NUBUS_DRHW_CB364 0x026F /* RasterOps ColorBoard 364 */ +#define NUBUS_DRHW_LVIEW 0x0278 /* Sigma Designs L-View */ +#define NUBUS_DRHW_RDCGX 0x027C /* Radius DirectColor/GX */ +#define NUBUS_DRHW_RPC8 0x0291 /* Radius PrecisionColor 8 */ +#define NUBUS_DRHW_LAPIS 0x0292 /* SE/30 Lapis ProColorServer 8 PDS */ +#define NUBUS_DRHW_ROPS24LXI 0x02A0 /* RasterOps 8/24 XLi */ +#define NUBUS_DRHW_ROPSPPGT 0x02A5 /* RasterOps PaintBoard Prism GT 1.0 */ +#define NUBUS_DRHW_FUTURASX 0x02AE /* E-Machines Futura-SX */ +#define NUBUS_DRHW_ROPS24XLTV 0x02B7 /* RasterOps 24XlTV */ #define NUBUS_DRHW_THUNDER24 0x02CB /* SuperMac Thunder/24 */ -#define NUBUS_DRHW_RPC8XJ 0x040B /* Radius PrecisionColor 8xj */ -#define NUBUS_DRHW_FIILX 0x0417 /* Futura II LX */ -#define NUBUS_DRHW_FIISXDSP 0x042F /* Futura II SX/DSP */ +#define NUBUS_DRHW_MPGX 0x03D6 /* MiroPRISMA GX */ +#define NUBUS_DRHW_ROPS24MXTV 0x03DF /* RasterOps 24MxTV */ +#define NUBUS_DRHW_GVIMAGE 0x03FB /* Interware Co., Ltd. Grand Vimage */ +#define NUBUS_DRHW_RPC24XP 0x0406 /* Radius PrecisionColor 24Xp */ +#define NUBUS_DRHW_RPC24X 0x040A /* Radius PrecisionColor 24X */ +#define NUBUS_DRHW_RPC8XJ 0x040B /* Radius PrecisionColor 8xj */ +#define NUBUS_DRHW_FIILX 0x0417 /* Futura II LX */ +#define NUBUS_DRHW_FIISXDSP 0x042F /* Futura II SX/DSP */ +#define NUBUS_DRHW_MC2124NB 0x0462 /* MicroConversions 2124NB II */ /* False DrHW values for video cards masquerading as other cards */ #define NUBUS_DRHW_SAM768 0x10000 /* Cornerstone/Samsung 768x1006 */ @@ -70,38 +99,76 @@ #define NUBUS_CATEGORY_NETWORK 0x0004 #define NUBUS_TYPE_ETHERNET 0x0001 #define NUBUS_DRSW_3COM 0x0000 -#define NUBUS_DRSW_CABLETRON 0x0001 +#define NUBUS_DRSW_CABLETRON 0x0001 #define NUBUS_DRSW_GATOR 0x0103 #define NUBUS_DRSW_ASANTE 0x0104 #define NUBUS_DRSW_TECHWORKS 0x0109 -#define NUBUS_DRSW_DAYNA 0x010B +#define NUBUS_DRSW_DAYNA 0x010B #define NUBUS_DRSW_FARALLON 0x010C -#define NUBUS_DRSW_DAYNA2 0x0115 +#define NUBUS_DRSW_DAYNA2 0x0115 #define NUBUS_DRSW_FOCUS 0x011A -#define NUBUS_DRSW_ASANTEF 0x011D -#define NUBUS_DRSW_TFLLAN 0x011E +#define NUBUS_DRSW_ASANTEF 0x011D +#define NUBUS_DRSW_TFLLAN 0x011E #define NUBUS_DRHW_INTERLAN 0x0100 -#define NUBUS_DRHW_ASANTEF 0x0101 +#define NUBUS_DRHW_ASANTEF 0x0101 #define NUBUS_DRHW_KINETICS 0x0106 #define NUBUS_DRHW_CABLETRON 0x0109 -#define NUBUS_DRHW_NUVOLINK 0x010B +#define NUBUS_DRHW_NUVOLINK 0x010B #define NUBUS_DRHW_ASANTE_LC 0x010F #define NUBUS_DRHW_SONIC 0x0110 +#define NUBUS_DRHW_TECHWORKS 0x0112 #define NUBUS_DRHW_APPLE_SNT 0x0118 #define NUBUS_DRHW_APPLE_SN 0x0119 #define NUBUS_CATEGORY_COMMUNICATIONS 0x0006 #define NUBUS_TYPE_RS232 0x0002 +#define NUBUS_TYPE_IEEE488 0x0004 #define NUBUS_DRSW_HDS 0x0102 -#define NUBUS_DRHW_HDS 0x0102 +#define NUBUS_DRSW_NI488 0x0104 +#define NUBUS_DRSW_HQS 0x0105 +#define NUBUS_DRHW_HDS 0x0102 /* CS Hustler serial */ +#define NUBUS_DRHW_HQS 0x0105 /* CS Hurdler quad serial */ +#define NUBUS_DRHW_NB_GPIB_TNT 0x0102 /* NatInst NB-GPIB/TNT */ -#define NUBUS_CATEGORY_FONT 0x0009 /* KanjiTalk Font Card? */ +#define NUBUS_CATEGORY_MEMORY 0x0009 /* Also KanjiTalk Font Card? */ +#define NUBUS_TYPE_RAMCACHE 0x010C /* From Apple PDS card */ +#define NUBUS_DRSW_AWGSPDS 0x0100 +#define NUBUS_DRHW_AWGSPDS 0x0100 #define NUBUS_CATEGORY_CPU 0x000A #define NUBUS_TYPE_68000 0x0002 #define NUBUS_TYPE_68020 0x0003 #define NUBUS_TYPE_68030 0x0004 #define NUBUS_TYPE_68040 0x0005 +#define NUBUS_TYPE_MX 0x0009 /* TI microExplorer */ + +#define NUBUS_CATEGORY_INTBUS 0x000C +#define NUBUS_TYPE_SCSI 0x0008 +#define NUBUS_DRSW_AWGSPDS_SCSI 0x0006 +#define NUBUS_DRHW_AWGSPDS_SCSI 0x0100 +#define NUBUS_DRSW_PLI 0x0108 +#define NUBUS_DRHW_PLI 0x0100 +#define NUBUS_TYPE_SCSIW 0x000B /* FWB JackHammer Fast/Wide */ +#define NUBUS_DRSW_FWB 0x0001 /* XXX Allen says 0x010C */ +#define NUBUS_DRHW_FWB 0x0100 + +#define NUBUS_CATEGORY_DOCK 0x0020 +#define NUBUS_TYPE_STATION 0x0001 +#define NUBUS_TYPE_DESK 0x0002 +#define NUBUS_TYPE_TRAVEL 0x0003 +/* #define NUBUS_DRSW_APPLE 0x0001 */ +#define NUBUS_DRSW_NEWERTECH 0x0101 + +/* Station */ +#define NUBUS_DRHW_DUODOCK 0x0001 /* Apple DuoDock */ +#define NUBUS_DRHW_DUODOCKII 0x0002 /* Apple DuoDock II */ + +/* Desk */ +#define NUBUS_DRHW_DUOMINIDOCK 0x0001 /* Apple Duo MiniDock */ + +/* Travel */ +#define NUBUS_DRHW_MICROSCSI 0x0100 /* Newer Technology SCSI MicroDock */ + /* * This is the same as Apple's Format Block for a card, with the @@ -175,6 +242,29 @@ typedef struct _nubus_rsrc { u_int32_t data; } nubus_rsrc; +/* + * On a NuBus master, an sMemory resource (this is a second-level + * resource list) holds a list of address ranges for onboard + * RAM, ROM and IO resources. + */ +typedef struct _nubus_smem_range { + u_int32_t length; + u_int32_t offset; +} nubus_smem_range; + +/* + * XXX This is mapped on the range list we get back out of the sMemory + * resources. I would have liked the range[] array to be of undefined + * size but the compiler does not let me. + * Maybe it's just too much grief, and we should work with an array + * of u_int32_t. + */ +typedef struct _nubus_smem_rangelist { + u_int32_t length; + nubus_smem_range range[1]; +} nubus_smem_rangelist; + + /* Resource IDs for NUBUS_CATEGORY_* (All) */ #define NUBUS_RSRC_TYPE 0x01 /* Type (required) */ #define NUBUS_RSRC_NAME 0x02 /* Name (required) */ @@ -191,6 +281,7 @@ typedef struct _nubus_rsrc { #define NUBUS_RSRC_CICN 0x0F /* Color icon */ #define NUBUS_RSRC_ICL8 0x10 /* 8-bit icon data */ #define NUBUS_RSRC_ICL4 0x11 /* 4-bit icon data */ +#define NUBUS_RSRC_SMEMORY 0x6C /* Resource list for master */ /* Resource IDs for NUBUS_CATEGORY_DISPLAY */ #define NUBUS_RSRC_GAMMADIR 0x40 /* ID for gamma directory */ @@ -217,6 +308,15 @@ typedef struct _nubus_rsrc { #define NUBUS_RSRC_VEND_PART 0x04 /* Card part number */ #define NUBUS_RSRC_VEND_DATE 0x05 /* Card revision date */ +/* Resource IDs for NUBUS_RSRC_SMEMORY master sMemory resource list */ +#define NUBUS_RSRC_SMEM_MINOR_RAMADDR 0x80 /* Minor RAM address ranges */ +#define NUBUS_RSRC_SMEM_MAJOR_RAMADDR 0x81 /* Major RAM address ranges */ +#define NUBUS_RSRC_SMEM_MINOR_ROMADDR 0x82 /* Minor ROM address ranges */ +#define NUBUS_RSRC_SMEM_MAJOR_ROMADDR 0x83 /* Major ROM address ranges */ +#define NUBUS_RSRC_SMEM_MINOR_DEVADDR 0x84 /* Minor device address ranges */ +#define NUBUS_RSRC_SMEM_MAJOR_DEVADDR 0x85 /* Major device address ranges */ + + typedef struct _NUBUS_DRIVER { u_int8_t drvr_id; u_int32_t offset; @@ -262,21 +362,22 @@ struct nubus_softc { struct device sc_dev; }; -void nubus_get_main_dir(nubus_slot *slot, nubus_dir *dir_return); -void nubus_get_dir_from_rsrc(nubus_slot *slot, nubus_dirent *dirent, - nubus_dir *dir_return); - -int nubus_find_rsrc(bus_space_tag_t, bus_space_handle_t, - nubus_slot *slot, nubus_dir *dir, u_int8_t rsrcid, - nubus_dirent *dirent_return); -int nubus_get_ind_data(bus_space_tag_t, bus_space_handle_t, - nubus_slot *slot, nubus_dirent *dirent, - caddr_t data_return, int nbytes); -int nubus_get_c_string(bus_space_tag_t, bus_space_handle_t, - nubus_slot *slot, nubus_dirent *dirent, - caddr_t data_return, int max_bytes); - -char *nubus_get_vendor(bus_space_tag_t, bus_space_handle_t, - nubus_slot *slot, int rsrc); -char *nubus_get_card_name(bus_space_tag_t, bus_space_handle_t, - nubus_slot *slot); + +void nubus_get_main_dir(nubus_slot *, nubus_dir *); +void nubus_get_dir_from_rsrc(nubus_slot *, nubus_dirent *, nubus_dir *); + +int nubus_find_rsrc(bus_space_tag_t, bus_space_handle_t, nubus_slot *, + nubus_dir *, u_int8_t, nubus_dirent *); +int nubus_get_ind_data(bus_space_tag_t, bus_space_handle_t, nubus_slot *, + nubus_dirent *, caddr_t, int); +int nubus_get_c_string(bus_space_tag_t, bus_space_handle_t, nubus_slot *, + nubus_dirent *, caddr_t, int); +int nubus_get_smem_addr_rangelist(bus_space_tag_t, bus_space_handle_t, + nubus_slot *, nubus_dirent *, caddr_t); + +char *nubus_get_vendor(bus_space_tag_t, bus_space_handle_t, nubus_slot *, + int); +char *nubus_get_card_name(bus_space_tag_t, bus_space_handle_t, nubus_slot *); +#ifdef DEBUG +void nubus_scan_slot(bus_space_tag_t, int); +#endif |