diff options
Diffstat (limited to 'sys/arch/mac68k/dev')
-rw-r--r-- | sys/arch/mac68k/dev/grf_iv.c | 88 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/grf_mv.c | 237 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/grf_subr.c | 79 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/grfvar.h | 115 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/macfb.c | 42 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/macfbvar.h | 119 |
6 files changed, 264 insertions, 416 deletions
diff --git a/sys/arch/mac68k/dev/grf_iv.c b/sys/arch/mac68k/dev/grf_iv.c index 5831644d764..8aceafea8b2 100644 --- a/sys/arch/mac68k/dev/grf_iv.c +++ b/sys/arch/mac68k/dev/grf_iv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_iv.c,v 1.33 2006/01/08 20:35:21 miod Exp $ */ +/* $OpenBSD: grf_iv.c,v 1.34 2006/01/09 20:51:48 miod Exp $ */ /* $NetBSD: grf_iv.c,v 1.17 1997/02/20 00:23:27 scottr Exp $ */ /* @@ -55,6 +55,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* * Graphics display driver for the Macintosh internal video for machines * that don't map it into a fake nubus card. @@ -62,11 +63,6 @@ #include <sys/param.h> #include <sys/device.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include <sys/malloc.h> -#include <sys/mman.h> -#include <sys/proc.h> #include <sys/systm.h> #include <machine/autoconf.h> @@ -78,7 +74,10 @@ #include <mac68k/dev/nubus.h> #include <mac68k/dev/obiovar.h> -#include <mac68k/dev/grfvar.h> + +#include <dev/wscons/wsdisplayvar.h> +#include <dev/rasops/rasops.h> +#include <mac68k/dev/macfbvar.h> extern u_int32_t mac68k_vidphys; extern u_int32_t mac68k_vidlen; @@ -87,15 +86,11 @@ extern long videorowbytes; extern long videobitdepth; extern u_long videosize; -static int grfiv_match(struct device *, void *, void *); -static void grfiv_attach(struct device *, struct device *, void *); - -struct cfdriver intvid_cd = { - NULL, "intvid", DV_DULL -}; +int macfb_obio_match(struct device *, void *, void *); +void macfb_obio_attach(struct device *, struct device *, void *); -struct cfattach intvid_ca = { - sizeof(struct grfbus_softc), grfiv_match, grfiv_attach +struct cfattach macfb_obio_ca = { + sizeof(struct macfb_softc), macfb_obio_match, macfb_obio_attach }; #define DAFB_BASE 0xf9000000 @@ -105,11 +100,8 @@ struct cfattach intvid_ca = { #define VALKYRIE_BASE 0xf9000000 #define VALKYRIE_CONTROL_BASE 0x50f2a000 -static int -grfiv_match(parent, vcf, aux) - struct device *parent; - void *vcf; - void *aux; +int +macfb_obio_match(struct device *parent, void *vcf, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_space_handle_t bsh; @@ -124,7 +116,7 @@ grfiv_match(parent, vcf, aux) base = VALKYRIE_CONTROL_BASE; if (bus_space_map(oa->oa_tag, base, 0x40, 0, &bsh)) - return 0; + return (0); /* Disable interrupts */ bus_space_write_1(oa->oa_tag, bsh, 0x18, 0x1); @@ -150,21 +142,21 @@ grfiv_match(parent, vcf, aux) base = DAFB_CONTROL_BASE; if (bus_space_map(oa->oa_tag, base, 0x20, 0, &bsh)) - return 0; + return (0); if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0x1c, 4) == 0) { bus_space_unmap(oa->oa_tag, bsh, 0x20); - return 0; + return (0); } bus_space_unmap(oa->oa_tag, bsh, 0x20); if (bus_space_map(oa->oa_tag, base + 0x100, 0x20, 0, &bsh)) - return 0; + return (0); if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0x04, 4) == 0) { bus_space_unmap(oa->oa_tag, bsh, 0x20); - return 0; + return (0); } /* Disable interrupts */ @@ -181,7 +173,7 @@ grfiv_match(parent, vcf, aux) base = CIVIC_CONTROL_BASE; if (bus_space_map(oa->oa_tag, base, 0x1000, 0, &bsh)) - return 0; + return (0); /* Disable interrupts */ bus_space_write_1(oa->oa_tag, bsh, 0x120, 0); @@ -200,21 +192,17 @@ grfiv_match(parent, vcf, aux) break; } - return found; + return (found); } -static void -grfiv_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +void +macfb_obio_attach(struct device *parent, struct device *self, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *) aux; - struct grfbus_softc *sc; - struct grfmode gm; + struct macfb_softc *sc = (struct macfb_softc *)self; u_long base, length; u_int32_t vbase1, vbase2; - - sc = (struct grfbus_softc *)self; + struct grfmode gm; sc->card_id = 0; @@ -275,7 +263,7 @@ grfiv_attach(parent, self, aux) #ifdef DEBUG printf(" @ %lx", sc->sc_basepa + sc->sc_fbofs); #endif - printf(": DAFB: monitor sense %x\n", + printf(": DAFB, monitor sense %x\n", (bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x1c) & 0x7)); bus_space_unmap(sc->sc_tag, sc->sc_regh, 0x20); @@ -302,30 +290,28 @@ grfiv_attach(parent, self, aux) length = mac68k_vidlen + sc->sc_fbofs; #ifdef DEBUG - printf(" @ %lx", sc->sc_basepa + sc->sc_fbofs); -#endif - printf(": RBV"); -#ifdef DEBUG + printf(" @ %lx: RBV", sc->sc_basepa + sc->sc_fbofs); switch (via2_reg(rMonitor) & RBVMonitorMask) { case RBVMonIDBWP: - printf(": 15\" monochrome portrait"); + printf(", 15\" monochrome portrait"); break; case RBVMonIDRGB12: - printf(": 12\" color"); + printf(", 12\" color"); break; case RBVMonIDRGB15: - printf(": 15\" color"); + printf(", 15\" color"); break; case RBVMonIDStd: - printf(": Macintosh II"); + printf(", Macintosh II"); break; default: - printf(": unrecognized"); + printf(", unrecognized"); break; } - printf(" display"); + printf(" display\n"); +#else + printf(": RBV\n"); #endif - printf("\n"); break; default: @@ -333,8 +319,10 @@ grfiv_attach(parent, self, aux) sc->sc_fbofs = m68k_page_offset(mac68k_vidphys); length = mac68k_vidlen + sc->sc_fbofs; - printf(" @ %lx: On-board video\n", - sc->sc_basepa + sc->sc_fbofs); +#ifdef DEBUG + printf(" @ %lx:", sc->sc_basepa + sc->sc_fbofs); +#endif + printf(": On-board video\n"); break; } @@ -357,5 +345,5 @@ grfiv_attach(parent, self, aux) gm.fboff = sc->sc_fbofs; /* Perform common video attachment. */ - grf_establish(sc, &gm); + macfb_attach_common(sc, &gm); } diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index 60538127af1..b5b6e2d425c 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_mv.c,v 1.28 2006/01/08 20:35:21 miod Exp $ */ +/* $OpenBSD: grf_mv.c,v 1.29 2006/01/09 20:51:48 miod Exp $ */ /* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */ /* @@ -36,7 +36,6 @@ #include <sys/ioctl.h> #include <sys/file.h> #include <sys/malloc.h> -#include <sys/mman.h> #include <sys/proc.h> #include <sys/systm.h> @@ -45,43 +44,45 @@ #include <machine/viareg.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_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_match(struct device *, void *, void *); -static void grfmv_attach(struct device *, struct device *, void *); - -struct cfdriver macvid_cd = { - NULL, "macvid", DV_DULL -}; -struct cfattach macvid_ca = { - sizeof(struct grfbus_softc), grfmv_match, grfmv_attach +/* +#include <dev/wscons/wsconsio.h> +*/ +#include <dev/wscons/wsdisplayvar.h> +#include <dev/rasops/rasops.h> +#include <mac68k/dev/macfbvar.h> + +int macfb_nubus_match(struct device *, void *, void *); +void macfb_nubus_attach(struct device *, struct device *, void *); + +struct cfattach macfb_nubus_ca = { + sizeof(struct macfb_softc), macfb_nubus_match, macfb_nubus_attach }; -static void -load_image_data(data, image) - caddr_t data; - struct image_data *image; +void load_image_data(caddr_t data, struct image_data *image); + +int grfmv_intr_generic_write1(void *vsc); +int grfmv_intr_generic_write4(void *vsc); +int grfmv_intr_generic_or4(void *vsc); + +int grfmv_intr_cb264(void *vsc); +int grfmv_intr_cb364(void *vsc); +int grfmv_intr_cmax(void *vsc); +int grfmv_intr_cti(void *vsc); +int grfmv_intr_radius(void *vsc); +int grfmv_intr_radius24(void *vsc); +int grfmv_intr_supermacgfx(void *vsc); +int grfmv_intr_lapis(void *vsc); +int grfmv_intr_formac(void *vsc); +int grfmv_intr_vimage(void *vsc); +int grfmv_intr_gvimage(void *vsc); +int grfmv_intr_radius_gsc(void *vsc); +int grfmv_intr_radius_gx(void *vsc); + +#define CARD_NAME_LEN 64 + +void +load_image_data(caddr_t data, struct image_data *image) { bcopy(data , &image->size, 4); bcopy(data + 4, &image->offset, 4); @@ -102,22 +103,19 @@ load_image_data(data, image) bcopy(data + 42, &image->planeBytes, 4); } -static int -grfmv_match(parent, vcf, aux) - struct device *parent; - void *vcf; - void *aux; +int +macfb_nubus_match(struct device *parent, void *vcf, void *aux) { struct nubus_attach_args *na = (struct nubus_attach_args *)aux; if (na->category != NUBUS_CATEGORY_DISPLAY) - return 0; + return (0); if (na->type != NUBUS_TYPE_VIDEO) - return 0; + return (0); if (na->drsw != NUBUS_DRSW_APPLE) - return 0; + return (0); /* * If we've gotten this far, then we're dealing with a real-live @@ -125,23 +123,20 @@ grfmv_match(parent, vcf, aux) * determine that this is an active resource??? Dunno. But we'll * proceed like it is. */ - - return 1; + return (1); } -static void -grfmv_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +void +macfb_nubus_attach(struct device *parent, struct device *self, void *aux) { - struct grfbus_softc *sc = (struct grfbus_softc *)self; struct nubus_attach_args *na = (struct nubus_attach_args *)aux; + struct macfb_softc *sc = (struct macfb_softc *)self; struct image_data image_store, image; - struct grfmode gm; char cardname[CARD_NAME_LEN]; nubus_dirent dirent; nubus_dir dir, mode_dir, board_dir; int mode; + struct grfmode gm; bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot)); @@ -152,7 +147,7 @@ grfmv_attach(parent, self, aux) if (bus_space_map(sc->sc_tag, sc->sc_basepa, NBMEMSIZE, 0, &sc->sc_regh)) { - printf(": grfmv_attach: failed to map slot %d\n", na->slot); + printf(": failed to map slot %d\n", na->slot); return; } @@ -160,9 +155,8 @@ grfmv_attach(parent, self, aux) if (nubus_find_rsrc(sc->sc_tag, sc->sc_regh, &sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0) { -bad: - bus_space_unmap(sc->sc_tag, sc->sc_regh, NBMEMSIZE); - return; + printf(": failed to get board rsrc.\n"); + goto bad; } nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &board_dir); @@ -171,8 +165,10 @@ bad: &sc->sc_slot, &board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0) if ((na->rsrcid != 128) || (nubus_find_rsrc(sc->sc_tag, sc->sc_regh, - &sc->sc_slot, &dir, 129, &dirent) <= 0)) + &sc->sc_slot, &dir, 129, &dirent) <= 0)) { + printf(": failed to get board rsrc.\n"); goto bad; + } mode = NUBUS_RSRC_FIRSTMODE; if (nubus_find_rsrc(sc->sc_tag, sc->sc_regh, @@ -207,9 +203,8 @@ bad: gm.fbbase = (caddr_t)(sc->sc_handle.base); /* 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); - cardname[CARD_NAME_LEN-1] = '\0'; + strlcpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_regh, + &sc->sc_slot), sizeof cardname); printf(": %s\n", cardname); if (sc->card_id == NUBUS_DRHW_TFB) { @@ -221,9 +216,11 @@ bad: */ if (strncmp(cardname, "Samsung 768", 11) == 0) sc->card_id = NUBUS_DRHW_SAM768; +#ifdef DEBUG else if (strncmp(cardname, "Toby frame", 10) != 0) printf("%s: This display card pretends to be a TFB!\n", sc->sc_dev.dv_xname); +#endif } switch (sc->card_id) { @@ -368,7 +365,11 @@ bad: } /* Perform common video attachment. */ - grf_establish(sc, &gm); + macfb_attach_common(sc, &gm); + return; + +bad: + bus_space_unmap(sc->sc_tag, sc->sc_regh, NBMEMSIZE); } /* Interrupt handlers... */ @@ -378,11 +379,10 @@ bad: * varies between cards. */ /*ARGSUSED*/ -static int -grfmv_intr_generic_write1(vsc) - void *vsc; +int +grfmv_intr_generic_write1(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; bus_space_write_1(sc->sc_tag, sc->sc_regh, sc->cli_offset, (u_int8_t)sc->cli_value); @@ -395,11 +395,10 @@ grfmv_intr_generic_write1(vsc) * varies between cards. */ /*ARGSUSED*/ -static int -grfmv_intr_generic_write4(vsc) - void *vsc; +int +grfmv_intr_generic_write4(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; bus_space_write_4(sc->sc_tag, sc->sc_regh, sc->cli_offset, sc->cli_value); @@ -412,11 +411,10 @@ grfmv_intr_generic_write4(vsc) * varies between cards. */ /*ARGSUSED*/ -static int -grfmv_intr_generic_or4(vsc) - void *vsc; +int +grfmv_intr_generic_or4(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; unsigned long scratch; scratch = bus_space_read_4(sc->sc_tag, sc->sc_regh, sc->cli_offset); @@ -429,11 +427,10 @@ grfmv_intr_generic_or4(vsc) * Routine to clear interrupts for the Radius PrecisionColor 8xj card. */ /*ARGSUSED*/ -static int -grfmv_intr_radius(vsc) - void *vsc; +int +grfmv_intr_radius(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t c; c = sc->cli_value; @@ -450,11 +447,10 @@ grfmv_intr_radius(vsc) * Is this what the 8xj routine is doing, too? */ /*ARGSUSED*/ -static int -grfmv_intr_radius24(vsc) - void *vsc; +int +grfmv_intr_radius24(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t c; c = 0x80 | bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xfffd8); @@ -474,11 +470,10 @@ grfmv_intr_radius24(vsc) * Information for this provided by Brad Salai <bsalai@servtech.com> */ /*ARGSUSED*/ -static int -grfmv_intr_cti(vsc) - void *vsc; +int +grfmv_intr_cti(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t c; c = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0x80000); @@ -490,14 +485,12 @@ grfmv_intr_cti(vsc) } /*ARGSUSED*/ -static int -grfmv_intr_cb264(vsc) - void *vsc; +int +grfmv_intr_cb264(void *vsc) { - struct grfbus_softc *sc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; volatile char *slotbase; - sc = (struct grfbus_softc *)vsc; slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */ asm volatile(" movl %0,a0 movl a0@(0xff6028),d0 @@ -545,14 +538,12 @@ grfmv_intr_cb264(vsc) * significantly simplified. Contributions welcome... :-) */ /*ARGSUSED*/ -static int -grfmv_intr_cb364(vsc) - void *vsc; +int +grfmv_intr_cb364(void *vsc) { - struct grfbus_softc *sc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; volatile char *slotbase; - sc = (struct grfbus_softc *)vsc; slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */ asm volatile(" movl %0,a0 movl a0@(0xfe6028),d0 @@ -634,11 +625,10 @@ grfmv_intr_cb364(vsc) * Interrupt clearing routine for SuperMac GFX card. */ /*ARGSUSED*/ -static int -grfmv_intr_supermacgfx(vsc) - void *vsc; +int +grfmv_intr_supermacgfx(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t dummy; dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xE70D3); @@ -649,11 +639,10 @@ grfmv_intr_supermacgfx(vsc) * Routine to clear interrupts for the Sigma Designs ColorMax card. */ /*ARGSUSED*/ -static int -grfmv_intr_cmax(vsc) - void *vsc; +int +grfmv_intr_cmax(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int32_t dummy; dummy = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0xf501c); @@ -666,11 +655,10 @@ grfmv_intr_cmax(vsc) * (for the SE/30). */ /*ARGSUSED*/ -static int -grfmv_intr_lapis(vsc) - void *vsc; +int +grfmv_intr_lapis(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_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); @@ -681,11 +669,10 @@ grfmv_intr_lapis(vsc) * Routine to clear interrupts for the Formac Color Card II */ /*ARGSUSED*/ -static int -grfmv_intr_formac(vsc) - void *vsc; +int +grfmv_intr_formac(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t dummy; dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xde80db); @@ -697,11 +684,10 @@ grfmv_intr_formac(vsc) * Routine to clear interrupts for the Vimage by Interware Co., Ltd. */ /*ARGSUSED*/ -static int -grfmv_intr_vimage(vsc) - void *vsc; +int +grfmv_intr_vimage(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_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); @@ -712,11 +698,10 @@ grfmv_intr_vimage(vsc) * Routine to clear interrupts for the Grand Vimage by Interware Co., Ltd. */ /*ARGSUSED*/ -static int -grfmv_intr_gvimage(vsc) - void *vsc; +int +grfmv_intr_gvimage(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t dummy; dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xf00000); @@ -727,11 +712,10 @@ grfmv_intr_gvimage(vsc) * Routine to clear interrupts for the Radius GS/C */ /*ARGSUSED*/ -static int -grfmv_intr_radius_gsc(vsc) - void *vsc; +int +grfmv_intr_radius_gsc(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_softc *)vsc; u_int8_t dummy; dummy = bus_space_read_1(sc->sc_tag, sc->sc_regh, 0xfb802); @@ -743,11 +727,10 @@ grfmv_intr_radius_gsc(vsc) * Routine to clear interrupts for the Radius GS/C */ /*ARGSUSED*/ -static int -grfmv_intr_radius_gx(vsc) - void *vsc; +int +grfmv_intr_radius_gx(void *vsc) { - struct grfbus_softc *sc = (struct grfbus_softc *)vsc; + struct macfb_softc *sc = (struct macfb_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); diff --git a/sys/arch/mac68k/dev/grf_subr.c b/sys/arch/mac68k/dev/grf_subr.c deleted file mode 100644 index f7cd849ed75..00000000000 --- a/sys/arch/mac68k/dev/grf_subr.c +++ /dev/null @@ -1,79 +0,0 @@ -/* $OpenBSD: grf_subr.c,v 1.9 2006/01/08 20:35:21 miod Exp $ */ -/* $NetBSD: grf_subr.c,v 1.6 1997/02/20 00:23:28 scottr Exp $ */ - -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 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 the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/device.h> -#include <sys/systm.h> - -#include <machine/bus.h> - -#include <mac68k/dev/nubus.h> -#include <mac68k/dev/grfvar.h> - -void -grf_establish(struct grfbus_softc *sc, struct grfmode *gm) -{ - struct grfbus_attach_args ga; - - /* Print hardware characteristics. */ - printf("%s: %d x %d, ", sc->sc_dev.dv_xname, gm->width, gm->height); - if (gm->psize == 1) - printf("monochrome\n"); - else - printf("%d color\n", 1 << gm->psize); - - /* Attach grf semantics to the hardware. */ - ga.ga_name = "grf"; - bcopy(gm, &ga.ga_grfmode, sizeof(*gm)); - ga.ga_phys = sc->sc_basepa; - (void)config_found(&sc->sc_dev, &ga, grfbusprint); -} - -int -grfbusprint(aux, name) - void *aux; - const char *name; -{ - struct grfbus_attach_args *ga = aux; - - if (name) - printf("%s at %s", ga->ga_name, name); - - return (UNCONF); -} diff --git a/sys/arch/mac68k/dev/grfvar.h b/sys/arch/mac68k/dev/grfvar.h deleted file mode 100644 index e817914d859..00000000000 --- a/sys/arch/mac68k/dev/grfvar.h +++ /dev/null @@ -1,115 +0,0 @@ -/* $OpenBSD: grfvar.h,v 1.19 2006/01/08 20:35:21 miod Exp $ */ -/* $NetBSD: grfvar.h,v 1.11 1996/08/04 06:03:58 scottr Exp $ */ -/* $NetBSD: grfioctl.h,v 1.5 1995/07/02 05:26:45 briggs Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: grfvar.h 1.9 91/01/21$ - * - * @(#)grfvar.h 7.3 (Berkeley) 5/7/91 - */ - -struct grfmode { - caddr_t fbbase; /* Base of page of frame buffer */ - u_int32_t fbsize; /* Size of frame buffer */ - u_int16_t fboff; /* Offset of frame buffer from base */ - u_int16_t rowbytes; /* Screen rowbytes */ - u_int16_t width; /* Screen width */ - u_int16_t height; /* Screen height */ - u_int16_t psize; /* Screen depth */ -}; - -#define CARD_NAME_LEN 64 - -/* - * State info, per hardware instance. - */ -struct grfbus_softc { - struct device sc_dev; - nubus_slot sc_slot; - - bus_addr_t sc_basepa; /* base of video space */ - bus_addr_t sc_fbofs; /* offset to framebuffer */ - - bus_space_tag_t sc_tag; - bus_space_handle_t sc_handle; - bus_space_handle_t sc_regh; - - u_int32_t card_id; /* DrHW value for nubus cards */ - bus_size_t cli_offset; /* Offset of byte to clear intr */ - /* for cards where that's suff. */ - u_int32_t cli_value; /* Value to write at cli_offset */ -}; - -/* - * Attach grf and ite semantics to Mac video hardware. - */ -struct grfbus_attach_args { - char *ga_name; /* name of semantics to attach */ - struct grfmode ga_grfmode; - bus_addr_t ga_phys; -}; - -/* - * Nubus image data structure. This is the equivalent of a PixMap in - * MacOS programming parlance. One of these structures exists for each - * video mode that a quickdraw compatible card can fit in. - */ -struct image_data { - u_int32_t size; - u_int32_t offset; - u_int16_t rowbytes; - u_int16_t top; - u_int16_t left; - u_int16_t bottom; - u_int16_t right; - u_int16_t version; - u_int16_t packType; - u_int32_t packSize; - u_int32_t hRes; - u_int32_t vRes; - u_int16_t pixelType; - u_int16_t pixelSize; - u_int16_t cmpCount; - u_int16_t cmpSize; - u_int32_t planeBytes; -}; - -#define VID_PARAMS 1 -#define VID_TABLE_OFFSET 2 -#define VID_PAGE_CNT 3 -#define VID_DEV_TYPE 4 - -void grf_establish(struct grfbus_softc *, struct grfmode *); -int grfbusprint(void *, const char *); diff --git a/sys/arch/mac68k/dev/macfb.c b/sys/arch/mac68k/dev/macfb.c index 4624cfe9762..580788718b8 100644 --- a/sys/arch/mac68k/dev/macfb.c +++ b/sys/arch/mac68k/dev/macfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macfb.c,v 1.5 2006/01/08 20:35:21 miod Exp $ */ +/* $OpenBSD: macfb.c,v 1.6 2006/01/09 20:51:48 miod Exp $ */ /* $NetBSD: macfb.c,v 1.11 2005/01/15 16:00:59 chs Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis @@ -40,7 +40,6 @@ #include <machine/bus.h> #include <mac68k/dev/nubus.h> -#include <mac68k/dev/grfvar.h> #include <uvm/uvm_extern.h> @@ -50,13 +49,6 @@ #include <mac68k/dev/macfbvar.h> -int macfb_match(struct device *, void *, void *); -void macfb_attach(struct device *, struct device *, void *); - -struct cfattach macfb_ca = { - sizeof(struct macfb_softc), macfb_match, macfb_attach -}; - struct cfdriver macfb_cd = { NULL, "macfb", DV_DULL }; @@ -94,7 +86,6 @@ extern long videoaddr; extern long videorowbytes; extern long videobitdepth; extern u_long videosize; -extern u_int32_t mac68k_vidlog; extern u_int32_t mac68k_vidphys; extern u_int32_t mac68k_vidlen; @@ -210,31 +201,23 @@ macfb_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr) return (0); } -int -macfb_match(struct device *parent, void *match, void *aux) -{ - return (1); -} - void -macfb_attach(struct device *parent, struct device *self, void *aux) +macfb_attach_common(struct macfb_softc *sc, struct grfmode *gm) { - struct grfbus_attach_args *ga = aux; - struct grfmode *gm = &ga->ga_grfmode; - struct macfb_softc *sc; struct wsemuldisplaydev_attach_args waa; struct wsscreen_descr *scrlist[1]; struct wsscreen_list screenlist; int isconsole; - sc = (struct macfb_softc *)self; - -#ifdef DIAGNOSTIC /* temporary */ - printf(" offset %p", gm->fboff); -#endif - printf("\n"); + /* Print hardware characteristics. */ + printf("%s: %dx%d ", sc->sc_dev.dv_xname, gm->width, gm->height); + if (gm->psize == 1) + printf("monochrome"); + else + printf("%d color", 1 << gm->psize); + printf(" display\n"); - isconsole = macfb_is_console(ga->ga_phys + gm->fboff); + isconsole = macfb_is_console(sc->sc_basepa + gm->fboff); if (isconsole) { sc->sc_dc = &macfb_console_dc; @@ -243,7 +226,7 @@ macfb_attach(struct device *parent, struct device *self, void *aux) sc->sc_dc = malloc(sizeof(struct macfb_devconfig), M_DEVBUF, M_WAITOK); sc->sc_dc->dc_vaddr = (vaddr_t)gm->fbbase; - sc->sc_dc->dc_paddr = ga->ga_phys; + sc->sc_dc->dc_paddr = sc->sc_basepa; sc->sc_dc->dc_size = gm->fbsize; sc->sc_dc->dc_wid = gm->width; @@ -267,10 +250,9 @@ macfb_attach(struct device *parent, struct device *self, void *aux) waa.accessops = &macfb_accessops; waa.accesscookie = sc; - config_found(self, &waa, wsemuldisplaydevprint); + config_found((struct device *)sc, &waa, wsemuldisplaydevprint); } - int macfb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { diff --git a/sys/arch/mac68k/dev/macfbvar.h b/sys/arch/mac68k/dev/macfbvar.h index 7ea6e623503..6589a7bce5c 100644 --- a/sys/arch/mac68k/dev/macfbvar.h +++ b/sys/arch/mac68k/dev/macfbvar.h @@ -1,5 +1,7 @@ -/* $OpenBSD: macfbvar.h,v 1.2 2006/01/08 16:36:54 miod Exp $ */ +/* $OpenBSD: macfbvar.h,v 1.3 2006/01/09 20:51:48 miod Exp $ */ /* $NetBSD: macfbvar.h,v 1.3 2005/01/15 16:00:59 chs Exp $ */ +/* $NetBSD: grfvar.h,v 1.11 1996/08/04 06:03:58 scottr Exp $ */ +/* $NetBSD: grfioctl.h,v 1.5 1995/07/02 05:26:45 briggs Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis * All rights reserved. @@ -29,36 +31,123 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah $Hdr: grfvar.h 1.9 91/01/21$ + * + * @(#)grfvar.h 7.3 (Berkeley) 5/7/91 + */ + +/* + * Nubus image data structure. This is the equivalent of a PixMap in + * MacOS programming parlance. One of these structures exists for each + * video mode that a quickdraw compatible card can fit in. + */ +struct image_data { + u_int32_t size; + u_int32_t offset; + u_int16_t rowbytes; + u_int16_t top; + u_int16_t left; + u_int16_t bottom; + u_int16_t right; + u_int16_t version; + u_int16_t packType; + u_int32_t packSize; + u_int32_t hRes; + u_int32_t vRes; + u_int16_t pixelType; + u_int16_t pixelSize; + u_int16_t cmpCount; + u_int16_t cmpSize; + u_int32_t planeBytes; +}; -#include <dev/rcons/raster.h> -#include <dev/wscons/wscons_raster.h> +#define VID_PARAMS 1 +#define VID_TABLE_OFFSET 2 +#define VID_PAGE_CNT 3 +#define VID_DEV_TYPE 4 -#include <machine/bus.h> +struct grfmode { + caddr_t fbbase; /* Base of page of frame buffer */ + u_int32_t fbsize; /* Size of frame buffer */ + u_int16_t fboff; /* Offset of frame buffer from base */ + u_int16_t rowbytes; /* Screen rowbytes */ + u_int16_t width; /* Screen width */ + u_int16_t height; /* Screen height */ + u_int16_t psize; /* Screen depth */ +}; struct macfb_devconfig { - vaddr_t dc_vaddr; /* memory space virtual base address */ - paddr_t dc_paddr; /* memory space physical base address */ - psize_t dc_size; /* size of slot memory */ + vaddr_t dc_vaddr; /* memory space virtual base address */ + paddr_t dc_paddr; /* memory space physical base address */ + psize_t dc_size; /* size of slot memory */ - int dc_offset; /* offset from dc_vaddr to base of flat fb */ + int dc_offset; /* offset to base of flat fb */ - int dc_wid; /* width of frame buffer */ - int dc_ht; /* height of frame buffer */ - int dc_depth; /* depth of frame buffer */ - int dc_rowbytes; /* bytes in fb scan line */ + int dc_wid; /* width of frame buffer */ + int dc_ht; /* height of frame buffer */ + int dc_depth; /* depth of frame buffer */ + int dc_rowbytes; /* bytes in fb scan line */ /* rasops information */ struct rasops_info dc_ri; /* wsdisplay information */ struct wsscreen_descr wsd; - int nscreens; + int nscreens; }; struct macfb_softc { - struct device sc_dev; + struct device sc_dev; - struct macfb_devconfig *sc_dc; + nubus_slot sc_slot; + + bus_addr_t sc_basepa; /* base of video space */ + bus_addr_t sc_fbofs; /* offset to framebuffer */ + + bus_space_tag_t sc_tag; + bus_space_handle_t sc_handle; + bus_space_handle_t sc_regh; + + u_int32_t card_id; /* DrHW value for nubus cards */ + bus_size_t cli_offset; /* Offset of byte to clear intr */ + /* for cards where that's suff. */ + u_int32_t cli_value; /* Value to write at cli_offset */ + + struct macfb_devconfig *sc_dc; }; +void macfb_attach_common(struct macfb_softc *, struct grfmode *); int macfb_cnattach(paddr_t); |