arm32 kernel source restructure
- Implement a vidcvideo device to act as the parent for the VIDC console.
This commit is contained in:
parent
8d8f4fc1a7
commit
553af4fcee
|
@ -0,0 +1,205 @@
|
|||
/* $NetBSD: vidcvideo.c,v 1.1 1997/10/14 11:47:17 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* Copyright (c) 1996 Robert Black
|
||||
* Copyright (c) 1994-1995 Melvyn Tang-Richardson
|
||||
* Copyright (c) 1994-1995 RiscBSD kernel team
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 RiscBSD kernel team
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``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 AUTHORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* vidcconsole.c
|
||||
*
|
||||
* Console assembly functions
|
||||
*
|
||||
* Created : 17/09/94
|
||||
* Last updated : 07/02/96
|
||||
*/
|
||||
|
||||
/* woo */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
/*#include <sys/malloc.h>*/
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/map.h>
|
||||
#include <sys/proc.h>
|
||||
/*#include <sys/user.h>*/
|
||||
#include <sys/syslog.h>
|
||||
/*#include <sys/resourcevar.h>*/
|
||||
/*#include <vm/vm.h>*/
|
||||
/*#include <vm/vm_kern.h>*/
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/param.h>
|
||||
/*#include <machine/katelib.h>*/
|
||||
/*#include <machine/cpu.h>*/
|
||||
/*#include <machine/bootconfig.h>*/
|
||||
/*#include <machine/iomd.h>*/
|
||||
/*#include <machine/irqhandler.h>*/
|
||||
/*#include <machine/pmap.h>*/
|
||||
#include <machine/vidc.h>
|
||||
#include <machine/vconsole.h>
|
||||
|
||||
extern int physcon_major;
|
||||
extern struct vconsole *vconsole_default;
|
||||
extern videomemory_t videomemory;
|
||||
extern struct render_engine vidcconsole;
|
||||
|
||||
struct vidcvideo_softc {
|
||||
struct device device;
|
||||
int sc_opened;
|
||||
};
|
||||
|
||||
int
|
||||
vidcvideo_probe(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
vidcvideo_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct vidcvideo_softc *vidcvideosoftc = (void *)self;
|
||||
vidcvideosoftc->sc_opened=0;
|
||||
|
||||
printf(": refclk=%dMHz %dKB %s\n", (VIDC_FREF / 1000000),
|
||||
videomemory.vidm_size / 1024,
|
||||
(videomemory.vidm_type == VIDEOMEM_TYPE_VRAM) ? "VRAM" : "DRAM");
|
||||
}
|
||||
|
||||
struct cfattach vidcvideo_ca = {
|
||||
sizeof (struct vidcvideo_softc), vidcvideo_probe, vidcvideo_attach
|
||||
};
|
||||
|
||||
struct cfdriver vidcvideo_cd = {
|
||||
NULL, "vidcvideo", DV_DULL
|
||||
};
|
||||
|
||||
int
|
||||
vidcvideoopen(dev, flags, fmt, p)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
int fmt;
|
||||
struct proc *p;
|
||||
{
|
||||
struct vidcvideo_softc *sc;
|
||||
struct vconsole vconsole_new;
|
||||
int unit = minor(dev);
|
||||
int s;
|
||||
|
||||
if (unit >= vidcvideo_cd.cd_ndevs)
|
||||
return ENXIO;
|
||||
sc = vidcvideo_cd.cd_devs[unit];
|
||||
if (!sc)
|
||||
return ENXIO;
|
||||
|
||||
s = spltty();
|
||||
/* if (sc->sc_opened) {
|
||||
(void)splx(s);
|
||||
return(EBUSY);
|
||||
}*/
|
||||
++sc->sc_opened;
|
||||
(void)splx(s);
|
||||
|
||||
if (sc->sc_opened == 1) {
|
||||
vconsole_new = *vconsole_default;
|
||||
vconsole_new.render_engine = &vidcconsole;
|
||||
vconsole_spawn_re (
|
||||
makedev ( physcon_major, 64 + minor(dev) ),
|
||||
&vconsole_new );
|
||||
} else {
|
||||
log(LOG_WARNING, "Multiple open of/dev/vidcvideo0 by proc %d\n", p->p_pid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
vidcvideoclose(dev, flags, fmt, p)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
int fmt;
|
||||
struct proc *p;
|
||||
{
|
||||
struct vidcvideo_softc *sc;
|
||||
int unit = minor(dev);
|
||||
int s;
|
||||
|
||||
if ( unit >= vidcvideo_cd.cd_ndevs )
|
||||
return ENXIO;
|
||||
sc = vidcvideo_cd.cd_devs[unit];
|
||||
if (!sc)
|
||||
return ENXIO;
|
||||
|
||||
s = spltty();
|
||||
--sc->sc_opened;
|
||||
(void)splx(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int physconioctl __P((dev_t, int, caddr_t, int, struct proc *));
|
||||
|
||||
int
|
||||
vidcvideoioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
int cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
dev = makedev(physcon_major, 64 + minor(dev));
|
||||
return(physconioctl(dev, cmd, data, flag, p));
|
||||
}
|
||||
|
||||
extern int physconmmap __P((dev_t, int, int));
|
||||
|
||||
int
|
||||
vidcvideommap(dev, offset, prot)
|
||||
dev_t dev;
|
||||
int offset;
|
||||
int prot;
|
||||
{
|
||||
dev = makedev(physcon_major, 64 + minor(dev));
|
||||
return(physconmmap(dev, offset, prot));
|
||||
}
|
Loading…
Reference in New Issue