diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 52c3f4d6c274..fbfb2a38f12b 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.76 2000/02/25 18:22:39 drochner Exp $ +# $NetBSD: files.pci,v 1.77 2000/03/04 10:27:59 elric Exp $ # # Config file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -140,8 +140,8 @@ device tga: wsemuldisplaydev, wsrasteremulops attach tga at pci file dev/pci/tga.c tga needs-flag file dev/pci/tga_conf.c tga +file dev/ic/bt485.c tga file dev/pci/tga_bt463.c tga -file dev/pci/tga_bt485.c tga # Cirrus Logic CrystalClear PCI Audio CS4280 device clcs: audio, auconv, mulaw, ac97, midibus diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c index 6bb1367fbc6f..b6aac9e3bfb7 100644 --- a/sys/dev/pci/tga.c +++ b/sys/dev/pci/tga.c @@ -1,4 +1,4 @@ -/* $NetBSD: tga.c,v 1.16 2000/01/25 22:30:05 drochner Exp $ */ +/* $NetBSD: tga.c,v 1.17 2000/03/04 10:27:59 elric Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,7 @@ struct cfattach tga_ca = { int tga_identify __P((tga_reg_t *)); const struct tga_conf *tga_getconf __P((int)); void tga_getdevconfig __P((bus_space_tag_t memt, pci_chipset_tag_t pc, - pcitag_t tag, struct tga_devconfig *dc)); + pcitag_t tag, struct tga_devconfig *dc, int tga2)); struct tga_devconfig tga_console_dc; @@ -88,6 +89,17 @@ static int tga_rop_htov __P((struct raster *, int, int, int, int, int, struct raster *, int, int )); static int tga_rop_vtov __P((struct raster *, int, int, int, int, int, struct raster *, int, int )); +void tga2_init __P((struct tga_devconfig *, int)); + +/* RAMDAC interface functions */ +int tga_sched_update __P((void *, void (*)(void *))); +void tga_ramdac_wr __P((void *, u_int, u_int8_t)); +u_int8_t tga_ramdac_rd __P((void *, u_int)); +void tga2_ramdac_wr __P((void *, u_int, u_int8_t)); +u_int8_t tga2_ramdac_rd __P((void *, u_int)); + +/* Interrupt handler */ +int tga_intr __P((void *)); struct wsdisplay_emulops tga_emulops = { rcons_cursor, /* could use hardware cursor; punt */ @@ -137,22 +149,28 @@ tgamatch(parent, match, aux) { struct pci_attach_args *pa = aux; - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_DEC || - PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_DEC_21030) + if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_DEC) return (0); - return (10); + switch (PCI_PRODUCT(pa->pa_id)) { + case PCI_PRODUCT_DEC_21030: + case PCI_PRODUCT_DEC_PBXGB: + return 10; + default: + return 0; + } + return (0); } void -tga_getdevconfig(memt, pc, tag, dc) +tga_getdevconfig(memt, pc, tag, dc, tga2) bus_space_tag_t memt; pci_chipset_tag_t pc; pcitag_t tag; struct tga_devconfig *dc; + int tga2; { const struct tga_conf *tgac; - const struct tga_ramdac_conf *tgar; struct raster *rap; struct rcons *rcp; bus_size_t pcisize; @@ -180,6 +198,7 @@ tga_getdevconfig(memt, pc, tag, dc) dc->dc_regs = (tga_reg_t *)(dc->dc_vaddr + TGA_MEM_CREGS); dc->dc_tga_type = tga_identify(dc->dc_regs); + tgac = dc->dc_tgaconf = tga_getconf(dc->dc_tga_type); if (tgac == NULL) return; @@ -190,7 +209,12 @@ tga_getdevconfig(memt, pc, tag, dc) panic("tga_getdevconfig: memory size mismatch?"); #endif - tgar = tgac->tgac_ramdac; + if (tga2) { + int monitor; + + monitor = (dc->dc_regs[TGA_REG_GREV] >> 16) & 0x0f; + tga2_init(dc, monitor); + } switch (dc->dc_regs[TGA_REG_VHCR] & 0x1ff) { /* XXX */ case 0: @@ -271,6 +295,7 @@ tgaattach(parent, self, aux) struct tga_softc *sc = (struct tga_softc *)self; struct wsemuldisplaydev_attach_args aa; pci_intr_handle_t intrh; + int tga2 = 0; const char *intrstr; u_int8_t rev; int console; @@ -280,6 +305,9 @@ tgaattach(parent, self, aux) #else console = 0; #endif + rev = PCI_REVISION(pa->pa_class); + if ((rev & 0xf0) == 0x20) + tga2 = 1; if (console) { sc->sc_dc = &tga_console_dc; sc->nscreens = 1; @@ -287,7 +315,8 @@ tgaattach(parent, self, aux) sc->sc_dc = (struct tga_devconfig *) malloc(sizeof(struct tga_devconfig), M_DEVBUF, M_WAITOK); bzero(sc->sc_dc, sizeof(struct tga_devconfig)); - tga_getdevconfig(pa->pa_memt, pa->pa_pc, pa->pa_tag, sc->sc_dc); + tga_getdevconfig(pa->pa_memt, pa->pa_pc, pa->pa_tag, + sc->sc_dc, tga2); } if (sc->sc_dc->dc_vaddr == NULL) { printf(": couldn't map memory space; punt!\n"); @@ -296,44 +325,68 @@ tgaattach(parent, self, aux) /* XXX say what's going on. */ intrstr = NULL; - if (sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_intr != NULL) { - if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin, - pa->pa_intrline, &intrh)) { - printf(": couldn't map interrupt"); - return; - } - intrstr = pci_intr_string(pa->pa_pc, intrh); - sc->sc_intr = pci_intr_establish(pa->pa_pc, intrh, IPL_TTY, - sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_intr, sc->sc_dc); - if (sc->sc_intr == NULL) { - printf(": couldn't establish interrupt"); - if (intrstr != NULL) - printf("at %s", intrstr); - printf("\n"); - return; - } + if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin, + pa->pa_intrline, &intrh)) { + printf(": couldn't map interrupt"); + return; + } + intrstr = pci_intr_string(pa->pa_pc, intrh); + sc->sc_intr = pci_intr_establish(pa->pa_pc, intrh, IPL_TTY, tga_intr, + sc->sc_dc); + if (sc->sc_intr == NULL) { + printf(": couldn't establish interrupt"); + if (intrstr != NULL) + printf("at %s", intrstr); + printf("\n"); + return; } - /* - * Initialize the RAMDAC and allocate any private storage it needs. - * Initialization includes disabling cursor, setting a sane - * colormap, etc. - */ - (*sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_init)(sc->sc_dc, 1); - - printf(": DC21030 "); rev = PCI_REVISION(pa->pa_class); switch (rev) { - case 1: case 2: case 3: - printf("step %c", 'A' + rev - 1); + case 0x1: + case 0x2: + case 0x3: + printf(": DC21030 step %c", 'A' + rev - 1); + tga2 = 0; + break; + case 0x20: + printf(": TGA2 abstract software model"); + tga2 = 1; + break; + case 0x21: case 0x22: + printf(": TGA2 pass %d", rev - 0x20); + tga2 = 1; break; default: printf("unknown stepping (0x%x)", rev); + tga2 = 0; break; } printf(", "); + /* + * Get RAMDAC function vectors and call the RAMDAC functions + * to allocate its private storage and pass that back to us. + */ + sc->sc_dc->dc_ramdac_funcs = bt485_funcs(); + if (!tga2) { + sc->sc_dc->dc_ramdac_cookie = bt485_register( + sc->sc_dc, tga_sched_update, tga_ramdac_wr, + tga_ramdac_rd); + } else { + sc->sc_dc->dc_ramdac_cookie = bt485_register( + sc->sc_dc, tga_sched_update, tga2_ramdac_wr, + tga2_ramdac_rd); + } + + /* + * Initialize the RAMDAC. Initialization includes disabling + * cursor, setting a sane colormap, etc. + */ + (*sc->sc_dc->dc_ramdac_funcs->ramdac_init)(sc->sc_dc->dc_ramdac_cookie); + sc->sc_dc->dc_regs[TGA_REG_SISR] = 0x00000001; /* XXX */ + if (sc->sc_dc->dc_tgaconf == NULL) { printf("unknown board configuration\n"); return; @@ -342,7 +395,7 @@ tgaattach(parent, self, aux) printf("%s: %d x %d, %dbpp, %s RAMDAC\n", sc->sc_dev.dv_xname, sc->sc_dc->dc_wid, sc->sc_dc->dc_ht, sc->sc_dc->dc_tgaconf->tgac_phys_depth, - sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_name); + sc->sc_dc->dc_ramdac_funcs->ramdac_name); if (intrstr != NULL) printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, @@ -366,7 +419,8 @@ tga_ioctl(v, cmd, data, flag, p) { struct tga_softc *sc = v; struct tga_devconfig *dc = sc->sc_dc; - const struct tga_ramdac_conf *tgar = dc->dc_tgaconf->tgac_ramdac; + struct ramdac_funcs *dcrf = dc->dc_ramdac_funcs; + struct ramdac_cookie *dcrc = dc->dc_ramdac_cookie; switch (cmd) { case WSDISPLAYIO_GTYPE: @@ -383,11 +437,11 @@ tga_ioctl(v, cmd, data, flag, p) return (0); case WSDISPLAYIO_GETCMAP: - return (*tgar->tgar_get_cmap)(dc, + return (*dcrf->ramdac_get_cmap)(dcrc, (struct wsdisplay_cmap *)data); case WSDISPLAYIO_PUTCMAP: - return (*tgar->tgar_set_cmap)(dc, + return (*dcrf->ramdac_set_cmap)(dcrc, (struct wsdisplay_cmap *)data); case WSDISPLAYIO_SVIDEO: @@ -403,28 +457,55 @@ tga_ioctl(v, cmd, data, flag, p) return (0); case WSDISPLAYIO_GCURPOS: - return (*tgar->tgar_get_curpos)(dc, + return (*dcrf->ramdac_get_curpos)(dcrc, (struct wsdisplay_curpos *)data); case WSDISPLAYIO_SCURPOS: - return (*tgar->tgar_set_curpos)(dc, + return (*dcrf->ramdac_set_curpos)(dcrc, (struct wsdisplay_curpos *)data); case WSDISPLAYIO_GCURMAX: - return (*tgar->tgar_get_curmax)(dc, + return (*dcrf->ramdac_get_curmax)(dcrc, (struct wsdisplay_curpos *)data); case WSDISPLAYIO_GCURSOR: - return (*tgar->tgar_get_cursor)(dc, + return (*dcrf->ramdac_get_cursor)(dcrc, (struct wsdisplay_cursor *)data); case WSDISPLAYIO_SCURSOR: - return (*tgar->tgar_set_cursor)(dc, + return (*dcrf->ramdac_set_cursor)(dcrc, (struct wsdisplay_cursor *)data); } return (-1); } +int +tga_sched_update(v, f) + void *v; + void (*f) __P((void *)); +{ + struct tga_devconfig *dc = v; + + dc->dc_regs[TGA_REG_SISR] = 0x00010000; + dc->dc_ramdac_intr = f; + return 0; +} + +int +tga_intr(v) + void *v; +{ + struct tga_devconfig *dc = v; + struct ramdac_cookie *dcrc= dc->dc_ramdac_cookie; + + if ((dc->dc_regs[TGA_REG_SISR] & 0x00010001) != 0x00010001) + return 0; + dc->dc_ramdac_intr(dcrc); + dc->dc_ramdac_intr = NULL; + dc->dc_regs[TGA_REG_SISR] = 0x00000001; + return (1); +} + int tga_mmap(v, offset, prot) void *v; @@ -502,8 +583,9 @@ tga_cnattach(iot, memt, pc, bus, device, function) struct tga_devconfig *dcp = &tga_console_dc; long defattr; + /* XXX -- we know this isn't a TGA2 for now. rcd */ tga_getdevconfig(memt, pc, - pci_make_tag(pc, bus, device, function), dcp); + pci_make_tag(pc, bus, device, function), dcp, 0); /* sanity checks */ if (dcp->dc_vaddr == NULL) @@ -518,7 +600,12 @@ tga_cnattach(iot, memt, pc, bus, device, function) * Initialization includes disabling cursor, setting a sane * colormap, etc. It will be reinitialized in tgaattach(). */ - (*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0); + + /* XXX -- this only works for bt485, but then we only support that, + * currently. It also doesn't work for TGA2, but we don't yet + * support TGA2 as a console. + */ + bt485_cninit(dcp, tga_sched_update, tga_ramdac_wr, tga_ramdac_rd); rcons_alloc_attr(&dcp->dc_rcons, 0, 0, 0, &defattr); @@ -561,12 +648,13 @@ tga_builtin_set_cursor(dc, cursorp) struct tga_devconfig *dc; struct wsdisplay_cursor *cursorp; { + struct ramdac_funcs *dcrf = dc->dc_ramdac_funcs; + struct ramdac_cookie *dcrc = dc->dc_ramdac_cookie; int count, error, v; v = cursorp->which; if (v & WSDISPLAY_CURSOR_DOCMAP) { - error = (*dc->dc_tgaconf->tgac_ramdac->tgar_check_curcmap)(dc, - cursorp); + error = dcrf->ramdac_check_curcmap(dcrc, cursorp); if (error) return (error); } @@ -595,7 +683,7 @@ tga_builtin_set_cursor(dc, cursorp) } if (v & WSDISPLAY_CURSOR_DOCMAP) { /* can't fail. */ - (*dc->dc_tgaconf->tgac_ramdac->tgar_set_curcmap)(dc, cursorp); + dcrf->ramdac_set_curcmap(dcrc, cursorp); } if (v & WSDISPLAY_CURSOR_DOSHAPE) { count = ((64 * 2) / NBBY) * cursorp->size.y; @@ -614,6 +702,8 @@ tga_builtin_get_cursor(dc, cursorp) struct tga_devconfig *dc; struct wsdisplay_cursor *cursorp; { + struct ramdac_funcs *dcrf = dc->dc_ramdac_funcs; + struct ramdac_cookie *dcrc = dc->dc_ramdac_cookie; int count, error; cursorp->which = WSDISPLAY_CURSOR_DOALL & @@ -633,7 +723,7 @@ tga_builtin_get_cursor(dc, cursorp) return (error); /* No mask */ } - error = (*dc->dc_tgaconf->tgac_ramdac->tgar_get_curcmap)(dc, cursorp); + error = dcrf->ramdac_get_curcmap(dcrc, cursorp); return (error); } @@ -879,3 +969,193 @@ tga_rop_vtov(dst, dx, dy, w, h, rop, src, sx, sy) regs0[TGA_REG_GMOR] = 0x0000; /* Simple mode */ return 0; } + +void +tga_ramdac_wr(v, btreg, val) + void *v; + u_int btreg; + u_int8_t val; +{ + struct tga_devconfig *dc = v; + volatile tga_reg_t *tgaregs = dc->dc_regs; + + if (btreg > BT485_REG_MAX) + panic("tga_ramdac_wr: reg %d out of range\n", btreg); + + tgaregs[TGA_REG_EPDR] = (btreg << 9) | (0 << 8 ) | val; /* XXX */ +#ifdef __alpha__ + alpha_mb(); +#endif +} + +void +tga2_ramdac_wr(v, btreg, val) + void *v; + u_int btreg; + u_int8_t val; +{ + struct tga_devconfig *dc = v; + volatile tga_reg_t *ramdac; + + if (btreg > BT485_REG_MAX) + panic("tga_ramdac_wr: reg %d out of range\n", btreg); + + ramdac = (tga_reg_t *)(dc->dc_vaddr + TGA2_MEM_RAMDAC + + (0xe << 12) + (btreg << 8)); + *ramdac = val & 0xff; +#ifdef __alpha__ + alpha_mb(); +#endif +} + +u_int8_t +tga_ramdac_rd(v, btreg) + void *v; + u_int btreg; +{ + struct tga_devconfig *dc = v; + volatile tga_reg_t *tgaregs = dc->dc_regs; + tga_reg_t rdval; + + if (btreg > BT485_REG_MAX) + panic("tga_ramdac_rd: reg %d out of range\n", btreg); + + tgaregs[TGA_REG_EPSR] = (btreg << 1) | 0x1; /* XXX */ +#ifdef __alpha__ + alpha_mb(); +#endif + + rdval = tgaregs[TGA_REG_EPDR]; + return (rdval >> 16) & 0xff; /* XXX */ +} + +u_int8_t +tga2_ramdac_rd(v, btreg) + void *v; + u_int btreg; +{ + struct tga_devconfig *dc = v; + volatile tga_reg_t *ramdac; + u_int8_t retval; + + if (btreg > BT485_REG_MAX) + panic("tga_ramdac_rd: reg %d out of range\n", btreg); + + ramdac = (tga_reg_t *)(dc->dc_vaddr + TGA2_MEM_RAMDAC + + (0xe << 12) + (btreg << 8)); + retval = (u_int8_t)(*ramdac & 0xff); +#ifdef __alpha__ + alpha_mb(); +#endif + return retval; +} + +#include +void tga2_ics9110_wr __P(( + struct tga_devconfig *dc, + int dotclock +)); + +void +tga2_init(dc, m) + struct tga_devconfig *dc; + int m; +{ + + tga2_ics9110_wr(dc, decmonitors[m].dotclock); + dc->dc_regs[TGA_REG_VHCR] = + ((decmonitors[m].hbp / 4) << 21) | + ((decmonitors[m].hsync / 4) << 14) | +#if 0 + (((decmonitors[m].hfp - 4) / 4) << 9) | + ((decmonitors[m].cols + 4) / 4); +#else + (((decmonitors[m].hfp) / 4) << 9) | + ((decmonitors[m].cols) / 4); +#endif + dc->dc_regs[TGA_REG_VVCR] = + (decmonitors[m].vbp << 22) | + (decmonitors[m].vsync << 16) | + (decmonitors[m].vfp << 11) | + (decmonitors[m].rows); + dc->dc_regs[TGA_REG_VVBR] = 1; alpha_mb(); + dc->dc_regs[TGA_REG_VVVR] |= 1; alpha_mb(); + dc->dc_regs[TGA_REG_GPMR] = 0xffffffff; alpha_mb(); +} + +void +tga2_ics9110_wr(dc, dotclock) + struct tga_devconfig *dc; + int dotclock; +{ + volatile tga_reg_t *clock; + u_int32_t valU; + int N, M, R, V, X; + int i; + + switch (dotclock) { + case 130808000: + N = 0x40; M = 0x7; V = 0x0; X = 0x1; R = 0x1; break; + case 119840000: + N = 0x2d; M = 0x2b; V = 0x1; X = 0x1; R = 0x1; break; + case 108180000: + N = 0x11; M = 0x9; V = 0x1; X = 0x1; R = 0x2; break; + case 103994000: + N = 0x6d; M = 0xf; V = 0x0; X = 0x1; R = 0x1; break; + case 175000000: + N = 0x5F; M = 0x3E; V = 0x1; X = 0x1; R = 0x1; break; + case 75000000: + N = 0x6e; M = 0x15; V = 0x0; X = 0x1; R = 0x1; break; + case 74000000: + N = 0x2a; M = 0x41; V = 0x1; X = 0x1; R = 0x1; break; + case 69000000: + N = 0x35; M = 0xb; V = 0x0; X = 0x1; R = 0x1; break; + case 65000000: + N = 0x6d; M = 0x0c; V = 0x0; X = 0x1; R = 0x2; break; + case 50000000: + N = 0x37; M = 0x3f; V = 0x1; X = 0x1; R = 0x2; break; + case 40000000: + N = 0x5f; M = 0x11; V = 0x0; X = 0x1; R = 0x2; break; + case 31500000: + N = 0x16; M = 0x05; V = 0x0; X = 0x1; R = 0x2; break; + case 25175000: + N = 0x66; M = 0x1d; V = 0x0; X = 0x1; R = 0x2; break; + case 135000000: + N = 0x42; M = 0x07; V = 0x0; X = 0x1; R = 0x1; break; + case 110000000: + N = 0x60; M = 0x32; V = 0x1; X = 0x1; R = 0x2; break; + case 202500000: + N = 0x60; M = 0x32; V = 0x1; X = 0x1; R = 0x2; break; + default: + panic("unrecognized clock rate %d\n", dotclock); + } + + /* XXX -- hard coded, bad */ + valU = N | ( M << 7 ) | (V << 14); + valU |= (X << 15) | (R << 17); + valU |= 0x17 << 19; + + + clock = (tga_reg_t *)(dc->dc_vaddr + TGA2_MEM_EXTDEV + + TGA2_MEM_CLOCK + (0xe << 12)); /* XXX */ + + for (i=24; i>0; i--) { + u_int32_t writeval; + + writeval = valU & 0x1; + if (i == 1) + writeval |= 0x2; + valU >>= 1; + *clock = writeval; +#ifdef __alpha__ + alpha_mb(); +#endif + } + clock = (tga_reg_t *)(dc->dc_vaddr + TGA2_MEM_EXTDEV + + TGA2_MEM_CLOCK + (0xe << 12) + (0x1 << 11)); /* XXX */ + clock += 0x1 << 9; + *clock = 0x0; +#ifdef __alpha__ + alpha_mb(); +#endif +} diff --git a/sys/dev/pci/tga_bt463.c b/sys/dev/pci/tga_bt463.c index c2971cff63af..7cae1fe77f48 100644 --- a/sys/dev/pci/tga_bt463.c +++ b/sys/dev/pci/tga_bt463.c @@ -1,5 +1,6 @@ -/* $NetBSD: tga_bt463.c,v 1.4 1999/04/30 02:47:42 nathanw Exp $ */ +/* $NetBSD: tga_bt463.c,v 1.5 2000/03/04 10:27:59 elric Exp $ */ +#if 0 /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -589,3 +590,4 @@ tga_bt463_update(tag, regs, data) } +#endif diff --git a/sys/dev/pci/tga_bt485.c b/sys/dev/pci/tga_bt485.c deleted file mode 100644 index 5d14295bd432..000000000000 --- a/sys/dev/pci/tga_bt485.c +++ /dev/null @@ -1,604 +0,0 @@ -/* $NetBSD: tga_bt485.c,v 1.4 1999/03/24 05:51:21 mrg Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/* - * Functions exported via the RAMDAC configuration table. - */ -void tga_bt485_init __P((struct tga_devconfig *, int)); -int tga_bt485_intr __P((void *)); -int tga_bt485_set_cmap __P((struct tga_devconfig *, - struct wsdisplay_cmap *)); -int tga_bt485_get_cmap __P((struct tga_devconfig *, - struct wsdisplay_cmap *)); -int tga_bt485_set_cursor __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); -int tga_bt485_get_cursor __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); -int tga_bt485_set_curpos __P((struct tga_devconfig *, - struct wsdisplay_curpos *)); -int tga_bt485_get_curpos __P((struct tga_devconfig *, - struct wsdisplay_curpos *)); -int tga_bt485_get_curmax __P((struct tga_devconfig *, - struct wsdisplay_curpos *)); - -const struct tga_ramdac_conf tga_ramdac_bt485 = { - "Bt485", - tga_bt485_init, - tga_bt485_intr, - tga_bt485_set_cmap, - tga_bt485_get_cmap, - tga_bt485_set_cursor, - tga_bt485_get_cursor, - tga_bt485_set_curpos, - tga_bt485_get_curpos, - tga_bt485_get_curmax, - NULL, /* check_curcmap; not needed */ - NULL, /* set_curcmap; not needed */ - NULL, /* get_curcmap; not needed */ -}; - -/* - * Private data. - */ -struct bt485data { - int changed; /* what changed; see below */ - int curenb; /* cursor enabled */ - struct wsdisplay_curpos curpos; /* current cursor position */ - struct wsdisplay_curpos curhot; /* cursor hotspot */ - char curcmap_r[2]; /* cursor colormap */ - char curcmap_g[2]; - char curcmap_b[2]; - struct wsdisplay_curpos cursize; /* current cursor size */ - char curimage[512]; /* cursor image data */ - char curmask[512]; /* cursor mask data */ - char cmap_r[256]; /* colormap */ - char cmap_g[256]; - char cmap_b[256]; -}; - -#define DATA_ENB_CHANGED 0x01 /* cursor enable changed */ -#define DATA_CURCMAP_CHANGED 0x02 /* cursor colormap changed */ -#define DATA_CURSHAPE_CHANGED 0x04 /* cursor size, image, mask changed */ -#define DATA_CMAP_CHANGED 0x08 /* colormap changed */ -#define DATA_ALL_CHANGED 0x0f - -#define CURSOR_MAX_SIZE 64 - -/* - * Internal functions. - */ -inline void tga_bt485_wr_d __P((volatile tga_reg_t *, u_int, u_int8_t)); -inline u_int8_t tga_bt485_rd_d __P((volatile tga_reg_t *, u_int)); -inline void tga_bt485_wr_i __P((volatile tga_reg_t *, u_int8_t, u_int8_t)); -inline u_int8_t tga_bt485_rd_i __P((volatile tga_reg_t *, u_int8_t)); -void tga_bt485_update __P((struct tga_devconfig *, struct bt485data *)); -void tga_bt485_update_curpos __P((struct tga_devconfig *, struct bt485data *)); - -#define tga_bt485_sched_update(dc) \ - ((dc)->dc_regs[TGA_REG_SISR] = 0x00010000) /* XXX */ - -/*****************************************************************************/ - -/* - * Functions exported via the RAMDAC configuration table. - */ - -void -tga_bt485_init(dc, alloc) - struct tga_devconfig *dc; - int alloc; -{ - u_int8_t regval; - struct bt485data tmp, *data; - int i; - - /* - * Init the BT485 for normal operation. - */ - - /* - * Allow indirect register access. (Actually, this is - * already enabled. In fact, if it is _disabled_, for - * some reason the monitor appears to lose sync!!! (?!?!) - */ - regval = tga_bt485_rd_d(dc->dc_regs, BT485_REG_COMMAND_0); - regval |= 0x80; - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_0, regval); - - /* Set the RAMDAC to 8BPP (no interestion options). */ - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_1, 0x40); - - /* Disable the cursor (for now) */ - regval = tga_bt485_rd_d(dc->dc_regs, BT485_REG_COMMAND_2); - regval &= ~0x03; - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_2, regval); - - /* Use a 64x64x2 cursor */ - regval = tga_bt485_rd_d(dc->dc_regs, BT485_IREG_COMMAND_3); - regval |= 0x04; - tga_bt485_wr_d(dc->dc_regs, BT485_IREG_COMMAND_3, regval); - - /* - * If we should allocate a new private info struct, do so. - * Otherwise, use the one we have (if it's there), or - * use the temporary one on the stack. - */ - if (alloc) { - if (dc->dc_ramdac_private != NULL) - panic("tga_bt485_init: already have private struct"); - dc->dc_ramdac_private = malloc(sizeof *data, M_DEVBUF, - M_WAITOK); - } - if (dc->dc_ramdac_private != NULL) - data = dc->dc_ramdac_private; - else - data = &tmp; - - /* - * Initalize the RAMDAC info struct to hold all of our - * data, and fill it in. - */ - data->changed = DATA_ALL_CHANGED; - - data->curenb = 0; /* cursor disabled */ - data->curpos.x = data->curpos.y = 0; /* right now at 0,0 */ - data->curhot.x = data->curhot.y = 0; /* hot spot at 0,0 */ - - /* initial cursor colormap: 0 is black, 1 is white */ - data->curcmap_r[0] = data->curcmap_g[0] = data->curcmap_b[0] = 0; - data->curcmap_r[1] = data->curcmap_g[1] = data->curcmap_b[1] = 0xff; - - /* initial cursor data: 64x64 block of white. */ - data->cursize.x = data->cursize.y = 64; - for (i = 0; i < 512; i++) - data->curimage[i] = data->curmask[i] = 0xff; - - /* Initial colormap: 0 is black, everything else is white */ - data->cmap_r[0] = data->cmap_g[0] = data->cmap_b[0] = 0; - for (i = 1; i < 256; i++) - data->cmap_r[i] = data->cmap_g[i] = data->cmap_b[i] = 255; - - tga_bt485_update(dc, data); - - dc->dc_regs[TGA_REG_SISR] = 0x00000001; /* XXX */ -} - -int -tga_bt485_set_cmap(dc, cmapp) - struct tga_devconfig *dc; - struct wsdisplay_cmap *cmapp; -{ - struct bt485data *data = dc->dc_ramdac_private; - int count, index, s; - - if ((u_int)cmapp->index >= 256 || - ((u_int)cmapp->index + (u_int)cmapp->count) > 256) - return (EINVAL); - if (!uvm_useracc(cmapp->red, cmapp->count, B_READ) || - !uvm_useracc(cmapp->green, cmapp->count, B_READ) || - !uvm_useracc(cmapp->blue, cmapp->count, B_READ)) - return (EFAULT); - - s = spltty(); - - index = cmapp->index; - count = cmapp->count; - copyin(cmapp->red, &data->cmap_r[index], count); - copyin(cmapp->green, &data->cmap_g[index], count); - copyin(cmapp->blue, &data->cmap_b[index], count); - - data->changed |= DATA_CMAP_CHANGED; - - tga_bt485_sched_update(dc); - splx(s); - - return (0); -} - -int -tga_bt485_get_cmap(dc, cmapp) - struct tga_devconfig *dc; - struct wsdisplay_cmap *cmapp; -{ - struct bt485data *data = dc->dc_ramdac_private; - int error, count, index; - - if ((u_int)cmapp->index >= 256 || - ((u_int)cmapp->index + (u_int)cmapp->count) > 256) - return (EINVAL); - - count = cmapp->count; - index = cmapp->index; - - error = copyout(&data->cmap_r[index], cmapp->red, count); - if (error) - return (error); - error = copyout(&data->cmap_g[index], cmapp->green, count); - if (error) - return (error); - error = copyout(&data->cmap_b[index], cmapp->blue, count); - return (error); -} - -int -tga_bt485_set_cursor(dc, cursorp) - struct tga_devconfig *dc; - struct wsdisplay_cursor *cursorp; -{ - struct bt485data *data = dc->dc_ramdac_private; - int count, index, v, s; - - v = cursorp->which; - - /* - * For DOCMAP and DOSHAPE, verify that parameters are OK - * before we do anything that we can't recover from. - */ - if (v & WSDISPLAY_CURSOR_DOCMAP) { - if ((u_int)cursorp->cmap.index > 2 || - ((u_int)cursorp->cmap.index + - (u_int)cursorp->cmap.count) > 2) - return (EINVAL); - count = cursorp->cmap.count; - if (!uvm_useracc(cursorp->cmap.red, count, B_READ) || - !uvm_useracc(cursorp->cmap.green, count, B_READ) || - !uvm_useracc(cursorp->cmap.blue, count, B_READ)) - return (EFAULT); - } - if (v & WSDISPLAY_CURSOR_DOSHAPE) { - if ((u_int)cursorp->size.x > CURSOR_MAX_SIZE || - (u_int)cursorp->size.y > CURSOR_MAX_SIZE) - return (EINVAL); - count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y; - if (!uvm_useracc(cursorp->image, count, B_READ) || - !uvm_useracc(cursorp->mask, count, B_READ)) - return (EFAULT); - } - - if (v & (WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOCUR)) { - if (v & WSDISPLAY_CURSOR_DOPOS) - data->curpos = cursorp->pos; - if (v & WSDISPLAY_CURSOR_DOCUR) - data->curhot = cursorp->hot; - tga_bt485_update_curpos(dc, data); - } - - s = spltty(); - - /* Parameters are OK; perform the requested operations. */ - if (v & WSDISPLAY_CURSOR_DOCUR) { - data->curenb = cursorp->enable; - data->changed |= DATA_ENB_CHANGED; - } - if (v & WSDISPLAY_CURSOR_DOCMAP) { - count = cursorp->cmap.count; - index = cursorp->cmap.index; - copyin(cursorp->cmap.red, &data->curcmap_r[index], count); - copyin(cursorp->cmap.green, &data->curcmap_g[index], count); - copyin(cursorp->cmap.blue, &data->curcmap_b[index], count); - data->changed |= DATA_CURCMAP_CHANGED; - } - if (v & WSDISPLAY_CURSOR_DOSHAPE) { - data->cursize = cursorp->size; - count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y; - bzero(data->curimage, sizeof data->curimage); - bzero(data->curmask, sizeof data->curmask); - copyin(cursorp->image, data->curimage, count); /* can't fail */ - copyin(cursorp->mask, data->curmask, count); /* can't fail */ - data->changed |= DATA_CURSHAPE_CHANGED; - } - - if (data->changed) - tga_bt485_sched_update(dc); - splx(s); - - return (0); -} - -int -tga_bt485_get_cursor(dc, cursorp) - struct tga_devconfig *dc; - struct wsdisplay_cursor *cursorp; -{ - struct bt485data *data = dc->dc_ramdac_private; - int error, count; - - /* we return everything they want */ - cursorp->which = WSDISPLAY_CURSOR_DOALL; - - cursorp->enable = data->curenb; /* DOCUR */ - cursorp->pos = data->curpos; /* DOPOS */ - cursorp->hot = data->curhot; /* DOHOT */ - - cursorp->cmap.index = 0; /* DOCMAP */ - cursorp->cmap.count = 2; - if (cursorp->cmap.red != NULL) { - error = copyout(data->curcmap_r, cursorp->cmap.red, 2); - if (error) - return (error); - } - if (cursorp->cmap.green != NULL) { - error = copyout(data->curcmap_g, cursorp->cmap.green, 2); - if (error) - return (error); - } - if (cursorp->cmap.blue != NULL) { - error = copyout(data->curcmap_b, cursorp->cmap.blue, 2); - if (error) - return (error); - } - - cursorp->size = data->cursize; /* DOSHAPE */ - if (cursorp->image != NULL) { - count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y; - error = copyout(data->curimage, cursorp->image, count); - if (error) - return (error); - error = copyout(data->curmask, cursorp->mask, count); - if (error) - return (error); - } - - return (0); -} - -int -tga_bt485_set_curpos(dc, curposp) - struct tga_devconfig *dc; - struct wsdisplay_curpos *curposp; -{ - struct bt485data *data = dc->dc_ramdac_private; - - data->curpos = *curposp; - tga_bt485_update_curpos(dc, data); - - return (0); -} - -int -tga_bt485_get_curpos(dc, curposp) - struct tga_devconfig *dc; - struct wsdisplay_curpos *curposp; -{ - struct bt485data *data = dc->dc_ramdac_private; - - *curposp = data->curpos; - return (0); -} - -int -tga_bt485_get_curmax(dc, curposp) - struct tga_devconfig *dc; - struct wsdisplay_curpos *curposp; -{ - - curposp->x = curposp->y = CURSOR_MAX_SIZE; - return (0); -} - -int -tga_bt485_intr(v) - void *v; -{ - struct tga_devconfig *dc = v; - - if ((dc->dc_regs[TGA_REG_SISR] & 0x00010001) != 0x00010001) - return 0; - tga_bt485_update(dc, dc->dc_ramdac_private); - dc->dc_regs[TGA_REG_SISR] = 0x00000001; - return (1); -} - -/*****************************************************************************/ - -/* - * Internal functions. - */ - -inline void -tga_bt485_wr_d(tgaregs, btreg, val) - volatile tga_reg_t *tgaregs; - u_int btreg; - u_int8_t val; -{ - - if (btreg > BT485_REG_MAX) - panic("tga_bt485_wr_d: reg %d out of range\n", btreg); - - tgaregs[TGA_REG_EPDR] = (btreg << 9) | (0 << 8 ) | val; /* XXX */ -#ifdef __alpha__ - alpha_mb(); -#endif -} - -inline u_int8_t -tga_bt485_rd_d(tgaregs, btreg) - volatile tga_reg_t *tgaregs; - u_int btreg; -{ - tga_reg_t rdval; - - if (btreg > BT485_REG_MAX) - panic("tga_bt485_rd_d: reg %d out of range\n", btreg); - - tgaregs[TGA_REG_EPSR] = (btreg << 1) | 0x1; /* XXX */ -#ifdef __alpha__ - alpha_mb(); -#endif - - rdval = tgaregs[TGA_REG_EPDR]; - return (rdval >> 16) & 0xff; /* XXX */ -} - -inline void -tga_bt485_wr_i(tgaregs, ireg, val) - volatile tga_reg_t *tgaregs; - u_int8_t ireg; - u_int8_t val; -{ - tga_bt485_wr_d(tgaregs, BT485_REG_PCRAM_WRADDR, ireg); - tga_bt485_wr_d(tgaregs, BT485_REG_EXTENDED, val); -} - -inline u_int8_t -tga_bt485_rd_i(tgaregs, ireg) - volatile tga_reg_t *tgaregs; - u_int8_t ireg; -{ - tga_bt485_wr_d(tgaregs, BT485_REG_PCRAM_WRADDR, ireg); - return (tga_bt485_rd_d(tgaregs, BT485_REG_EXTENDED)); -} - -void -tga_bt485_update(dc, data) - struct tga_devconfig *dc; - struct bt485data *data; -{ - u_int8_t regval; - int count, i, v; - - v = data->changed; - data->changed = 0; - - if (v & DATA_ENB_CHANGED) { - regval = tga_bt485_rd_d(dc->dc_regs, BT485_REG_COMMAND_2); - if (data->curenb) - regval |= 0x01; - else - regval &= ~0x03; - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_2, regval); - } - - if (v & DATA_CURCMAP_CHANGED) { - /* addr[9:0] assumed to be 0 */ - /* set addr[7:0] to 1 */ - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COC_WRADDR, 0x01); - - /* spit out the cursor data */ - for (i = 0; i < 2; i++) { - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COCDATA, - data->curcmap_r[i]); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COCDATA, - data->curcmap_g[i]); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_COCDATA, - data->curcmap_b[i]); - } - } - - if (v & DATA_CURSHAPE_CHANGED) { - count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y; - - /* - * Write the cursor image data: - * set addr[9:8] to 0, - * set addr[7:0] to 0, - * spit it all out. - */ - regval = tga_bt485_rd_i(dc->dc_regs, - BT485_IREG_COMMAND_3); - regval &= ~0x03; - tga_bt485_wr_i(dc->dc_regs, BT485_IREG_COMMAND_3, - regval); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_PCRAM_WRADDR, 0); - for (i = 0; i < count; i++) - tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_RAM, - data->curimage[i]); - - /* - * Write the cursor mask data: - * set addr[9:8] to 2, - * set addr[7:0] to 0, - * spit it all out. - */ - regval = tga_bt485_rd_i(dc->dc_regs, - BT485_IREG_COMMAND_3); - regval &= ~0x03; regval |= 0x02; - tga_bt485_wr_i(dc->dc_regs, BT485_IREG_COMMAND_3, - regval); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_PCRAM_WRADDR, 0); - for (i = 0; i < count; i++) - tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_RAM, - data->curmask[i]); - - /* set addr[9:0] back to 0 */ - regval = tga_bt485_rd_i(dc->dc_regs, BT485_IREG_COMMAND_3); - regval &= ~0x03; - tga_bt485_wr_i(dc->dc_regs, BT485_IREG_COMMAND_3, regval); - } - - if (v & DATA_CMAP_CHANGED) { - /* addr[9:0] assumed to be 0 */ - /* set addr[7:0] to 0 */ - tga_bt485_wr_d(dc->dc_regs, BT485_REG_PCRAM_WRADDR, 0x00); - - /* spit out the cursor data */ - for (i = 0; i < 256; i++) { - tga_bt485_wr_d(dc->dc_regs, BT485_REG_PALETTE, - data->cmap_r[i]); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_PALETTE, - data->cmap_g[i]); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_PALETTE, - data->cmap_b[i]); - } - } -} - -void -tga_bt485_update_curpos(dc, data) - struct tga_devconfig *dc; - struct bt485data *data; -{ - int s, x, y; - - s = spltty(); - - x = data->curpos.x + CURSOR_MAX_SIZE - data->curhot.x; - y = data->curpos.y + CURSOR_MAX_SIZE - data->curhot.y; - tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_X_LOW, x & 0xff); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_X_HIGH, (x >> 8) & 0x0f); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_Y_LOW, y & 0xff); - tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_Y_HIGH, (y >> 8) & 0x0f); - - splx(s); -} diff --git a/sys/dev/pci/tga_conf.c b/sys/dev/pci/tga_conf.c index 88b5e206dc14..7ba6b24c4502 100644 --- a/sys/dev/pci/tga_conf.c +++ b/sys/dev/pci/tga_conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: tga_conf.c,v 1.1 1998/04/15 20:16:32 drochner Exp $ */ +/* $NetBSD: tga_conf.c,v 1.2 2000/03/04 10:28:00 elric Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -43,7 +43,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T8_01 */ { "T8-01", - &tga_ramdac_bt485, 8, 4 MB, 2 KB, @@ -53,7 +52,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T8_02 */ { "T8-02", - &tga_ramdac_bt485, 8, 4 MB, 4 KB, @@ -63,7 +61,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T8_22 */ { "T8-22", - &tga_ramdac_bt485, 8, 8 MB, 4 KB, @@ -73,7 +70,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T8_44 */ { "T8-44", - &tga_ramdac_bt485, 8, 16 MB, 4 KB, @@ -83,7 +79,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T32_04 */ { "T32-04", - &tga_ramdac_bt463, 32, 16 MB, 8 KB, @@ -93,7 +88,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T32_08 */ { "T32-08", - &tga_ramdac_bt463, 32, 16 MB, 16 KB, @@ -103,7 +97,6 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = { /* TGA_TYPE_T32_88 */ { "T32-88", - &tga_ramdac_bt463, 32, 32 MB, 16 KB, diff --git a/sys/dev/pci/tgareg.h b/sys/dev/pci/tgareg.h index d47033fce826..18f66ebc4c7c 100644 --- a/sys/dev/pci/tgareg.h +++ b/sys/dev/pci/tgareg.h @@ -1,4 +1,4 @@ -/* $NetBSD: tgareg.h,v 1.2 1998/04/29 02:11:19 thorpej Exp $ */ +/* $NetBSD: tgareg.h,v 1.3 2000/03/04 10:28:00 elric Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -43,7 +43,12 @@ */ #define TGA_MEM_ALTROM 0x0000000 /* 0MB -- Alternate ROM space */ +#define TGA2_MEM_EXTDEV 0x0000000 /* 0MB -- External Device Access */ #define TGA_MEM_CREGS 0x0100000 /* 1MB -- Core Registers */ + +#define TGA2_MEM_CLOCK 0x0060000 /* TGA2 Clock access */ +#define TGA2_MEM_RAMDAC 0x0080000 /* TGA2 RAMDAC access */ + /* Display and Back Buffers mapped at config-dependent addresses */ /* @@ -76,7 +81,8 @@ typedef u_int32_t tga_reg_t; #define TGA_REG_GCTR 0x013 /* Continue */ #define TGA_REG_GDER 0x014 /* Deep */ -/* reserved 0x015 */ +#define TGA_REG_GREV 0x015 /* Start/Version on TGA, + * Revision on TGA2 */ #define TGA_REG_GSMR 0x016 /* Stencil Mode */ #define TGA_REG_GPXR_P 0x017 /* Pixel Mask (persistent) */ #define TGA_REG_CCBR 0x018 /* Cursor Base Address */ diff --git a/sys/dev/pci/tgavar.h b/sys/dev/pci/tgavar.h index 59d9b1017af4..54f5822dcb72 100644 --- a/sys/dev/pci/tgavar.h +++ b/sys/dev/pci/tgavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tgavar.h,v 1.4 1998/08/18 08:23:46 thorpej Exp $ */ +/* $NetBSD: tgavar.h,v 1.5 2000/03/04 10:28:00 elric Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -27,6 +27,7 @@ * rights to redistribute these changes. */ +#include #include #include #include @@ -37,39 +38,9 @@ struct fbcmap; struct fbcursor; struct fbcurpos; -struct tga_ramdac_conf { - char *tgar_name; - void (*tgar_init) __P((struct tga_devconfig *, int)); - int (*tgar_intr) __P((void *)); - int (*tgar_set_cmap) __P((struct tga_devconfig *, - struct wsdisplay_cmap *)); - int (*tgar_get_cmap) __P((struct tga_devconfig *, - struct wsdisplay_cmap *)); - int (*tgar_set_cursor) __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); - int (*tgar_get_cursor) __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); - int (*tgar_set_curpos) __P((struct tga_devconfig *, - struct wsdisplay_curpos *)); - int (*tgar_get_curpos) __P((struct tga_devconfig *, - struct wsdisplay_curpos *)); - int (*tgar_get_curmax) __P((struct tga_devconfig *, - struct wsdisplay_curpos *)); - - /* Only called from the TGA built-in cursor handling code. */ - int (*tgar_check_curcmap) __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); - void (*tgar_set_curcmap) __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); - int (*tgar_get_curcmap) __P((struct tga_devconfig *, - struct wsdisplay_cursor *)); -}; - struct tga_conf { char *tgac_name; /* name for this board type */ - const struct tga_ramdac_conf - *tgac_ramdac; /* the RAMDAC type; see above */ int tgac_phys_depth; /* physical frame buffer depth */ vsize_t tgac_cspace_size; /* core space size */ vsize_t tgac_vvbr_units; /* what '1' in the VVBR means */ @@ -95,6 +66,11 @@ struct tga_devconfig { int dc_tga_type; /* the device type; see below */ const struct tga_conf *dc_tgaconf; /* device buffer configuration */ + struct ramdac_funcs + *dc_ramdac_funcs; /* The RAMDAC functions */ + struct ramdac_cookie + *dc_ramdac_cookie; /* the RAMDAC type; see above */ + vaddr_t dc_vaddr; /* memory space virtual base address */ paddr_t dc_paddr; /* memory space physical base address */ @@ -109,6 +85,8 @@ struct tga_devconfig { int dc_blanked; /* currently had video disabled */ void *dc_ramdac_private; /* RAMDAC private storage */ + + void (*dc_ramdac_intr) __P((void *)); }; struct tga_softc { @@ -140,9 +118,6 @@ int tga_cnattach __P((bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t, int tga_identify __P((tga_reg_t *)); const struct tga_conf *tga_getconf __P((int)); -extern const struct tga_ramdac_conf tga_ramdac_bt463; -extern const struct tga_ramdac_conf tga_ramdac_bt485; - int tga_builtin_set_cursor __P((struct tga_devconfig *, struct wsdisplay_cursor *)); int tga_builtin_get_cursor __P((struct tga_devconfig *,