NetBSD/sys/arch/i386/bios/vesa_text.c
drochner 1719b0ab59 get some more info out of the VESA BIOS and attach subdevices for
8-bit pseudo color and text modes
still doesn't do anything useful
(It would be easy to attach a wsdisplay, but we have to cooperate with the
PCI or ISA attached VGA drivers. There are open issues.)
2002-07-10 19:15:42 +00:00

58 lines
1.2 KiB
C

/* $NetBSD: vesa_text.c,v 1.1 2002/07/10 19:15:43 drochner Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <machine/frame.h>
#include <machine/kvm86.h>
#include <machine/bus.h>
#include <arch/i386/bios/vesabios.h>
#include <arch/i386/bios/vesabiosreg.h>
static int vesatext_match(struct device *, struct cfdata *, void *);
static void vesatext_attach(struct device *, struct device *, void *);
struct vesatextsc {
struct device sc_dev;
int *sc_modes;
int sc_nmodes;
};
struct cfattach vesatext_ca = {
sizeof(struct vesatextsc), vesatext_match, vesatext_attach
};
static int
vesatext_match(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
{
struct vesabiosdev_attach_args *vaa = aux;
if (strcmp(vaa->vbaa_type, "text"))
return (0);
return (1);
}
static void
vesatext_attach(parent, dev, aux)
struct device *parent, *dev;
void *aux;
{
struct vesatextsc *sc = (struct vesatextsc *)dev;
struct vesabiosdev_attach_args *vaa = aux;
int i;
sc->sc_modes = malloc(vaa->vbaa_nmodes * sizeof(int),
M_DEVBUF, M_NOWAIT);
sc->sc_nmodes = vaa->vbaa_nmodes;
for (i = 0; i < vaa->vbaa_nmodes; i++)
sc->sc_modes[i] = vaa->vbaa_modes[i];
printf("\n");
}