Store the PA of the framebuffer in the softc. This eliminates the need
for the sc_phys callback; we can just store the PA in the grfbus attach args, rather than a function pointer, which simplifies the code nicely.
This commit is contained in:
parent
7022024d4a
commit
da2f2cb79f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf.c,v 1.52 1998/05/02 16:45:28 scottr Exp $ */
|
||||
/* $NetBSD: grf.c,v 1.53 1998/06/02 02:14:20 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -136,8 +136,8 @@ grfattach(parent, self, aux)
|
|||
sc->sc_slot = ga->ga_slot;
|
||||
sc->sc_tag = ga->ga_tag;
|
||||
sc->sc_handle = ga->ga_handle;
|
||||
sc->sc_mode = ga->ga_mode;
|
||||
sc->sc_phys = ga->ga_phys;
|
||||
sc->sc_mode = ga->ga_mode;
|
||||
|
||||
sc->sc_flags = GF_ALIVE; /* XXX bogus */
|
||||
|
||||
|
@ -295,7 +295,7 @@ grfmmap(dev, off, prot)
|
|||
#endif
|
||||
|
||||
if (off < m68k_round_page(gm->fbsize + gm->fboff))
|
||||
addr = m68k_btop((*gp->sc_phys)(gp) + off);
|
||||
addr = m68k_btop(gp->sc_phys + off);
|
||||
else
|
||||
addr = (-1); /* XXX bogus */
|
||||
|
||||
|
@ -365,9 +365,8 @@ grfmap(dev, addrp, p)
|
|||
printf("grfmap(%d): addr %p\n", p->p_pid, *addrp);
|
||||
#endif
|
||||
|
||||
*addrp = (*gp->sc_phys)(gp);
|
||||
ofs = (u_long)*addrp & PGOFSET;
|
||||
*addrp = (caddr_t)m68k_trunc_page(*addrp);
|
||||
*addrp = (caddr_t)m68k_trunc_page(gp->sc_phys);
|
||||
ofs = (u_long)gp->sc_phys & PGOFSET;
|
||||
len = m68k_round_page(ofs + gm->fboff + gm->fbsize);
|
||||
flags = MAP_SHARED | MAP_FIXED;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_subr.c,v 1.11 1998/05/02 16:45:28 scottr Exp $ */
|
||||
/* $NetBSD: grf_subr.c,v 1.12 1998/06/02 02:14:21 scottr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -47,11 +47,10 @@
|
|||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
void
|
||||
grf_establish(sc, sp, g_mode, g_phys)
|
||||
grf_establish(sc, sp, g_mode)
|
||||
struct grfbus_softc *sc;
|
||||
nubus_slot *sp;
|
||||
int (*g_mode) __P((struct grf_softc *, int, void *));
|
||||
caddr_t (*g_phys) __P((struct grf_softc *));
|
||||
{
|
||||
struct grfmode *gm = &sc->curr_mode;
|
||||
struct grfbus_attach_args ga;
|
||||
|
@ -69,8 +68,8 @@ grf_establish(sc, sp, g_mode, g_phys)
|
|||
ga.ga_slot = sp;
|
||||
ga.ga_tag = sc->sc_tag;
|
||||
ga.ga_handle = sc->sc_handle;
|
||||
ga.ga_phys = sc->sc_bufpa;
|
||||
ga.ga_mode = g_mode;
|
||||
ga.ga_phys = g_phys;
|
||||
(void)config_found(&sc->sc_dev, &ga, grfbusprint);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grfvar.h,v 1.20 1997/08/03 07:17:31 scottr Exp $ */
|
||||
/* $NetBSD: grfvar.h,v 1.21 1998/06/02 02:14:21 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -51,6 +51,8 @@ struct grfbus_softc {
|
|||
struct device sc_dev;
|
||||
nubus_slot sc_slot;
|
||||
|
||||
caddr_t sc_bufpa;
|
||||
|
||||
bus_space_tag_t sc_tag;
|
||||
bus_space_handle_t sc_handle;
|
||||
bus_space_handle_t sc_regh;
|
||||
|
@ -74,13 +76,13 @@ struct grf_softc {
|
|||
bus_space_handle_t sc_handle;
|
||||
|
||||
int sc_flags; /* driver flags */
|
||||
caddr_t sc_phys; /* PA of framebuffer */
|
||||
|
||||
struct grfmode *sc_grfmode; /* forwarded ... */
|
||||
nubus_slot *sc_slot;
|
||||
/* mode-change on/off/mode function */
|
||||
int (*sc_mode) __P((struct grf_softc *, int, void *));
|
||||
/* find framebuffer physical addr */
|
||||
caddr_t (*sc_phys) __P((struct grf_softc *));
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -92,8 +94,8 @@ struct grfbus_attach_args {
|
|||
bus_space_handle_t ga_handle;
|
||||
struct grfmode *ga_grfmode;
|
||||
nubus_slot *ga_slot;
|
||||
caddr_t ga_phys;
|
||||
int (*ga_mode) __P((struct grf_softc *, int, void *));
|
||||
caddr_t (*ga_phys) __P((struct grf_softc *));
|
||||
};
|
||||
|
||||
typedef caddr_t (*grf_phys_t) __P((struct grf_softc *gp, vm_offset_t addr));
|
||||
|
@ -158,6 +160,5 @@ int grfmap __P((dev_t dev, caddr_t *addrp, struct proc *p));
|
|||
int grfunmap __P((dev_t dev, caddr_t addr, struct proc *p));
|
||||
|
||||
void grf_establish __P((struct grfbus_softc *, nubus_slot *,
|
||||
int (*)(struct grf_softc *, int, void *),
|
||||
caddr_t (*)(struct grf_softc *)));
|
||||
int (*)(struct grf_softc *, int, void *)));
|
||||
int grfbusprint __P((void *, const char *));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_nubus.c,v 1.45 1998/05/23 22:08:41 briggs Exp $ */
|
||||
/* $NetBSD: grf_nubus.c,v 1.46 1998/06/02 02:14:21 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Allen Briggs. All rights reserved.
|
||||
|
@ -68,7 +68,6 @@ static void grfmv_intr_formac __P((void *vsc));
|
|||
static void grfmv_intr_vimage __P((void *vsc));
|
||||
|
||||
static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
|
||||
static caddr_t grfmv_phys __P((struct grf_softc *gp));
|
||||
static int grfmv_match __P((struct device *, struct cfdata *, void *));
|
||||
static void grfmv_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
|
@ -142,13 +141,14 @@ grfmv_attach(parent, self, aux)
|
|||
nubus_dir dir, mode_dir;
|
||||
int mode;
|
||||
|
||||
sc->sc_tag = na->na_tag;
|
||||
sc->card_id = na->drhw;
|
||||
|
||||
bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
|
||||
|
||||
if (bus_space_map(sc->sc_tag,
|
||||
NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &sc->sc_handle)) {
|
||||
sc->sc_tag = na->na_tag;
|
||||
sc->card_id = na->drhw;
|
||||
sc->sc_bufpa = (caddr_t)NUBUS_SLOT2PA(na->slot);
|
||||
|
||||
if (bus_space_map(sc->sc_tag, (bus_addr_t)sc->sc_bufpa, NBMEMSIZE,
|
||||
0, &sc->sc_handle)) {
|
||||
printf(": grfmv_attach: failed to map slot %d\n", na->slot);
|
||||
return;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ bad:
|
|||
}
|
||||
|
||||
/* Perform common video attachment. */
|
||||
grf_establish(sc, &sc->sc_slot, grfmv_mode, grfmv_phys);
|
||||
grf_establish(sc, &sc->sc_slot, grfmv_mode);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -342,13 +342,6 @@ grfmv_mode(gp, cmd, arg)
|
|||
return EINVAL;
|
||||
}
|
||||
|
||||
static caddr_t
|
||||
grfmv_phys(gp)
|
||||
struct grf_softc *gp;
|
||||
{
|
||||
return (caddr_t)NUBUS_SLOT2PA(gp->sc_slot->slot);
|
||||
}
|
||||
|
||||
/* Interrupt handlers... */
|
||||
/*
|
||||
* Generic routine to clear interrupts for cards where it simply takes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_obio.c,v 1.32 1998/05/02 16:45:31 scottr Exp $ */
|
||||
/* $NetBSD: grf_obio.c,v 1.33 1998/06/02 02:14:21 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Allen Briggs. All rights reserved.
|
||||
|
@ -60,7 +60,6 @@ extern long videobitdepth;
|
|||
extern u_long videosize;
|
||||
|
||||
static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg));
|
||||
static caddr_t grfiv_phys __P((struct grf_softc *gp));
|
||||
static int grfiv_match __P((struct device *, struct cfdata *, void *));
|
||||
static void grfiv_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
|
@ -68,9 +67,9 @@ struct cfattach intvid_ca = {
|
|||
sizeof(struct grfbus_softc), grfiv_match, grfiv_attach
|
||||
};
|
||||
|
||||
#define QUADRA_DAFB_BASE 0xF9800000
|
||||
#define QUADRA_DAFB_BASE 0xf9800000
|
||||
#define CIVIC_CONTROL_BASE 0x50036000
|
||||
#define VALKYRIE_CONTROL_BASE 0x50f2A000
|
||||
#define VALKYRIE_CONTROL_BASE 0x50f2a000
|
||||
|
||||
static int
|
||||
grfiv_match(parent, cf, aux)
|
||||
|
@ -103,13 +102,6 @@ grfiv_match(parent, cf, aux)
|
|||
goto nodafb;
|
||||
}
|
||||
|
||||
sense = (bus_space_read_4(oa->oa_tag, bsh, 0x1C) & 7);
|
||||
|
||||
#if 0 /* XXX - fails on Quadras with certain 17" monitors */
|
||||
if (sense == 0)
|
||||
found = 0;
|
||||
#endif
|
||||
|
||||
/* Set "Turbo SCSI" configuration to default */
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x24, 0x1d1); /* ch0 */
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x28, 0x1d1); /* ch1 */
|
||||
|
@ -177,6 +169,7 @@ grfiv_attach(parent, self, aux)
|
|||
sc = (struct grfbus_softc *)self;
|
||||
|
||||
sc->card_id = 0;
|
||||
sc->sc_bufpa = (caddr_t)mac68k_vidphys;
|
||||
|
||||
switch (current_mac_model->class) {
|
||||
case MACH_CLASSQ:
|
||||
|
@ -209,7 +202,7 @@ grfiv_attach(parent, self, aux)
|
|||
gm->fboff = mac68k_vidlog & PGOFSET;
|
||||
|
||||
/* Perform common video attachment. */
|
||||
grf_establish(sc, NULL, grfiv_mode, grfiv_phys);
|
||||
grf_establish(sc, NULL, grfiv_mode);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -231,14 +224,3 @@ grfiv_mode(sc, cmd, arg)
|
|||
}
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
static caddr_t
|
||||
grfiv_phys(gp)
|
||||
struct grf_softc *gp;
|
||||
{
|
||||
/*
|
||||
* If we're using IIsi or similar, this will be 0.
|
||||
* If we're using IIvx or similar, this will be correct.
|
||||
*/
|
||||
return (caddr_t)mac68k_vidphys;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue