(mostly) update for new PCI and 'bus' interfaces.
This commit is contained in:
parent
b26a595361
commit
be813334f8
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pcivga.c,v 1.5 1996/03/17 01:06:34 thorpej Exp $ */
|
/* $NetBSD: pcivga.c,v 1.6 1996/04/12 04:32:10 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||||
|
@ -36,42 +36,41 @@
|
||||||
#include <machine/autoconf.h>
|
#include <machine/autoconf.h>
|
||||||
#include <machine/pte.h>
|
#include <machine/pte.h>
|
||||||
|
|
||||||
#include <dev/pseudo/ansicons.h>
|
|
||||||
#include <dev/pci/pcireg.h>
|
#include <dev/pci/pcireg.h>
|
||||||
#include <dev/pci/pcivar.h>
|
#include <dev/pci/pcivar.h>
|
||||||
#include <dev/pci/pcidevs.h>
|
#include <dev/pci/pcidevs.h>
|
||||||
|
|
||||||
#include <alpha/pci/pcivgavar.h>
|
#include <alpha/pci/pcivgavar.h>
|
||||||
#include <alpha/pci/wsconsvar.h>
|
#include <alpha/wscons/wsconsvar.h>
|
||||||
|
|
||||||
|
#define PCIVGA_6845_ADDR 0x24
|
||||||
|
#define PCIVGA_6845_DATA 0x25
|
||||||
|
|
||||||
int pcivgamatch __P((struct device *, void *, void *));
|
int pcivgamatch __P((struct device *, void *, void *));
|
||||||
void pcivgaattach __P((struct device *, struct device *, void *));
|
void pcivgaattach __P((struct device *, struct device *, void *));
|
||||||
|
int pcivgaprint __P((void *, char *));
|
||||||
|
|
||||||
struct cfdriver pcivga_ca = {
|
struct cfattach pcivga_ca = {
|
||||||
pcivgamatch, pcivgaattach
|
sizeof(struct pcivga_softc), pcivgamatch, pcivgaattach,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cfdriver pcivga_cd = {
|
struct cfdriver pcivga_cd = {
|
||||||
NULL, "pcivga", DV_DULL, sizeof(struct pcivga_softc)
|
NULL, "pcivga", DV_DULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
void pcivga_getdevconfig __P((__const struct pci_conf_fns *, void *,
|
void pcivga_getdevconfig __P((bus_chipset_tag_t, pci_chipset_tag_t,
|
||||||
__const struct pci_mem_fns *, void *,
|
pcitag_t, struct pcivga_devconfig *dc));
|
||||||
__const struct pci_pio_fns *, void *,
|
|
||||||
pci_conftag_t tag, struct pcivga_devconfig *dc));
|
|
||||||
|
|
||||||
struct pcivga_devconfig pcivga_console_dc;
|
struct pcivga_devconfig pcivga_console_dc;
|
||||||
|
|
||||||
void pcivga_cursor __P((void *, int, int));
|
void pcivga_cursor __P((void *, int, int, int));
|
||||||
void pcivga_putstr __P((void *, int, int, char *, int));
|
void pcivga_putstr __P((void *, int, int, char *, int));
|
||||||
void pcivga_copycols __P((void *, int, int, int,int));
|
void pcivga_copycols __P((void *, int, int, int,int));
|
||||||
void pcivga_erasecols __P((void *, int, int, int));
|
void pcivga_erasecols __P((void *, int, int, int));
|
||||||
void pcivga_copyrows __P((void *, int, int, int));
|
void pcivga_copyrows __P((void *, int, int, int));
|
||||||
void pcivga_eraserows __P((void *, int, int));
|
void pcivga_eraserows __P((void *, int, int));
|
||||||
void pcivga_bell __P((void *)); /* XXX */
|
|
||||||
|
|
||||||
struct ansicons_functions pcivga_acf = {
|
struct wscons_emulfuncs pcivga_emulfuncs = {
|
||||||
pcivga_bell,
|
|
||||||
pcivga_cursor,
|
pcivga_cursor,
|
||||||
pcivga_putstr,
|
pcivga_putstr,
|
||||||
pcivga_copycols,
|
pcivga_copycols,
|
||||||
|
@ -80,7 +79,9 @@ struct ansicons_functions pcivga_acf = {
|
||||||
pcivga_eraserows,
|
pcivga_eraserows,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PCIVGAUNIT(dev) minor(dev)
|
int pcivgaioctl __P((struct device *, u_long, caddr_t, int,
|
||||||
|
struct proc *));
|
||||||
|
int pcivgammap __P((struct device *, off_t, int));
|
||||||
|
|
||||||
int
|
int
|
||||||
pcivgamatch(parent, match, aux)
|
pcivgamatch(parent, match, aux)
|
||||||
|
@ -88,55 +89,71 @@ pcivgamatch(parent, match, aux)
|
||||||
void *match, *aux;
|
void *match, *aux;
|
||||||
{
|
{
|
||||||
struct cfdata *cf = match;
|
struct cfdata *cf = match;
|
||||||
struct pcidev_attach_args *pda = aux;
|
struct pci_attach_args *pa = aux;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's prehistoric/vga or display/vga, we match.
|
* If it's prehistoric/vga or display/vga, we match.
|
||||||
*/
|
*/
|
||||||
if (PCI_CLASS(pda->pda_class) == PCI_CLASS_PREHISTORIC &&
|
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PREHISTORIC &&
|
||||||
PCI_SUBCLASS(pda->pda_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
|
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
|
||||||
return (1);
|
return (1);
|
||||||
if (PCI_CLASS(pda->pda_class) == PCI_CLASS_DISPLAY &&
|
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
|
||||||
PCI_SUBCLASS(pda->pda_class) == PCI_SUBCLASS_DISPLAY_VGA)
|
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pcivga_getdevconfig(pcf, pcfa, pmf, pmfa, ppf, ppfa, tag, dc)
|
pcivga_getdevconfig(bc, pc, tag, dc)
|
||||||
__const struct pci_conf_fns *pcf;
|
bus_chipset_tag_t bc;
|
||||||
__const struct pci_mem_fns *pmf;
|
pci_chipset_tag_t pc;
|
||||||
__const struct pci_pio_fns *ppf;
|
pcitag_t tag;
|
||||||
void *pcfa, *pmfa, *ppfa;
|
|
||||||
pci_conftag_t tag;
|
|
||||||
struct pcivga_devconfig *dc;
|
struct pcivga_devconfig *dc;
|
||||||
{
|
{
|
||||||
|
bus_io_handle_t ioh;
|
||||||
|
int cpos;
|
||||||
|
|
||||||
dc->dc_pcf = pcf;
|
dc->dc_bc = bc;
|
||||||
dc->dc_pcfa = pcfa;
|
dc->dc_pc = pc;
|
||||||
dc->dc_pmf = pmf;
|
|
||||||
dc->dc_pmfa = pmfa;
|
|
||||||
dc->dc_ppf = ppf;
|
|
||||||
dc->dc_ppfa = ppfa;
|
|
||||||
dc->dc_pcitag = tag;
|
dc->dc_pcitag = tag;
|
||||||
|
|
||||||
/* XXX deal with mapping foo */
|
/* XXX deal with mapping foo */
|
||||||
|
|
||||||
/* XXX */
|
if (bus_mem_map(bc, 0xb8000, 0x8000, 0, &dc->dc_memh))
|
||||||
dc->dc_crtat = (u_short *)PCI_MEM_MAP(pmf, pmfa, 0xb8000, 0x8000, 1);
|
panic("pcivga_getdevconfig: couldn't map memory");
|
||||||
dc->dc_iobase = 0x3d4; /* XXX */
|
if (bus_io_map(bc, 0x3b0, 0x30, &ioh))
|
||||||
|
panic("pcivga_getdevconfig: couldn't map io");
|
||||||
|
dc->dc_ioh = ioh;
|
||||||
|
|
||||||
dc->dc_nrow = 25;
|
dc->dc_nrow = 25;
|
||||||
dc->dc_ncol = 80;
|
dc->dc_ncol = 80;
|
||||||
|
|
||||||
dc->dc_ccol = dc->dc_crow = 0;
|
dc->dc_ccol = dc->dc_crow = 0;
|
||||||
|
|
||||||
|
bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 14);
|
||||||
|
cpos = bus_io_read_1(bc, ioh, PCIVGA_6845_DATA) << 8;
|
||||||
|
bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 15);
|
||||||
|
cpos |= bus_io_read_1(bc, ioh, PCIVGA_6845_DATA);
|
||||||
|
|
||||||
|
dc->dc_crow = cpos / dc->dc_ncol;
|
||||||
|
dc->dc_ccol = cpos % dc->dc_ncol;
|
||||||
|
|
||||||
dc->dc_so = 0;
|
dc->dc_so = 0;
|
||||||
|
#if 0
|
||||||
dc->dc_at = 0x00 | 0xf; /* black bg | white fg */
|
dc->dc_at = 0x00 | 0xf; /* black bg | white fg */
|
||||||
dc->dc_so_at = 0x00 | 0xf | 0x80; /* black bg | white fg | blink */
|
dc->dc_so_at = 0x00 | 0xf | 0x80; /* black bg | white fg | blink */
|
||||||
|
|
||||||
/* clear screen, frob cursor, etc.? */
|
/* clear screen, frob cursor, etc.? */
|
||||||
pcivga_eraserows(dc, 0, dc->dc_nrow);
|
pcivga_eraserows(dc, 0, dc->dc_nrow);
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* XXX DEC HAS SWITCHED THE CODES FOR BLUE AND RED!!!
|
||||||
|
* XXX Therefore, though the comments say "blue bg", the code uses
|
||||||
|
* XXX the value for a red background!
|
||||||
|
*/
|
||||||
|
dc->dc_at = 0x40 | 0x0f; /* blue bg | white fg */
|
||||||
|
dc->dc_so_at = 0x40 | 0x0f | 0x80; /* blue bg | white fg | blink */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -144,29 +161,26 @@ pcivgaattach(parent, self, aux)
|
||||||
struct device *parent, *self;
|
struct device *parent, *self;
|
||||||
void *aux;
|
void *aux;
|
||||||
{
|
{
|
||||||
struct pcidev_attach_args *pda = aux;
|
struct pci_attach_args *pa = aux;
|
||||||
struct pcivga_softc *sc = (struct pcivga_softc *)self;
|
struct pcivga_softc *sc = (struct pcivga_softc *)self;
|
||||||
|
struct wscons_attach_args waa;
|
||||||
|
struct wscons_odev_spec *wo;
|
||||||
char devinfo[256];
|
char devinfo[256];
|
||||||
int console;
|
int console;
|
||||||
|
|
||||||
console = (pda->pda_tag == pcivga_console_dc.dc_pcitag);
|
console = (pa->pa_tag == pcivga_console_dc.dc_pcitag);
|
||||||
if (console)
|
if (console)
|
||||||
sc->sc_dc = &pcivga_console_dc;
|
sc->sc_dc = &pcivga_console_dc;
|
||||||
else {
|
else {
|
||||||
sc->sc_dc = (struct pcivga_devconfig *)
|
sc->sc_dc = (struct pcivga_devconfig *)
|
||||||
malloc(sizeof(struct pcivga_devconfig), M_DEVBUF, M_WAITOK);
|
malloc(sizeof(struct pcivga_devconfig), M_DEVBUF, M_WAITOK);
|
||||||
pcivga_getdevconfig(pda->pda_conffns, pda->pda_confarg,
|
pcivga_getdevconfig(pa->pa_bc, pa->pa_pc, pa->pa_tag,
|
||||||
pda->pda_memfns, pda->pda_memarg, pda->pda_piofns,
|
sc->sc_dc);
|
||||||
pda->pda_memarg, pda->pda_tag, sc->sc_dc);
|
|
||||||
}
|
|
||||||
if (sc->sc_dc->dc_crtat == NULL) {
|
|
||||||
printf(": couldn't map memory space; punt!\n");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_devinfo(pda->pda_id, pda->pda_class, 0, devinfo);
|
pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
|
||||||
printf(": %s (rev. 0x%02x)\n", devinfo,
|
printf(": %s (rev. 0x%02x)\n", devinfo,
|
||||||
PCI_REVISION(pda->pda_class));
|
PCI_REVISION(pa->pa_class));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (sc->sc_dc->dc_tgaconf == NULL) {
|
if (sc->sc_dc->dc_tgaconf == NULL) {
|
||||||
|
@ -190,86 +204,113 @@ pcivgaattach(parent, self, aux)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!wscattach_output(self, console, &sc->sc_dc->dc_ansicons,
|
waa.waa_isconsole = console;
|
||||||
&pcivga_acf, sc->sc_dc, sc->sc_dc->dc_nrow, sc->sc_dc->dc_ncol,
|
wo = &waa.waa_odev_spec;
|
||||||
0, 0)) {
|
wo->wo_ef = &pcivga_emulfuncs;
|
||||||
panic("pcivgaattach: wscattach failed");
|
wo->wo_efa = sc->sc_dc;
|
||||||
/* NOTREACHED */
|
wo->wo_nrows = sc->sc_dc->dc_nrow;
|
||||||
}
|
wo->wo_ncols = sc->sc_dc->dc_ncol;
|
||||||
|
wo->wo_crow = sc->sc_dc->dc_crow;
|
||||||
|
wo->wo_ccol = sc->sc_dc->dc_ccol;
|
||||||
|
wo->wo_ioctl = pcivgaioctl;
|
||||||
|
wo->wo_mmap = pcivgammap;
|
||||||
|
|
||||||
|
config_found(self, &waa, pcivgaprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
int
|
int
|
||||||
tgammap(dev, offset, nprot)
|
pcivgaprint(aux, pnp)
|
||||||
dev_t dev;
|
void *aux;
|
||||||
int offset;
|
char *pnp;
|
||||||
int nprot;
|
|
||||||
{
|
{
|
||||||
struct pcivga_softc *sc = pcivga_cd.cd_devs[TGAUNIT(dev)];
|
|
||||||
|
|
||||||
if (offset > sc->sc_dc->dc_pcivgaconf->pcivgac_cspace_size)
|
if (pnp)
|
||||||
return -1;
|
printf("wscons at %s", pnp);
|
||||||
return alpha_btop(sc->sc_dc->dc_paddr + offset);
|
return (UNCONF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
pcivgaioctl(dev, cmd, data, flag, p)
|
||||||
|
struct device *dev;
|
||||||
|
u_long cmd;
|
||||||
|
caddr_t data;
|
||||||
|
int flag;
|
||||||
|
struct proc *p;
|
||||||
|
{
|
||||||
|
|
||||||
|
return -1; /* XXX */
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
pcivgammap(dev, offset, prot)
|
||||||
|
struct device *dev;
|
||||||
|
off_t offset;
|
||||||
|
int prot;
|
||||||
|
{
|
||||||
|
struct pcivga_softc *sc = (struct pcivga_softc *)dev;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
rv = -1;
|
||||||
|
#if 0 /* XXX */
|
||||||
|
if (offset >= 0 && offset < 0x100000) { /* 1MB */
|
||||||
|
/* Deal with mapping the VGA memory */
|
||||||
|
if (offset >= 0xb8000 && offset < 0xc0000) {
|
||||||
|
offset -= 0xb8000;
|
||||||
|
rv = alpha_btop(k0segtophys(sc->sc_dc->dc_crtat) +
|
||||||
|
offset);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* XXX should do something with PCI memory */
|
||||||
|
rv = -1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pcivga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus, device, function)
|
pcivga_console(bc, pc, bus, device, function)
|
||||||
__const struct pci_conf_fns *pcf;
|
bus_chipset_tag_t bc;
|
||||||
__const struct pci_mem_fns *pmf;
|
pci_chipset_tag_t pc;
|
||||||
__const struct pci_pio_fns *ppf;
|
int bus, device, function;
|
||||||
void *pcfa, *pmfa, *ppfa;
|
|
||||||
pci_bus_t bus;
|
|
||||||
pci_device_t device;
|
|
||||||
pci_function_t function;
|
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dcp = &pcivga_console_dc;
|
struct pcivga_devconfig *dcp = &pcivga_console_dc;
|
||||||
|
struct wscons_odev_spec wo;
|
||||||
|
|
||||||
pcivga_getdevconfig(pcf, pcfa, pmf, pmfa, ppf, ppfa,
|
pcivga_getdevconfig(bc, pc,
|
||||||
PCI_MAKE_TAG(bus, device, function), dcp);
|
pci_make_tag(pc, bus, device, function), dcp);
|
||||||
|
|
||||||
/* sanity checks */
|
wo.wo_ef = &pcivga_emulfuncs;
|
||||||
if (dcp->dc_crtat == NULL)
|
wo.wo_efa = dcp;
|
||||||
panic("pcivga_console(%d, %d): couldn't map memory space",
|
wo.wo_nrows = dcp->dc_nrow;
|
||||||
device, function);
|
wo.wo_ncols = dcp->dc_ncol;
|
||||||
#if 0
|
wo.wo_crow = dcp->dc_crow;
|
||||||
if (dcp->dc_pcivgaconf == NULL)
|
wo.wo_ccol = dcp->dc_ccol;
|
||||||
panic("pcivga_console(%d, %d): unknown board configuration",
|
/* ioctl and mmap are unused until real attachment. */
|
||||||
device, function);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wsc_console(&dcp->dc_ansicons, &pcivga_acf, dcp,
|
wscons_attach_console(&wo);
|
||||||
dcp->dc_nrow, dcp->dc_ncol, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following functions implement the MI ANSI terminal emulation on
|
* The following functions implement the MI ANSI terminal emulation on
|
||||||
* a VGA display.
|
* a VGA display.
|
||||||
*/
|
*/
|
||||||
void /* XXX */
|
|
||||||
pcivga_bell(id) /* XXX */
|
|
||||||
void *id; /* XXX */
|
|
||||||
{ /* XXX */
|
|
||||||
/* XXX */
|
|
||||||
printf("pcivga_bell: unimplemented\n"); /* XXX */
|
|
||||||
} /* XXX */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pcivga_cursor(id, row, col)
|
pcivga_cursor(id, on, row, col)
|
||||||
void *id;
|
void *id;
|
||||||
int row, col;
|
int on, row, col;
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dc = id;
|
struct pcivga_devconfig *dc = id;
|
||||||
|
bus_chipset_tag_t bc = dc->dc_bc;
|
||||||
|
bus_io_handle_t ioh = dc->dc_ioh;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("pcivga_cursor: %d %d\n", row, col);
|
printf("pcivga_cursor: %d %d\n", row, col);
|
||||||
#endif
|
#endif
|
||||||
/* turn the cursor off */
|
/* turn the cursor off */
|
||||||
if (row == -1 || col == -1) {
|
if (!on) {
|
||||||
dc->dc_crow = dc->dc_ccol = PCIVGA_CURSOR_OFF;
|
/* XXX disable cursor how??? */
|
||||||
|
dc->dc_crow = dc->dc_ccol = -1;
|
||||||
/* XXX disable cursor??? */
|
|
||||||
} else {
|
} else {
|
||||||
dc->dc_crow = row;
|
dc->dc_crow = row;
|
||||||
dc->dc_ccol = col;
|
dc->dc_ccol = col;
|
||||||
|
@ -277,10 +318,10 @@ pcivga_cursor(id, row, col)
|
||||||
|
|
||||||
pos = row * dc->dc_ncol + col;
|
pos = row * dc->dc_ncol + col;
|
||||||
|
|
||||||
OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase, 14);
|
bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 14);
|
||||||
OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase+1, pos >> 8);
|
bus_io_write_1(bc, ioh, PCIVGA_6845_DATA, pos >> 8);
|
||||||
OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase, 15);
|
bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 15);
|
||||||
OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase+1, pos);
|
bus_io_write_1(bc, ioh, PCIVGA_6845_DATA, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -291,20 +332,16 @@ pcivga_putstr(id, row, col, cp, len)
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dc = id;
|
struct pcivga_devconfig *dc = id;
|
||||||
|
bus_chipset_tag_t bc = dc->dc_bc;
|
||||||
|
bus_mem_handle_t memh = dc->dc_memh;
|
||||||
char *dcp;
|
char *dcp;
|
||||||
int i;
|
int i, off;
|
||||||
|
|
||||||
for (i = 0; i < len; i++, cp++) {
|
off = (row * dc->dc_ncol + col) * 2;
|
||||||
dcp = (char *)&dc->dc_crtat[row * dc->dc_ncol + col];
|
for (i = 0; i < len; i++, cp++, off += 2) {
|
||||||
#if 0
|
bus_mem_write_1(bc, memh, off, *cp);
|
||||||
printf("*cp = %c, attr = 0x%x\n", *cp, dc->dc_so ? dc->dc_so_at : dc->dc_at);
|
bus_mem_write_1(bc, memh, off+1,
|
||||||
printf("was: %c/", *dcp);
|
dc->dc_so ? dc->dc_so_at : dc->dc_at);
|
||||||
#endif
|
|
||||||
*dcp++ = *cp;
|
|
||||||
#if 0
|
|
||||||
printf("0x%x\n", *dcp);
|
|
||||||
#endif
|
|
||||||
*dcp++ = dc->dc_so ? dc->dc_so_at : dc->dc_at;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,16 +351,20 @@ pcivga_copycols(id, row, srccol, dstcol, ncols)
|
||||||
int row, srccol, dstcol, ncols;
|
int row, srccol, dstcol, ncols;
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dc = id;
|
struct pcivga_devconfig *dc = id;
|
||||||
u_short *ssp, *dsp;
|
bus_chipset_tag_t bc = dc->dc_bc;
|
||||||
int nclr;
|
bus_mem_handle_t memh = dc->dc_memh;
|
||||||
|
bus_mem_size_t srcoff, srcend, dstoff;
|
||||||
|
|
||||||
#if 0
|
/*
|
||||||
printf("pcivga_copycols: row %d: %d, %d -> %d\n", row, srccol, ncols,
|
* YUCK. Need bus copy functions.
|
||||||
dstcol);
|
*/
|
||||||
#endif
|
srcoff = (row * dc->dc_ncol + srccol) * 2;
|
||||||
ssp = &dc->dc_crtat[row * dc->dc_ncol + srccol];
|
srcend = srcoff + ncols * 2;
|
||||||
dsp = &dc->dc_crtat[row * dc->dc_ncol + dstcol];
|
dstoff = (row * dc->dc_ncol + dstcol) * 2;
|
||||||
bcopy(ssp, dsp, ncols * sizeof(u_short));
|
|
||||||
|
for (; srcoff < srcend; srcoff += 2, dstoff += 2)
|
||||||
|
bus_mem_write_2(bc, memh, dstoff,
|
||||||
|
bus_mem_read_2(bc, memh, srcoff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -332,15 +373,20 @@ pcivga_erasecols(id, row, startcol, ncols)
|
||||||
int row, startcol, ncols;
|
int row, startcol, ncols;
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dc = id;
|
struct pcivga_devconfig *dc = id;
|
||||||
u_short *ssp;
|
bus_chipset_tag_t bc = dc->dc_bc;
|
||||||
int i;
|
bus_mem_handle_t memh = dc->dc_memh;
|
||||||
|
bus_mem_size_t off, endoff;
|
||||||
|
u_int16_t val;
|
||||||
|
|
||||||
#if 0
|
/*
|
||||||
printf("pcivga_erasecols: row %d: %d, %d\n", row, startcol, ncols);
|
* YUCK. Need bus 'set' functions.
|
||||||
#endif
|
*/
|
||||||
ssp = &dc->dc_crtat[row * dc->dc_ncol + startcol];
|
off = row * dc->dc_ncol + startcol;
|
||||||
for (i = 0; i < ncols; i++)
|
endoff = off + ncols * 2;
|
||||||
*ssp++ = (dc->dc_at << 8) | ' ';
|
val = (dc->dc_at << 8) | ' ';
|
||||||
|
|
||||||
|
for (; off < endoff; off += 2)
|
||||||
|
bus_mem_write_2(bc, memh, off, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -349,15 +395,20 @@ pcivga_copyrows(id, srcrow, dstrow, nrows)
|
||||||
int srcrow, dstrow, nrows;
|
int srcrow, dstrow, nrows;
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dc = id;
|
struct pcivga_devconfig *dc = id;
|
||||||
u_short *ssp, *dsp;
|
bus_chipset_tag_t bc = dc->dc_bc;
|
||||||
int nclr;
|
bus_mem_handle_t memh = dc->dc_memh;
|
||||||
|
bus_mem_size_t srcoff, srcend, dstoff;
|
||||||
|
|
||||||
#if 0
|
/*
|
||||||
printf("pcivga_copyrows: %d, %d -> %d\n", srcrow, nrows, dstrow);
|
* YUCK. Need bus copy functions.
|
||||||
#endif
|
*/
|
||||||
ssp = &dc->dc_crtat[srcrow * dc->dc_ncol + 0];
|
srcoff = (srcrow * dc->dc_ncol + 0) * 2;
|
||||||
dsp = &dc->dc_crtat[dstrow * dc->dc_ncol + 0];
|
srcend = srcoff + (nrows * dc->dc_ncol * 2);
|
||||||
bcopy(ssp, dsp, nrows * dc->dc_ncol * sizeof(u_short));
|
dstoff = (dstrow * dc->dc_ncol + 0) * 2;
|
||||||
|
|
||||||
|
for (; srcoff < srcend; srcoff += 2, dstoff += 2)
|
||||||
|
bus_mem_write_2(bc, memh, dstoff,
|
||||||
|
bus_mem_read_2(bc, memh, srcoff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -366,13 +417,18 @@ pcivga_eraserows(id, startrow, nrows)
|
||||||
int startrow, nrows;
|
int startrow, nrows;
|
||||||
{
|
{
|
||||||
struct pcivga_devconfig *dc = id;
|
struct pcivga_devconfig *dc = id;
|
||||||
u_short *ssp;
|
bus_chipset_tag_t bc = dc->dc_bc;
|
||||||
int i;
|
bus_mem_handle_t memh = dc->dc_memh;
|
||||||
|
bus_mem_size_t off, endoff;
|
||||||
|
u_int16_t val;
|
||||||
|
|
||||||
#if 0
|
/*
|
||||||
printf("pcivga_eraserows: %d, %d\n", startrow, nrows);
|
* YUCK. Need bus 'set' functions.
|
||||||
#endif
|
*/
|
||||||
ssp = &dc->dc_crtat[startrow * dc->dc_ncol + 0];
|
off = (startrow * dc->dc_ncol + 0) * 2;
|
||||||
for (i = 0; i < nrows * dc->dc_ncol; i++)
|
endoff = off + (nrows * dc->dc_ncol) * 2;
|
||||||
*ssp++ = (dc->dc_at << 8) | ' ';
|
val = (dc->dc_at << 8) | ' ';
|
||||||
|
|
||||||
|
for (; off < endoff; off += 2)
|
||||||
|
bus_mem_write_2(bc, memh, off, val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pcivgavar.h,v 1.3 1995/11/23 02:38:13 cgd Exp $ */
|
/* $NetBSD: pcivgavar.h,v 1.4 1996/04/12 04:32:12 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||||
|
@ -27,20 +27,14 @@
|
||||||
* rights to redistribute these changes.
|
* rights to redistribute these changes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dev/pseudo/ansicons.h>
|
|
||||||
|
|
||||||
struct pcivga_devconfig {
|
struct pcivga_devconfig {
|
||||||
__const struct pci_conf_fns *dc_pcf;
|
bus_chipset_tag_t dc_bc;
|
||||||
void *dc_pcfa;
|
pci_chipset_tag_t dc_pc;
|
||||||
__const struct pci_mem_fns *dc_pmf;
|
|
||||||
void *dc_pmfa;
|
|
||||||
__const struct pci_pio_fns *dc_ppf;
|
|
||||||
void *dc_ppfa;
|
|
||||||
|
|
||||||
pci_tag_t dc_pcitag; /* PCI tag */
|
pcitag_t dc_pcitag; /* PCI tag */
|
||||||
|
|
||||||
u_int16_t *dc_crtat; /* VGA screen memory */
|
bus_io_handle_t dc_ioh;
|
||||||
int dc_iobase; /* VGA I/O address */
|
bus_mem_handle_t dc_memh;
|
||||||
|
|
||||||
int dc_ncol, dc_nrow; /* screen width & height */
|
int dc_ncol, dc_nrow; /* screen width & height */
|
||||||
int dc_ccol, dc_crow; /* current cursor position */
|
int dc_ccol, dc_crow; /* current cursor position */
|
||||||
|
@ -48,8 +42,6 @@ struct pcivga_devconfig {
|
||||||
char dc_so; /* in standout mode? */
|
char dc_so; /* in standout mode? */
|
||||||
char dc_at; /* normal attributes */
|
char dc_at; /* normal attributes */
|
||||||
char dc_so_at; /* standout attributes */
|
char dc_so_at; /* standout attributes */
|
||||||
|
|
||||||
struct ansicons dc_ansicons; /* ansi console emulator info XXX */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pcivga_softc {
|
struct pcivga_softc {
|
||||||
|
@ -59,15 +51,11 @@ struct pcivga_softc {
|
||||||
void *sc_intr; /* interrupt handler info */
|
void *sc_intr; /* interrupt handler info */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PCIVGA_CURSOR_OFF -1 /* pass to pcivga_cpos to disable */
|
|
||||||
|
|
||||||
#define DEVICE_IS_PCIVGA(class, id) \
|
#define DEVICE_IS_PCIVGA(class, id) \
|
||||||
((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
|
(((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
|
||||||
PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
|
PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
|
||||||
(PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
|
(PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
|
||||||
PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA))
|
PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
|
||||||
|
|
||||||
void pcivga_console __P((__const struct pci_conf_fns *, void *,
|
void pcivga_console __P((bus_chipset_tag_t, pci_chipset_tag_t, int, int,
|
||||||
__const struct pci_mem_fns *, void *,
|
int));
|
||||||
__const struct pci_pio_fns *, void *,
|
|
||||||
pci_bus_t, pci_device_t, pci_function_t));
|
|
||||||
|
|
Loading…
Reference in New Issue