ANSIfy, un-__P, and generally KNF.

This commit is contained in:
bjh21 2006-08-05 18:22:57 +00:00
parent acffd648f6
commit 758ec34161
8 changed files with 293 additions and 376 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd.c,v 1.14 2005/12/11 12:16:47 christos Exp $ */
/* $NetBSD: iomd.c,v 1.15 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 1996-1997 Mark Brinicombe.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iomd.c,v 1.14 2005/12/11 12:16:47 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: iomd.c,v 1.15 2006/08/05 18:22:57 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -80,11 +80,11 @@ struct iomd_softc {
int sc_id; /* IOMD id */
};
static int iomdmatch __P((struct device *parent, struct cfdata *cf,
void *aux));
static void iomdattach __P((struct device *parent, struct device *self,
void *aux));
static int iomdprint __P((void *aux, const char *iomdbus));
static int iomdmatch(struct device *parent, struct cfdata *cf,
void *aux);
static void iomdattach(struct device *parent, struct device *self,
void *aux);
static int iomdprint(void *aux, const char *iomdbus);
CFATTACH_DECL(iomd, sizeof(struct iomd_softc),
iomdmatch, iomdattach, NULL, NULL);
@ -107,13 +107,11 @@ u_int32_t arm7500_ioc_found = 0;
*/
static int
iomdprint(aux, name)
void *aux;
const char *name;
iomdprint(void *aux, const char *name)
{
/* union iomd_attach_args *ia = aux;*/
return(QUIET);
return QUIET;
}
/*
@ -123,11 +121,9 @@ iomdprint(aux, name)
*/
static int
iomdmatch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
iomdmatch(struct device *parent, struct cfdata *cf, void *aux)
{
if (iomd_found)
return 0;
return 1;
@ -142,10 +138,7 @@ iomdmatch(parent, cf, aux)
*/
static void
iomdattach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
iomdattach(struct device *parent, struct device *self, void *aux)
{
struct iomd_softc *sc = (struct iomd_softc *)self;
/* struct mainbus_attach_args *mb = aux;*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_dma.c,v 1.9 2005/12/11 12:16:47 christos Exp $ */
/* $NetBSD: iomd_dma.c,v 1.10 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iomd_dma.c,v 1.9 2005/12/11 12:16:47 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: iomd_dma.c,v 1.10 2006/08/05 18:22:57 bjh21 Exp $");
#define DMA_DEBUG
#include <sys/param.h>
@ -54,32 +54,32 @@ __KERNEL_RCSID(0, "$NetBSD: iomd_dma.c,v 1.9 2005/12/11 12:16:47 christos Exp $"
/*
* Only for non ARM7500 machines but the kernel could be booted on a different machine
* Only for non ARM7500 machines but the kernel could be booted on a
* different machine
*/
static struct dma_ctrl ctrl[6];
void dma_dumpdc __P((struct dma_ctrl *));
void dma_dumpdc(struct dma_ctrl *);
void
dma_go(dp)
struct dma_ctrl *dp;
dma_go(struct dma_ctrl *dp)
{
#ifdef DMA_DEBUG
printf("dma_go()\n");
#endif
if(dp->dc_flags & DMA_FL_READY) {
if (dp->dc_flags & DMA_FL_READY) {
dp->dc_flags = DMA_FL_ACTIVE;
enable_irq(IRQ_DMACH0 + dp->dc_channel);
}
else
} else
panic("dma not ready");
}
int
dma_reset(dp)
struct dma_ctrl *dp;
dma_reset(struct dma_ctrl *dp)
{
#ifdef DMA_DEBUG
printf("dma_reset()\n");
dma_dumpdc(dp);
@ -87,63 +87,61 @@ dma_reset(dp)
*dp->dc_cr = DMA_CR_CLEAR;
dp->dc_flags = 0;
disable_irq(IRQ_DMACH0 + dp->dc_channel);
return(0);
return 0;
}
/*
* Setup dma transfer, prior to the dma_go call
*/
int
dma_setup(dp, start, len, readp)
struct dma_ctrl *dp;
int readp;
u_char *start;
int len;
dma_setup(struct dma_ctrl *dp, u_char *start, int len, int readp)
{
#ifdef DMA_DEBUG
printf("dma_setup(start = %p, len = 0x%08x, readp = %d\n", start, len, readp);
printf("dma_setup(start = %p, len = 0x%08x, readp = %d\n",
start, len, readp);
#endif
if(((u_int)start & (dp->dc_dmasize - 1)) ||
if (((u_int)start & (dp->dc_dmasize - 1)) ||
(len & (dp->dc_dmasize - 1))) {
printf("dma_setup: unaligned DMA, %p (0x%08x)\n",
start, len);
}
*dp->dc_cr = DMA_CR_CLEAR | DMA_CR_ENABLE | (readp?DMA_CR_DIR:0) | dp->dc_dmasize;
*dp->dc_cr = DMA_CR_CLEAR | DMA_CR_ENABLE | (readp?DMA_CR_DIR:0) |
dp->dc_dmasize;
*dp->dc_cr = DMA_CR_ENABLE | (readp?DMA_CR_DIR:0) | dp->dc_dmasize;
dp->dc_nextaddr = start;
dp->dc_len = len;
dp->dc_flags = DMA_FL_READY;
return(0);
return 0;
}
/*
* return true if DMA is active
*/
int
dma_isactive(dp)
struct dma_ctrl *dp;
dma_isactive(struct dma_ctrl *dp)
{
return(dp->dc_flags & DMA_FL_ACTIVE);
return dp->dc_flags & DMA_FL_ACTIVE;
}
/*
* return true if interrupt pending
*/
int
dma_isintr(dp)
struct dma_ctrl *dp;
dma_isintr(struct dma_ctrl *dp)
{
#ifdef DMA_DEBUG
/* printf("dma_isintr() returning %d\n", *dp->dc_st & DMA_ST_INT);*/
#endif
return(*dp->dc_st & DMA_ST_INT);
return *dp->dc_st & DMA_ST_INT;
}
int
dma_intr(cookie)
void *cookie;
dma_intr(void *cookie)
{
struct dma_ctrl *dp = cookie;
u_char status = (*dp->dc_st) & DMA_ST_MASK;
@ -155,18 +153,18 @@ dma_intr(cookie)
printf("dma_intr() status = 0x%02x\n", status);
#endif
if(!(dp->dc_flags & DMA_FL_ACTIVE)) {
if (!(dp->dc_flags & DMA_FL_ACTIVE)) {
/* interrupt whilst not active */
/* ie. last buffer programmed */
dma_reset(dp);
return(0);
return 0;
}
switch(status) {
switch (status) {
case DMA_ST_OVER | DMA_ST_INT:
case DMA_ST_OVER | DMA_ST_INT | DMA_ST_CHAN:
/* idle, either first buffer or finished */
if(status & DMA_ST_CHAN) {
if (status & DMA_ST_CHAN) {
/* fill buffer B */
bufap = 0;
goto fill;
@ -180,7 +178,7 @@ dma_intr(cookie)
case DMA_ST_INT:
case DMA_ST_INT | DMA_ST_CHAN:
/* buffer ready */
if(status & DMA_ST_CHAN) {
if (status & DMA_ST_CHAN) {
/* fill buffer A */
bufap = 1;
goto fill;
@ -227,7 +225,7 @@ fill:
dp->dc_nextaddr += len;
dp->dc_len -= len;
if(bufap) {
if (bufap) {
*dp->dc_cura = (u_int)cur;
*dp->dc_enda = ((u_int)cur + len - dp->dc_dmasize) |
(dp->dc_len == 0 ? DMA_END_STOP : 0);
@ -235,8 +233,7 @@ fill:
/* Last buffer, fill other buffer with garbage */
*dp->dc_endb = (u_int)cur;
}
}
else {
} else {
*dp->dc_curb = (u_int)cur;
*dp->dc_endb = ((u_int)cur + len - dp->dc_dmasize) |
(dp->dc_len == 0 ? DMA_END_STOP : 0);
@ -250,7 +247,7 @@ fill:
/* ptsc_dump_mem(dp->dc_nextaddr - len, len);*/
printf("about to return\n");
#endif
return(1);
return 1;
done:
#ifdef DMA_DEBUG
printf("done:\n");
@ -261,13 +258,13 @@ done:
#ifdef DMA_DEBUG
printf("about to return\n");
#endif
return(1);
return 1;
}
void
dma_dumpdc(dc)
struct dma_ctrl *dc;
dma_dumpdc(struct dma_ctrl *dc)
{
printf("\ndc:\t%p\n"
"dc_channel:\t%p=0x%08x\tdc_flags:\t%p=0x%08x\n"
"dc_cura:\t%p=0x%08x\tdc_enda:\t%p=0x%08x\n"
@ -288,11 +285,7 @@ dma_dumpdc(dc)
}
struct dma_ctrl *
dma_init(ch, extp, dmasize, ipl)
int ch;
int extp;
int dmasize;
int ipl;
dma_init(int ch, int extp, int dmasize, int ipl)
{
struct dma_ctrl *dp = &ctrl[ch];
int offset = ch * 0x20;
@ -325,6 +318,6 @@ dma_init(ch, extp, dmasize, ipl)
if (irq_claim(IRQ_DMACH0 + ch, &dp->dc_ih))
panic("Cannot install DMA IRQ handler");
return(dp);
return dp;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_io.c,v 1.4 2005/12/11 12:16:47 christos Exp $ */
/* $NetBSD: iomd_io.c,v 1.5 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iomd_io.c,v 1.4 2005/12/11 12:16:47 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: iomd_io.c,v 1.5 2006/08/05 18:22:57 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -131,52 +131,40 @@ struct bus_space iomd_bs_tag = {
/* bus space functions */
int
iomd_bs_map(t, bpa, size, cacheable, bshp)
void *t;
bus_addr_t bpa;
bus_size_t size;
int cacheable;
bus_space_handle_t *bshp;
iomd_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable,
bus_space_handle_t *bshp)
{
/*
* Temporary implementation as all I/O is already mapped etc.
*
* Eventually this function will do the mapping check for multiple maps
*/
*bshp = bpa;
return(0);
}
return 0;
}
int
iomd_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
bpap, bshp)
void *t;
bus_addr_t rstart, rend;
bus_size_t size, alignment, boundary;
int cacheable;
bus_addr_t *bpap;
bus_space_handle_t *bshp;
iomd_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
bus_size_t alignment, bus_size_t boundary, int cacheable, bus_addr_t *bpap,
bus_space_handle_t *bshp)
{
panic("iomd_alloc(): Help!");
}
void
iomd_bs_unmap(t, bsh, size)
void *t;
bus_space_handle_t bsh;
bus_size_t size;
iomd_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
{
/*
* Temporary implementation
*/
}
void
iomd_bs_free(t, bsh, size)
void *t;
bus_space_handle_t bsh;
bus_size_t size;
iomd_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
{
panic("iomd_free(): Help!");
@ -185,24 +173,19 @@ iomd_bs_free(t, bsh, size)
}
int
iomd_bs_subregion(t, bsh, offset, size, nbshp)
void *t;
bus_space_handle_t bsh;
bus_size_t offset, size;
bus_space_handle_t *nbshp;
iomd_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t size, bus_space_handle_t *nbshp)
{
*nbshp = bsh + (offset << 2);
return (0);
return 0;
}
void
iomd_bs_barrier(t, bsh, offset, len, flags)
void *t;
bus_space_handle_t bsh;
bus_size_t offset, len;
int flags;
iomd_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t len, int flags)
{
}
/* End of iomd_io.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_irqhandler.c,v 1.10 2006/05/11 12:05:37 yamt Exp $ */
/* $NetBSD: iomd_irqhandler.c,v 1.11 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iomd_irqhandler.c,v 1.10 2006/05/11 12:05:37 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: iomd_irqhandler.c,v 1.11 2006/08/05 18:22:57 bjh21 Exp $");
#include "opt_irqstats.h"
@ -72,7 +72,7 @@ extern char *_intrnames;
/* Prototypes */
extern void set_spl_masks __P((void));
extern void set_spl_masks(void);
/*
* void irq_init(void)
@ -81,14 +81,13 @@ extern void set_spl_masks __P((void));
*/
void
irq_init()
irq_init(void)
{
int loop;
/* Clear all the IRQ handlers and the irq block masks */
for (loop = 0; loop < NIRQS; ++loop) {
for (loop = 0; loop < NIRQS; ++loop)
irqhandlers[loop] = NULL;
}
/* Clear the IRQ/FIQ masks in the IOMD */
IOMD_WRITE_BYTE(IOMD_IRQMSKA, 0x00);
@ -104,7 +103,7 @@ irq_init()
break;
default:
printf("Unknown IOMD id (%d) found in irq_init()\n", IOMD_ID);
};
}
IOMD_WRITE_BYTE(IOMD_FIQMSK, 0x00);
IOMD_WRITE_BYTE(IOMD_DMAMSK, 0x00);
@ -138,9 +137,7 @@ irq_init()
*/
int
irq_claim(irq, handler)
int irq;
irqhandler_t *handler;
irq_claim(int irq, irqhandler_t *handler)
{
int level;
u_int oldirqstate;
@ -162,11 +159,11 @@ irq_claim(irq, handler)
/* Make sure the irq number is valid */
if (irq < 0 || irq >= NIRQS)
return(-1);
return -1;
/* Make sure the level is valid */
if (handler->ih_level < 0 || handler->ih_level >= IPL_LEVELS)
return(-1);
return -1;
oldirqstate = disable_interrupts(I32_bit);
@ -250,7 +247,7 @@ irq_claim(irq, handler)
set_spl_masks();
restore_interrupts(oldirqstate);
return(0);
return 0;
}
@ -261,9 +258,7 @@ irq_claim(irq, handler)
*/
int
irq_release(irq, handler)
int irq;
irqhandler_t *handler;
irq_release(int irq, irqhandler_t *handler)
{
int level;
irqhandler_t *irqhand;
@ -296,7 +291,7 @@ irq_release(irq, handler)
if (irqhand)
*prehand = irqhand->ih_next;
else
return(-1);
return -1;
/* Now the handler has been removed from the chain mark is as inactive */
irqhand->ih_flags &= ~IRQ_FLAG_ACTIVE;
@ -358,17 +353,13 @@ irq_release(irq, handler)
set_spl_masks();
return(0);
return 0;
}
void *
intr_claim(irq, level, name, ih_func, ih_arg)
int irq;
int level;
const char *name;
int (*ih_func) __P((void *));
void *ih_arg;
intr_claim(int irq, int level, const char *name, int (*ih_func)(void *),
void *ih_arg)
{
irqhandler_t *ih;
@ -383,50 +374,48 @@ intr_claim(irq, level, name, ih_func, ih_arg)
ih->ih_flags = 0;
if (irq_claim(irq, ih) != 0)
return(NULL);
return(ih);
return NULL;
return ih;
}
int
intr_release(arg)
void *arg;
intr_release(void *arg)
{
irqhandler_t *ih = (irqhandler_t *)arg;
if (irq_release(ih->ih_num, ih) == 0) {
free(ih, M_DEVBUF);
return(0);
return 0 ;
}
return(1);
return 1;
}
#if 0
u_int
disable_interrupts(mask)
u_int mask;
disable_interrupts(u_int mask)
{
u_int cpsr;
cpsr = SetCPSR(mask, mask);
return(cpsr);
return cpsr;
}
u_int
restore_interrupts(old_cpsr)
u_int old_cpsr;
restore_interrupts(u_int old_cpsr)
{
int mask = I32_bit | F32_bit;
return(SetCPSR(mask, old_cpsr & mask));
return SetCPSR(mask, old_cpsr & mask);
}
u_int
enable_interrupts(mask)
u_int mask;
enable_interrupts(u_int mask)
{
return(SetCPSR(mask, 0));
return SetCPSR(mask, 0);
}
#endif
@ -437,8 +426,7 @@ enable_interrupts(mask)
*/
void
disable_irq(irq)
int irq;
disable_irq(int irq)
{
u_int oldirqstate;
@ -458,8 +446,7 @@ disable_irq(irq)
*/
void
enable_irq(irq)
int irq;
enable_irq(int irq)
{
u_int oldirqstate;
@ -478,8 +465,7 @@ enable_irq(irq)
*/
void
stray_irqhandler(mask)
u_int mask;
stray_irqhandler(u_int mask)
{
static u_int stray_irqs = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: qms.c,v 1.8 2005/12/11 12:16:47 christos Exp $ */
/* $NetBSD: qms.c,v 1.9 2006/08/05 18:22:57 bjh21 Exp $ */
/*-
* Copyright (c) 2001 Reinoud Zandijk
@ -41,7 +41,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: qms.c,v 1.8 2005/12/11 12:16:47 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: qms.c,v 1.9 2006/08/05 18:22:57 bjh21 Exp $");
#include <sys/callout.h>
#include <sys/device.h>
@ -106,9 +106,9 @@ qms_match(struct device *parent, struct cfdata *cf, void *aux)
struct qms_attach_args *qa = aux;
if (strcmp(qa->qa_name, "qms") == 0)
return(1);
return 1;
return(0);
return 0;
}
@ -206,7 +206,7 @@ qms_intr(void *arg)
sc->lastx = x;
sc->lasty = y;
sc->lastb = b;
};
}
callout_reset(&sc->sc_callout, hz / 100, qms_intr, sc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidc20.c,v 1.14 2006/03/08 23:46:23 lukem Exp $ */
/* $NetBSD: vidc20.c,v 1.15 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vidc20.c,v 1.14 2006/03/08 23:46:23 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: vidc20.c,v 1.15 2006/08/05 18:22:57 bjh21 Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -97,7 +97,7 @@ static int
vidcmatch(struct device *parent, struct cfdata *cf, void *aux)
{
return(1);
return 1;
}
/*
@ -114,7 +114,7 @@ vidcsearch(struct device *parent, struct cfdata *cf,
if (config_match(parent, cf, NULL) > 0)
config_attach(parent, cf, NULL, NULL);
return (0);
return 0;
}
/*
@ -148,7 +148,7 @@ vidcattach(struct device *parent, struct device *self, void *aux)
printf(": VIDC20\n");
vidc_fref = 24000000;
break;
};
}
config_search_ia(vidcsearch, self, "vidc", NULL);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidc20config.c,v 1.20 2005/12/11 12:16:47 christos Exp $ */
/* $NetBSD: vidc20config.c,v 1.21 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 2001 Reinoud Zandijk
@ -48,7 +48,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.20 2005/12/11 12:16:47 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.21 2006/08/05 18:22:57 bjh21 Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -171,9 +171,7 @@ vidcvideo_printdetails(void)
* Common functions to directly access VIDC registers
*/
int
vidcvideo_write(reg, value)
u_int reg;
int value;
vidcvideo_write(u_int reg, int value)
{
int counter;
@ -188,13 +186,13 @@ vidcvideo_write(reg, value)
* OK, the VIDC_PALETTE register is handled differently
* to the others on the VIDC, so take that into account here
*/
if (reg==VIDC_PALREG) {
if (reg == VIDC_PALREG) {
vidc_current->palreg = 0;
WriteWord(vidc_base, reg | value);
return 0;
}
if (reg==VIDC_PALETTE) {
if (reg == VIDC_PALETTE) {
WriteWord(vidc_base, reg | value);
vidc_current->palette[vidc_current->palreg] = value;
vidc_current->palreg++;
@ -217,8 +215,10 @@ vidcvideo_write(reg, value)
#define INITVALUE 256
#endif
for ( counter=INITVALUE; counter<= sizeof(struct vidc_state); counter++ ) {
if ( reg==tab[counter] ) {
for (counter = INITVALUE;
counter <= sizeof(struct vidc_state);
counter++) {
if (reg == tab[counter]) {
WriteWord ( vidc_base, reg | value );
current[counter] = value;
return 0;
@ -229,8 +229,7 @@ vidcvideo_write(reg, value)
void
vidcvideo_setpalette(vidc)
struct vidc_state *vidc;
vidcvideo_setpalette(struct vidc_state *vidc)
{
int counter = 0;
@ -241,8 +240,7 @@ vidcvideo_setpalette(vidc)
void
vidcvideo_setstate(vidc)
struct vidc_state *vidc;
vidcvideo_setstate(struct vidc_state *vidc)
{
vidcvideo_write ( VIDC_PALREG, vidc->palreg );
vidcvideo_write ( VIDC_BCOL, vidc->bcol );
@ -280,17 +278,17 @@ vidcvideo_setstate(vidc)
void
vidcvideo_getstate(vidc)
struct vidc_state *vidc;
vidcvideo_getstate(struct vidc_state *vidc)
{
*vidc = *vidc_current;
}
void
vidcvideo_getmode(mode)
struct vidc_mode *mode;
vidcvideo_getmode(struct vidc_mode *mode)
{
*mode = *vidc_currentmode;
}
@ -322,7 +320,7 @@ vidcvideo_coldinit(void)
} else {
dispsize = bootconfig.vram[0].pages * PAGE_SIZE;
transfersize = dispsize >> 10;
};
}
ptov = dispbase - phys_base;
@ -372,20 +370,23 @@ vidcvideo_coldinit(void)
/* simple function to abstract vidc variables ; returns virt start address of screen */
/* XXX asumption that video memory is mapped in twice */
void *vidcvideo_hwscroll(int bytes) {
void *vidcvideo_hwscroll(int bytes)
{
dispstart += bytes;
if (dispstart >= dispbase + dispsize) dispstart -= dispsize;
if (dispstart < dispbase) dispstart += dispsize;
dispend = dispstart+dispsize;
/* return the start of the bit map of the screen (left top) */
return (void *) dispstart;
return (void *)dispstart;
}
/* reset the HW scroll to be at the start for the benefit of f.e. X */
void *vidcvideo_hwscroll_reset(void) {
void *cookie = (void *) dispstart;
void *vidcvideo_hwscroll_reset(void)
{
void *cookie = (void *)dispstart;
dispstart = dispbase;
dispend = dispstart + dispsize;
@ -394,15 +395,19 @@ void *vidcvideo_hwscroll_reset(void) {
/* put HW scroll back to where it was */
void *vidcvideo_hwscroll_back(void *cookie) {
dispstart = (int) cookie;
void *vidcvideo_hwscroll_back(void *cookie)
{
dispstart = (int)cookie;
dispend = dispstart + dispsize;
return cookie;
}
/* this function is to be called perferably at vsync */
void vidcvideo_progr_scroll(void) {
void vidcvideo_progr_scroll(void)
{
IOMD_WRITE_WORD(IOMD_VIDINIT, dispstart-ptov);
IOMD_WRITE_WORD(IOMD_VIDSTART, dispstart-ptov);
IOMD_WRITE_WORD(IOMD_VIDEND, (dispend-transfersize)-ptov);
@ -437,9 +442,10 @@ vidcvideo_setmode(struct vidc_mode *mode)
int r, v, f;
/*
* Find out what bit mask we need to or with the vidc20 control register
* in order to generate the desired number of bits per pixel.
* log_bpp is log base 2 of the number of bits per pixel.
* Find out what bit mask we need to or with the vidc20
* control register in order to generate the desired number of
* bits per pixel. log_bpp is log base 2 of the number of
* bits per pixel.
*/
bpp_mask = bpp_mask_table[mode->log2_bpp];
@ -550,11 +556,10 @@ vidcvideo_init(void)
vidcvideo_write(VIDC_CP1, 0x0);
vidcvideo_write(VIDC_CP2, 0x0);
vidcvideo_write(VIDC_CP3, 0x0);
} else {
} else
vidcvideo_cursor_init(CURSOR_MAX_WIDTH, CURSOR_MAX_HEIGHT);
};
cold_init=1;
cold_init = 1;
return 0;
}
@ -563,6 +568,7 @@ vidcvideo_init(void)
void
vidcvideo_reinit()
{
vidcvideo_coldinit();
vidcvideo_setmode(vidc_currentmode);
}
@ -601,20 +607,18 @@ vidcvideo_cursor_init(int width, int height)
cursor_transparent += 32; /* ALIGN */
cursor_transparent = (char *)((int)cursor_transparent & (~31) );
for ( line = 0; line<height; ++line )
{
for ( counter=0; counter<width/4;counter++ )
cursor_normal[line * width + counter]=0x55; /* why 0x55 ? */
for ( ; counter<8; counter++ )
cursor_normal[line * width + counter]=0;
for ( line = 0; line<height; ++line ) {
for ( counter=0; counter<width/4;counter++ )
cursor_normal[line * width + counter]=0x55; /* why 0x55 ? */
for ( ; counter<8; counter++ )
cursor_normal[line * width + counter]=0;
}
for ( line = 0; line<height; ++line )
{
for ( counter=0; counter<width/4;counter++ )
cursor_transparent[line * width + counter]=0x00;
for ( ; counter<8; counter++ )
cursor_transparent[line * width + counter]=0;
for ( line = 0; line<height; ++line ) {
for ( counter=0; counter<width/4;counter++ )
cursor_transparent[line * width + counter]=0x00;
for ( ; counter<8; counter++ )
cursor_transparent[line * width + counter]=0;
}
@ -623,8 +627,8 @@ vidcvideo_cursor_init(int width, int height)
(void) pmap_extract(pmap_kernel(), (vaddr_t)cursor_transparent,
(void *)&p_cursor_transparent);
memset ( cursor_normal, 0x55, width*height ); /* white? */
memset ( cursor_transparent, 0x00, width*height ); /* to see the diffence */
memset(cursor_normal, 0x55, width*height); /* white? */
memset(cursor_transparent, 0x00, width*height);/* to see the diffence */
/* Ok, now program the cursor; should be blank */
vidcvideo_enablecursor(0);
@ -634,31 +638,29 @@ vidcvideo_cursor_init(int width, int height)
void
vidcvideo_updatecursor(xcur, ycur)
int xcur, ycur;
vidcvideo_updatecursor(int xcur, int ycur)
{
int frontporch = vidc_currentmode->hswr + vidc_currentmode->hbsr + vidc_currentmode->hdsr;
int topporch = vidc_currentmode->vswr + vidc_currentmode->vbsr + vidc_currentmode->vdsr;
int frontporch = vidc_currentmode->hswr + vidc_currentmode->hbsr +
vidc_currentmode->hdsr;
int topporch = vidc_currentmode->vswr + vidc_currentmode->vbsr +
vidc_currentmode->vdsr;
vidcvideo_write(VIDC_HCSR, frontporch -17 + xcur);
vidcvideo_write(VIDC_VCSR, topporch -2 + (ycur+1)-2 + 3 - cursor_height);
vidcvideo_write(VIDC_VCSR, topporch -2 + (ycur+1)-2 + 3 -
cursor_height);
vidcvideo_write(VIDC_VCER, topporch -2 + (ycur+3)+2 + 3 );
return;
}
void
vidcvideo_enablecursor(on)
int on;
vidcvideo_enablecursor(int on)
{
if (on) {
IOMD_WRITE_WORD(IOMD_CURSINIT,p_cursor_normal);
} else {
IOMD_WRITE_WORD(IOMD_CURSINIT,p_cursor_transparent);
};
vidcvideo_write ( VIDC_CP1, 0xffffff ); /* enable */
return;
if (on)
IOMD_WRITE_WORD(IOMD_CURSINIT,p_cursor_normal);
else
IOMD_WRITE_WORD(IOMD_CURSINIT,p_cursor_transparent);
vidcvideo_write ( VIDC_CP1, 0xffffff ); /* enable */
}
@ -723,12 +725,10 @@ vidcvideo_stdpalette()
vidcvideo_write(VIDC_PALETTE, VIDC_COL(i, i, i));
break;
}
}
int
vidcvideo_blank(video_off)
int video_off;
vidcvideo_blank(int video_off)
{
int ereg;
@ -738,11 +738,10 @@ vidcvideo_blank(video_off)
if (vidc_currentmode->sync_pol & 0x02)
ereg |= 1<<18;
if (!video_off) {
if (!video_off)
vidcvideo_write(VIDC_EREG, ereg);
} else {
else
vidcvideo_write(VIDC_EREG, 0);
};
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcvideo.c,v 1.24 2006/04/25 02:19:31 snj Exp $ */
/* $NetBSD: vidcvideo.c,v 1.25 2006/08/05 18:22:57 bjh21 Exp $ */
/*
* Copyright (c) 2001 Reinoud Zandijk
@ -36,7 +36,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: vidcvideo.c,v 1.24 2006/04/25 02:19:31 snj Exp $");
__KERNEL_RCSID(0, "$NetBSD: vidcvideo.c,v 1.25 2006/08/05 18:22:57 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -138,8 +138,8 @@ struct vidcvideo_softc {
/* Function prototypes for glue */
static int vidcvideo_match __P((struct device *, struct cfdata *, void *));
static void vidcvideo_attach __P((struct device *, struct device *, void *));
static int vidcvideo_match(struct device *, struct cfdata *, void *);
static void vidcvideo_attach(struct device *, struct device *, void *);
/* config glue */
@ -162,18 +162,19 @@ static const struct wsscreen_descr *_vidcvideo_scrlist[] = {
};
static const struct wsscreen_list vidcvideo_screenlist = {
sizeof(_vidcvideo_scrlist) / sizeof(struct wsscreen_descr *), _vidcvideo_scrlist
sizeof(_vidcvideo_scrlist) / sizeof(struct wsscreen_descr *),
_vidcvideo_scrlist
};
static int vidcvideoioctl __P((void *, void *, u_long, caddr_t, int,
struct lwp *));
static paddr_t vidcvideommap __P((void *, void *, off_t, int));
static int vidcvideoioctl(void *, void *, u_long, caddr_t, int,
struct lwp *);
static paddr_t vidcvideommap(void *, void *, off_t, int);
static int vidcvideo_alloc_screen __P((void *, const struct wsscreen_descr *,
void **, int *, int *, long *));
static void vidcvideo_free_screen __P((void *, void *));
static int vidcvideo_show_screen __P((void *, void *, int,
void (*) (void *, int, int), void *));
static int vidcvideo_alloc_screen(void *, const struct wsscreen_descr *,
void **, int *, int *, long *);
static void vidcvideo_free_screen(void *, void *);
static int vidcvideo_show_screen(void *, void *, int,
void (*) (void *, int, int), void *);
static const struct wsdisplay_accessops vidcvideo_accessops = {
vidcvideoioctl,
@ -187,24 +188,24 @@ static const struct wsdisplay_accessops vidcvideo_accessops = {
/* Function prototypes */
int vidcvideo_cnattach __P((vaddr_t));
static void vidcvideo_colourmap_and_cursor_init __P((struct fb_devconfig *));
int vidcvideo_cnattach(vaddr_t);
static void vidcvideo_colourmap_and_cursor_init(struct fb_devconfig *);
static int get_cmap __P((struct vidcvideo_softc *, struct wsdisplay_cmap *));
static int set_cmap __P((struct vidcvideo_softc *, struct wsdisplay_cmap *));
static int set_cursor __P((struct vidcvideo_softc *, struct wsdisplay_cursor *));
static int get_cursor __P((struct vidcvideo_softc *, struct wsdisplay_cursor *));
static void set_curpos __P((struct vidcvideo_softc *, struct wsdisplay_curpos *));
static void vidcvideo_getdevconfig __P((vaddr_t, struct fb_devconfig *));
static int get_cmap(struct vidcvideo_softc *, struct wsdisplay_cmap *);
static int set_cmap(struct vidcvideo_softc *, struct wsdisplay_cmap *);
static int set_cursor(struct vidcvideo_softc *, struct wsdisplay_cursor *);
static int get_cursor(struct vidcvideo_softc *, struct wsdisplay_cursor *);
static void set_curpos(struct vidcvideo_softc *, struct wsdisplay_curpos *);
static void vidcvideo_getdevconfig(vaddr_t, struct fb_devconfig *);
static int vidcvideointr __P((void *));
static void vidcvideo_config_wscons __P((struct fb_devconfig *));
static int vidcvideointr(void *);
static void vidcvideo_config_wscons(struct fb_devconfig *);
/* Acceleration function prototypes */
static void vv_copyrows __P((void *, int, int, int));
static void vv_eraserows __P((void *, int, int, long));
static void vv_putchar __P((void *c, int row, int col, u_int uc, long attr));
static void vv_copyrows(void *, int, int, int);
static void vv_eraserows(void *, int, int, long);
static void vv_putchar(void *c, int row, int col, u_int uc, long attr);
static int
@ -213,16 +214,16 @@ vidcvideo_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
/* Can't probe AFAIK ; how ? */
return (1);
return 1;
}
static void
vidcvideo_getdevconfig(dense_addr, dc)
vaddr_t dense_addr;
struct fb_devconfig *dc;
vidcvideo_getdevconfig(vaddr_t dense_addr, struct fb_devconfig *dc)
{
dc->dc_vaddr = dense_addr;
(void) pmap_extract(pmap_kernel(), dc->dc_vaddr, &(dc->dc_paddr));
@ -258,7 +259,7 @@ vidcvideo_getdevconfig(dense_addr, dc)
default:
printf("Unknown colour depth %d ... what to do ?", dc->dc_depth);
break;
};
}
/* euhm... correct ? i.e. not complete VIDC memory */
dc->dc_size = dc->mode_info.vder * dc->dc_rowbytes;
@ -280,12 +281,14 @@ vidcvideo_getdevconfig(dense_addr, dc)
static void
vidcvideo_config_wscons(dc)
struct fb_devconfig *dc;
vidcvideo_config_wscons(struct fb_devconfig *dc)
{
int i, cookie, font_not_locked;
/* clear the screen ; why not a memset ? - it was this way so keep it for now */
/*
* clear the screen ; why not a memset ? - it was this way so
* keep it for now
*/
for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
*(u_int32_t *)(dc->dc_videobase + i) = 0x0;
@ -302,23 +305,23 @@ vidcvideo_config_wscons(dc)
/* Can I even print here ? */
printf("Font table empty! exiting\n");
return;
};
}
font_not_locked = wsfont_lock(cookie, &dc->rinfo.ri_font);
dc->rinfo.ri_wsfcookie = cookie;
rasops_init(&dc->rinfo,
dc->rinfo.ri_height / dc->rinfo.ri_font->fontheight,
dc->rinfo.ri_width / dc->rinfo.ri_font->fontwidth
);
dc->rinfo.ri_height / dc->rinfo.ri_font->fontheight,
dc->rinfo.ri_width / dc->rinfo.ri_font->fontwidth);
/*
* Provide a hook for the acceleration functions and make a copy of the
* original rasops functions for passing on calls
*/
dc->rinfo.ri_hw = dc;
memcpy(&(dc->orig_ri_ops), &(dc->rinfo.ri_ops), sizeof(struct wsdisplay_emulops));
memcpy(&(dc->orig_ri_ops), &(dc->rinfo.ri_ops),
sizeof(struct wsdisplay_emulops));
/* add our accelerated functions */
dc->rinfo.ri_ops.eraserows = vv_eraserows;
@ -333,16 +336,13 @@ vidcvideo_config_wscons(dc)
vidcvideo_stdscreen.textops = &dc->rinfo.ri_ops;
vidcvideo_stdscreen.capabilities = dc->rinfo.ri_caps;
if (font_not_locked) {
if (font_not_locked)
printf(" warning ... couldn't lock font! ");
};
}
static void
vidcvideo_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
vidcvideo_attach(struct device *parent, struct device *self, void *aux)
{
struct vidcvideo_softc *sc = (struct vidcvideo_softc *)self;
struct fb_devconfig *dc;
@ -360,12 +360,12 @@ vidcvideo_attach(parent, self, aux)
vidcvideo_getdevconfig(videomemory.vidm_vbase, sc->sc_dc);
vidcvideo_config_wscons(sc->sc_dc);
(*sc->sc_dc->rinfo.ri_ops.allocattr)(&sc->sc_dc->rinfo, 0, 0, 0, &defattr);
};
}
sc->nscreens = 1;
} else {
printf(": already attached ... can't cope with this\n");
return;
};
}
dc = sc->sc_dc;
@ -408,13 +408,8 @@ vidcvideo_attach(parent, self, aux)
static int
vidcvideoioctl(v, vs, cmd, data, flag, l)
void *v;
void *vs;
u_long cmd;
caddr_t data;
int flag;
struct lwp *l;
vidcvideoioctl(void *v, void *vs, u_long cmd, caddr_t data, int flag,
struct lwp *l)
{
struct vidcvideo_softc *sc = v;
struct fb_devconfig *dc = sc->sc_dc;
@ -423,7 +418,7 @@ vidcvideoioctl(v, vs, cmd, data, flag, l)
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(u_int *)data = WSDISPLAY_TYPE_VIDC;
return (0);
return 0;
case WSDISPLAYIO_GINFO:
#define wsd_fbip ((struct wsdisplay_fbinfo *)data)
@ -432,7 +427,7 @@ vidcvideoioctl(v, vs, cmd, data, flag, l)
wsd_fbip->depth = dc->dc_depth;
wsd_fbip->cmsize = CMAP_SIZE;
#undef fbt
return (0);
return 0;
case WSDISPLAYIO_GETCMAP:
return get_cmap(sc, (struct wsdisplay_cmap *)data);
@ -445,26 +440,26 @@ vidcvideoioctl(v, vs, cmd, data, flag, l)
dc->dc_blanked = (state == WSDISPLAYIO_VIDEO_OFF);
dc->dc_changed |= WSDISPLAY_VIDEO_ONOFF;
/* done on video blank */
return (0);
return 0;
case WSDISPLAYIO_GVIDEO:
*(u_int *)data = dc->dc_blanked ?
WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON;
return (0);
return 0;
case WSDISPLAYIO_GCURPOS:
*(struct wsdisplay_curpos *)data = dc->dc_cursor.cc_pos;
return (0);
return 0;
case WSDISPLAYIO_SCURPOS:
set_curpos(sc, (struct wsdisplay_curpos *)data);
dc->dc_changed |= WSDISPLAY_CURSOR_DOPOS;
return (0);
return 0;
case WSDISPLAYIO_GCURMAX:
((struct wsdisplay_curpos *)data)->x = CURSOR_MAX_WIDTH;
((struct wsdisplay_curpos *)data)->y = CURSOR_MAX_HEIGHT;
return (0);
return 0;
case WSDISPLAYIO_GCURSOR:
return get_cursor(sc, (struct wsdisplay_cursor *)data);
@ -474,43 +469,33 @@ vidcvideoioctl(v, vs, cmd, data, flag, l)
case WSDISPLAYIO_SMODE:
state = *(int *)data;
if (state == WSDISPLAYIO_MODE_MAPPED) {
if (state == WSDISPLAYIO_MODE_MAPPED)
dc->dc_hwscroll_cookie = vidcvideo_hwscroll_reset();
};
if (state == WSDISPLAYIO_MODE_EMUL) {
if (state == WSDISPLAYIO_MODE_EMUL)
vidcvideo_hwscroll_back(dc->dc_hwscroll_cookie);
};
vidcvideo_progr_scroll();
return (0);
return 0;
}
return EPASSTHROUGH;
}
paddr_t
vidcvideommap(v, vs, offset, prot)
void *v;
void *vs;
off_t offset;
int prot;
vidcvideommap(void *v, void *vs, off_t offset, int prot)
{
struct vidcvideo_softc *sc = v;
if (offset >= sc->sc_dc->dc_size || offset < 0)
return (-1);
return -1;
return arm_btop(sc->sc_dc->dc_paddr + offset);
}
static int
vidcvideo_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
void *v;
const struct wsscreen_descr *type;
void **cookiep;
int *curxp, *curyp;
long *attrp;
vidcvideo_alloc_screen(void *v, const struct wsscreen_descr *type,
void **cookiep, int *curxp, int *curyp, long *attrp)
{
struct vidcvideo_softc *sc = v;
struct fb_devconfig *dc = sc->sc_dc;
@ -521,7 +506,7 @@ vidcvideo_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
* console then this makes one wsconsole screen free for use !
*/
if ((sc->nscreens > 1) || vidcvideo_is_console)
return (ENOMEM);
return ENOMEM;
/* Add the screen to wscons to control */
*cookiep = &dc->rinfo;
@ -533,14 +518,12 @@ vidcvideo_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
*attrp = defattr;
sc->nscreens++;
return (0);
return 0;
}
static void
vidcvideo_free_screen(v, cookie)
void *v;
void *cookie;
vidcvideo_free_screen(void *v, void *cookie)
{
struct vidcvideo_softc *sc = v;
@ -552,21 +535,16 @@ vidcvideo_free_screen(v, cookie)
static int
vidcvideo_show_screen(v, cookie, waitok, cb, cbarg)
void *v;
void *cookie;
int waitok;
void (*cb) __P((void *, int, int));
void *cbarg;
vidcvideo_show_screen(void *v, void *cookie, int waitok,
void (*cb)(void *, int, int), void *cbarg)
{
return (0);
return 0;
}
/* EXPORT */ int
vidcvideo_cnattach(addr)
vaddr_t addr;
vidcvideo_cnattach(vaddr_t addr)
{
struct fb_devconfig *dcp = &vidcvideo_console_dc;
long defattr;
@ -578,27 +556,26 @@ vidcvideo_cnattach(addr)
wsdisplay_cnattach(&vidcvideo_stdscreen, &dcp->rinfo, 0, 0, defattr);
vidcvideo_is_console = 1;
return(0);
return 0;
}
static int
vidcvideointr(arg)
void *arg;
vidcvideointr(void *arg)
{
struct fb_devconfig *dc = arg;
int v, cleared = 0;
v = dc->dc_changed;
if (v == 0)
return (1);
return 1;
if (v & WSDISPLAY_WB_COUNTER) {
dc->dc_writeback_delay--;
if (dc->dc_writeback_delay == 0) {
cpu_dcache_wb_range(dc->dc_vaddr, dc->dc_size);
cleared |= WSDISPLAY_WB_COUNTER;
};
}
}
if (v & WSDISPLAY_CMAP_DOLUT) {
@ -613,26 +590,28 @@ vidcvideointr(arg)
VIDC_COL(cm->r[index],
cm->g[index],
cm->b[index]));
;
};
}
if (dc->dc_depth == 8) {
/* dunno what to do in more than 8bpp */
/* palettes only make sense in 8bpp and less modes on VIDC */
/*
* dunno what to do in more than 8bpp
* palettes only make sense in 8bpp and less modes
* on VIDC
*/
vidcvideo_write(VIDC_PALREG, 0x00000000);
for (index = 0; index < CMAP_SIZE; index++) {
vidcvideo_write(VIDC_PALETTE,
VIDC_COL(cm->r[index], cm->g[index], cm->b[index])
);
};
};
VIDC_COL(cm->r[index], cm->g[index],
cm->b[index]));
}
}
cleared |= WSDISPLAY_CMAP_DOLUT;
}
if (v & WSDISPLAY_VIDEO_ONOFF) {
vidcvideo_blank(dc->dc_blanked);
cleared |= WSDISPLAY_VIDEO_ONOFF;
};
}
if (v & (WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOHOT)) {
int x, y;
@ -641,12 +620,12 @@ vidcvideointr(arg)
vidcvideo_updatecursor(x, y);
cleared |= WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOHOT;
};
}
if (v & WSDISPLAY_CURSOR_DOCUR) {
vidcvideo_enablecursor(dc->dc_curenb);
cleared |= WSDISPLAY_CURSOR_DOCUR;
};
}
#if 0 /* XXX snip XXX */
@ -724,7 +703,7 @@ vidcvideointr(arg)
dc->dc_changed ^= cleared;
return (1);
return 1;
}
@ -738,8 +717,7 @@ static u_char ri_col_data[6][6] = {
};
static void
vidcvideo_colourmap_and_cursor_init(dc)
struct fb_devconfig *dc;
vidcvideo_colourmap_and_cursor_init(struct fb_devconfig *dc)
{
struct rasops_info *ri = &dc->rinfo;
u_char *rgbdat;
@ -757,20 +735,17 @@ vidcvideo_colourmap_and_cursor_init(dc)
ri->ri_rpos = rgbdat[3];
ri->ri_gpos = rgbdat[4];
ri->ri_bpos = rgbdat[5];
}
static int
get_cmap(sc, p)
struct vidcvideo_softc *sc;
struct wsdisplay_cmap *p;
get_cmap(struct vidcvideo_softc *sc, struct wsdisplay_cmap *p)
{
u_int index = p->index, count = p->count;
int error;
if (index >= CMAP_SIZE || count > CMAP_SIZE - index)
return (EINVAL);
return EINVAL;
error = copyout(&sc->sc_dc->dc_cmap.r[index], p->red, count);
if (error)
@ -784,9 +759,7 @@ get_cmap(sc, p)
static int
set_cmap(sc, p)
struct vidcvideo_softc *sc;
struct wsdisplay_cmap *p;
set_cmap(struct vidcvideo_softc *sc, struct wsdisplay_cmap *p)
{
struct fb_devconfig *dc = sc->sc_dc;
struct hwcmap256 cmap;
@ -794,7 +767,7 @@ set_cmap(sc, p)
int error;
if (index >= CMAP_SIZE || (index + count) > CMAP_SIZE)
return (EINVAL);
return EINVAL;
error = copyin(p->red, &cmap.r[index], count);
if (error)
@ -809,14 +782,12 @@ set_cmap(sc, p)
memcpy(&dc->dc_cmap.g[index], &cmap.g[index], count);
memcpy(&dc->dc_cmap.b[index], &cmap.b[index], count);
dc->dc_changed |= WSDISPLAY_CMAP_DOLUT;
return (0);
return 0;
}
static int
set_cursor(sc, p)
struct vidcvideo_softc *sc;
struct wsdisplay_cursor *p;
set_cursor(struct vidcvideo_softc *sc, struct wsdisplay_cursor *p)
{
#define cc (&dc->dc_cursor)
struct fb_devconfig *dc = sc->sc_dc;
@ -833,7 +804,7 @@ set_cursor(sc, p)
count = p->cmap.count;
if (index >= CURSOR_MAX_COLOURS ||
(index + count) > CURSOR_MAX_COLOURS)
return (EINVAL);
return EINVAL;
error = copyin(p->cmap.red, &r[index], count);
if (error)
return error;
@ -847,7 +818,7 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
if (p->size.x > CURSOR_MAX_WIDTH ||
p->size.y > CURSOR_MAX_HEIGHT)
return (EINVAL);
return EINVAL;
icount = sizeof(u_int32_t) * p->size.y;
error = copyin(p->image, &image, icount);
if (error)
@ -877,24 +848,21 @@ set_cursor(sc, p)
}
dc->dc_changed |= v;
return (0);
return 0;
#undef cc
}
static int
get_cursor(sc, p)
struct vidcvideo_softc *sc;
struct wsdisplay_cursor *p;
get_cursor(struct vidcvideo_softc *sc, struct wsdisplay_cursor *p)
{
return (EPASSTHROUGH); /* XXX */
return EPASSTHROUGH; /* XXX */
}
static void
set_curpos(sc, curpos)
struct vidcvideo_softc *sc;
struct wsdisplay_curpos *curpos;
set_curpos(struct vidcvideo_softc *sc, struct wsdisplay_curpos *curpos)
{
struct fb_devconfig *dc = sc->sc_dc;
int x = curpos->x, y = curpos->y;
@ -912,9 +880,7 @@ set_curpos(sc, curpos)
}
static void vv_copyrows(id, srcrow, dstrow, nrows)
void *id;
int srcrow, dstrow, nrows;
static void vv_copyrows(void *id, int srcrow, int dstrow, int nrows)
{
struct rasops_info *ri = id;
int height, offset, size;
@ -930,19 +896,23 @@ static void vv_copyrows(id, srcrow, dstrow, nrows)
scrollup = (srcrow + nrows >= ri->ri_rows);
scrolldown = (dstrow + nrows >= ri->ri_rows);
if ((scrollup || scrolldown) && (videomemory.vidm_type == VIDEOMEM_TYPE_VRAM)) {
if ((scrollup || scrolldown) &&
(videomemory.vidm_type == VIDEOMEM_TYPE_VRAM)) {
ri->ri_bits = vidcvideo_hwscroll(offset);
vidcvideo_progr_scroll(); /* sadistic ; shouldnt this be on vsync? */
/* wipe out remains of the screen if nessisary */
if (ri->ri_emuheight != ri->ri_height) vv_eraserows(id, ri->ri_rows, 1, 0);
if (ri->ri_emuheight != ri->ri_height)
vv_eraserows(id, ri->ri_rows, 1, 0);
return;
};
}
/* Else we just copy the area : we're braindead for now
* Note: we can't use hardware scrolling when the softc isnt known yet...
* if its not known we dont have interrupts and we can't change the display
* address reliable other than in a Vsync
/*
* Else we just copy the area : we're braindead for now
* Note: we can't use hardware scrolling when the softc isnt
* known yet... if its not known we dont have interrupts and
* we can't change the display address reliable other than in
* a Vsync
*/
src = ri->ri_bits + srcrow * ri->ri_font->fontheight * ri->ri_stride;
@ -952,10 +922,7 @@ static void vv_copyrows(id, srcrow, dstrow, nrows)
}
static void vv_eraserows(id, startrow, nrows, attr)
void *id;
int startrow, nrows;
long attr;
static void vv_eraserows(void *id, int startrow, int nrows, long attr)
{
struct rasops_info *ri = id;
int height;
@ -970,11 +937,7 @@ static void vv_eraserows(id, startrow, nrows, attr)
}
static void vv_putchar(id, row, col, uc, attr)
void *id;
int row, col;
u_int uc;
long attr;
static void vv_putchar(void *id, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri = id;
struct fb_devconfig *dc = (struct fb_devconfig *) (ri->ri_hw);