Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/dev/pci Pull up revision 1.26 (requested by martin in...
details: https://anonhg.NetBSD.org/src/rev/d11bd6977230
branches: netbsd-3
changeset: 576033:d11bd6977230
user: tron <tron%NetBSD.org@localhost>
date: Wed Jun 08 11:47:20 2005 +0000
description:
Pull up revision 1.26 (requested by martin in ticket #377):
more formatting fixes
diffstat:
sys/dev/pci/machfb.c | 501 ++++++++++++++++++++++++++------------------------
1 files changed, 265 insertions(+), 236 deletions(-)
diffs (truncated from 877 to 300 lines):
diff -r 530840df9ce3 -r d11bd6977230 sys/dev/pci/machfb.c
--- a/sys/dev/pci/machfb.c Wed Jun 08 11:45:53 2005 +0000
+++ b/sys/dev/pci/machfb.c Wed Jun 08 11:47:20 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machfb.c,v 1.23.2.2 2005/06/08 11:45:53 tron Exp $ */
+/* $NetBSD: machfb.c,v 1.23.2.3 2005/06/08 11:47:20 tron Exp $ */
/*
* Copyright (c) 2002 Bang Jun-Young
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0,
- "$NetBSD: machfb.c,v 1.23.2.2 2005/06/08 11:45:53 tron Exp $");
+ "$NetBSD: machfb.c,v 1.23.2.3 2005/06/08 11:47:20 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -488,20 +488,15 @@
sc->sc_pc = pa->pa_pc;
sc->sc_pcitag = pa->pa_tag;
- sc->sc_dacw=-1;
- sc->sc_mode=WSDISPLAYIO_MODE_EMUL;
+ sc->sc_dacw = -1;
+ sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class));
/* enable memory and IO access */
- screg=pci_conf_read(sc->sc_pc, sc->sc_pcitag, PCI_COMMAND_STATUS_REG);
- screg|=PCI_FLAGS_IO_ENABLED|PCI_FLAGS_MEM_ENABLED;
- pci_conf_write(sc->sc_pc, sc->sc_pcitag,PCI_COMMAND_STATUS_REG,screg);
-
- /* enable memory and IO access */
- screg=pci_conf_read(sc->sc_pc, sc->sc_pcitag, PCI_COMMAND_STATUS_REG);
- screg|=PCI_FLAGS_IO_ENABLED|PCI_FLAGS_MEM_ENABLED;
+ screg = pci_conf_read(sc->sc_pc, sc->sc_pcitag, PCI_COMMAND_STATUS_REG);
+ screg |= PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
pci_conf_write(sc->sc_pc, sc->sc_pcitag,PCI_COMMAND_STATUS_REG,screg);
for (bar = 0; bar < NBARS; bar++) {
@@ -511,7 +506,7 @@
(void)pci_mapreg_info(sc->sc_pc, sc->sc_pcitag, reg,
sc->sc_bars[bar].vb_type, &sc->sc_bars[bar].vb_base,
&sc->sc_bars[bar].vb_size, &sc->sc_bars[bar].vb_flags);
- sc->sc_bars[bar].vb_busaddr=pci_conf_read(sc->sc_pc,
+ sc->sc_bars[bar].vb_busaddr = pci_conf_read(sc->sc_pc,
sc->sc_pcitag, reg)&0xfffffff0;
}
sc->sc_memt = pa->pa_memt;
@@ -540,8 +535,8 @@
/* XXX is there any way to calculate reference frequency from
known values? */
if ((mach64_chip_id == PCI_PRODUCT_ATI_RAGE_XL_PCI) ||
- ((mach64_chip_id>=PCI_PRODUCT_ATI_RAGE_LT_PRO_PCI) &&
- (mach64_chip_id<=PCI_PRODUCT_ATI_RAGE_LT_PRO))) {
+ ((mach64_chip_id >= PCI_PRODUCT_ATI_RAGE_LT_PRO_PCI) &&
+ (mach64_chip_id <= PCI_PRODUCT_ATI_RAGE_LT_PRO))) {
printf("ref_freq=29.498MHz\n");
sc->ref_freq = 29498;
} else
@@ -614,8 +609,8 @@
mach64_console_screen.ri.ri_bits=(void *)(uintptr_t)sc->sc_aperbase;
mach64_console_screen.ri.ri_flg = RI_CENTER;
- mach64_console_screen.active=1;
- sc->active=&mach64_console_screen;
+ mach64_console_screen.active = 1;
+ sc->active = &mach64_console_screen;
/* XXX width/height are nonsense, we only want to pick a font */
rasops_init(&mach64_console_screen.ri,
@@ -629,15 +624,15 @@
mach64_console_screen.ri.ri_width /
mach64_console_screen.ri.ri_font->fontwidth);
- set_address(&mach64_console_screen.ri,sc->sc_aperbase);
+ set_address(&mach64_console_screen.ri, sc->sc_aperbase);
/* enable acceleration */
- mach64_console_screen.ri.ri_ops.copyrows=mach64_copyrows;
- mach64_console_screen.ri.ri_ops.eraserows=mach64_eraserows;
- mach64_console_screen.ri.ri_ops.copycols=mach64_copycols;
- mach64_console_screen.ri.ri_ops.erasecols=mach64_erasecols;
- mach64_console_screen.ri.ri_ops.putchar=mach64_putchar;
- mach64_console_screen.ri.ri_ops.cursor=mach64_cursor;
+ mach64_console_screen.ri.ri_ops.copyrows = mach64_copyrows;
+ mach64_console_screen.ri.ri_ops.eraserows = mach64_eraserows;
+ mach64_console_screen.ri.ri_ops.copycols = mach64_copycols;
+ mach64_console_screen.ri.ri_ops.erasecols = mach64_erasecols;
+ mach64_console_screen.ri.ri_ops.putchar = mach64_putchar;
+ mach64_console_screen.ri.ri_ops.cursor = mach64_cursor;
mach64_defaultscreen.nrows = mach64_console_screen.ri.ri_rows;
mach64_defaultscreen.ncols = mach64_console_screen.ri.ri_cols;
@@ -648,8 +643,8 @@
sc->sc_bg=WS_DEFAULT_BG;
/* really necessary? */
- mach64_defaultscreen.capabilities=mach64_console_screen.ri.ri_caps;
- mach64_defaultscreen.textops=&mach64_console_screen.ri.ri_ops;
+ mach64_defaultscreen.capabilities = mach64_console_screen.ri.ri_caps;
+ mach64_defaultscreen.textops = &mach64_console_screen.ri.ri_ops;
/* Initialize fonts */
/* XXX shouldn't that happen /before/ we call rasops_init()? */
@@ -679,6 +674,7 @@
{
struct rasops_info *ri=&scr->ri;
int cnt;
+
scr->sc = sc;
scr->type = type;
scr->mindispoffset = 0;
@@ -688,9 +684,9 @@
scr->cursorrow = 0;
cnt=type->nrows * type->ncols;
- scr->attrs=(long *)malloc(cnt * (sizeof(long) + sizeof(u_int)),
+ scr->attrs = (long *)malloc(cnt * (sizeof(long) + sizeof(u_int)),
M_DEVBUF, M_WAITOK);
- scr->chars=(u_int *)&scr->attrs[cnt];
+ scr->chars = (u_int *)&scr->attrs[cnt];
/*
* we allocate both chars and attributes in one chunk, attributes first
@@ -704,7 +700,7 @@
if (existing) {
scr->active = 1;
- ri->ri_flg|=RI_CLEAR;
+ ri->ri_flg |= RI_CLEAR;
if (setmode && mach64_set_screentype(sc, type)) {
panic("%s: failed to switch video mode",
sc->sc_dev.dv_xname);
@@ -1152,31 +1148,33 @@
mach64_init_lut(struct mach64_softc *sc)
{
int i,idx;
- idx=0;
- for(i=0;i<256;i++) {
- mach64_putpalreg(sc, i, rasops_cmap[idx], rasops_cmap[idx+1],
- rasops_cmap[idx+2]);
- idx+=3;
+
+ idx = 0;
+ for (i = 0; i < 256; i++) {
+ mach64_putpalreg(sc, i, rasops_cmap[idx], rasops_cmap[idx + 1],
+ rasops_cmap[idx + 2]);
+ idx += 3;
}
}
int
-mach64_putpalreg(struct mach64_softc *sc, uint8_t index, uint8_t r, uint8_t g, uint8_t b)
+mach64_putpalreg(struct mach64_softc *sc, uint8_t index, uint8_t r, uint8_t g,
+ uint8_t b)
{
- sc->sc_cmap_red[index]=r;
- sc->sc_cmap_green[index]=g;
- sc->sc_cmap_blue[index]=b;
+ sc->sc_cmap_red[index] = r;
+ sc->sc_cmap_green[index] = g;
+ sc->sc_cmap_blue[index] = b;
/*
* writing the dac index takes a while, in theory we can poll some
* register to see when it's ready - but we better avoid writing it
* unnecessarily
*/
- if(index!=sc->sc_dacw)
+ if (index != sc->sc_dacw)
{
regwb(sc, DAC_MASK, 0xff);
regwb(sc, DAC_WINDEX, index);
}
- sc->sc_dacw=index+1;
+ sc->sc_dacw = index + 1;
regwb(sc, DAC_DATA, r);
regwb(sc, DAC_DATA, g);
regwb(sc, DAC_DATA, b);
@@ -1215,7 +1213,7 @@
b = &sc->sc_cmap_blue[index];
for (i = 0; i < count; i++) {
- mach64_putpalreg(sc,index,*r, *g, *b);
+ mach64_putpalreg(sc, index, *r, *g, *b);
index++;
r++, g++, b++;
}
@@ -1272,11 +1270,12 @@
#elif defined(__powerpc__)
/* check if we're the /chosen console device */
int chosen, stdout, node, us;
- us=pcidev_to_ofdev(pa->pa_pc, pa->pa_tag);
+
+ us = pcidev_to_ofdev(pa->pa_pc, pa->pa_tag);
chosen = OF_finddevice("/chosen");
OF_getprop(chosen, "stdout", &stdout, 4);
node = OF_instance_to_package(stdout);
- return(us == node);
+ return (us == node);
#else
return 1;
#endif
@@ -1292,28 +1291,34 @@
struct rasops_info *ri=cookie;
struct mach64screen *scr=ri->ri_hw;
struct mach64_softc *sc=scr->sc;
- int x,y,wi=ri->ri_font->fontwidth,he=ri->ri_font->fontheight;
- if(scr->active) {
- x=scr->cursorcol*wi+ri->ri_xorigin;
- y=scr->cursorrow*he+ri->ri_yorigin;
- if(scr->cursordrawn) {
- mach64_bitblt(sc,x,y,x,y,wi,he,MIX_NOT_SRC,0xff);
+ int x, y, wi,he;
+
+ wi = ri->ri_font->fontwidth;
+ he = ri->ri_font->fontheight;
+
+ if (scr->active) {
+ x = scr->cursorcol * wi + ri->ri_xorigin;
+ y = scr->cursorrow * he + ri->ri_yorigin;
+ if (scr->cursordrawn) {
+ mach64_bitblt(sc, x, y, x, y, wi, he, MIX_NOT_SRC,
+ 0xff);
scr->cursordrawn=0;
}
- scr->cursorrow=row;
- scr->cursorcol=col;
- if((scr->cursoron=on)!=0)
+ scr->cursorrow = row;
+ scr->cursorcol = col;
+ if ((scr->cursoron = on) != 0)
{
- x=scr->cursorcol*wi+ri->ri_xorigin;
- y=scr->cursorrow*he+ri->ri_yorigin;
- mach64_bitblt(sc,x,y,x,y,wi,he,MIX_NOT_SRC,0xff);
- scr->cursordrawn=1;
+ x = scr->cursorcol * wi + ri->ri_xorigin;
+ y = scr->cursorrow * he + ri->ri_yorigin;
+ mach64_bitblt(sc, x, y, x, y, wi, he, MIX_NOT_SRC,
+ 0xff);
+ scr->cursordrawn = 1;
}
} else {
- scr->cursoron=on;
- scr->cursorrow=row;
- scr->cursorcol=col;
- scr->cursordrawn=0;
+ scr->cursoron = on;
+ scr->cursorrow = row;
+ scr->cursorcol = col;
+ scr->cursordrawn = 0;
}
}
@@ -1321,7 +1326,6 @@
int
mach64_mapchar(void *cookie, int uni, u_int *index)
{
-
return 0;
}
#endif
@@ -1333,29 +1337,32 @@
struct mach64screen *scr=ri->ri_hw;
struct mach64_softc *sc=scr->sc;
int offset=ri->ri_cols*row+col;
- scr->attrs[offset]=attr;
- scr->chars[offset]=c;
- if((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
- int fg,bg,uc;
+
+ scr->attrs[offset] = attr;
+ scr->chars[offset] = c;
+ if ((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
+ int fg, bg, uc;
uint8_t *data;
- int x,y,wi=ri->ri_font->fontwidth,he=ri->ri_font->fontheight;
+ int x, y, wi, he;
+ wi = ri->ri_font->fontwidth;
+ he = ri->ri_font->fontheight;
/*scr->putchar(cookie,row,col,c,attr);*/
if (!CHAR_IN_FONT(c, ri->ri_font))
return;
bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
- x=ri->ri_xorigin+col*wi;
- y=ri->ri_yorigin+row*he;
- if(c == 0x20) {
- mach64_rectfill(sc,x,y,wi,he,bg);
+ x = ri->ri_xorigin + col * wi;
+ y = ri->ri_yorigin + row * he;
+ if (c == 0x20) {
+ mach64_rectfill(sc, x, y, wi, he, bg);
} else {
uc = c-ri->ri_font->firstchar;
Home |
Main Index |
Thread Index |
Old Index