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.25 (requested by martin in...
details: https://anonhg.NetBSD.org/src/rev/530840df9ce3
branches: netbsd-3
changeset: 576032:530840df9ce3
user: tron <tron%NetBSD.org@localhost>
date: Wed Jun 08 11:45:53 2005 +0000
description:
Pull up revision 1.25 (requested by martin in ticket #377):
fixed formatting
diffstat:
sys/dev/pci/machfb.c | 247 +++++++++++++++++++++++++++++---------------------
1 files changed, 142 insertions(+), 105 deletions(-)
diffs (truncated from 618 to 300 lines):
diff -r 3943a692543a -r 530840df9ce3 sys/dev/pci/machfb.c
--- a/sys/dev/pci/machfb.c Wed Jun 08 11:42:17 2005 +0000
+++ b/sys/dev/pci/machfb.c Wed Jun 08 11:45:53 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machfb.c,v 1.23.2.1 2005/06/08 11:42:17 tron Exp $ */
+/* $NetBSD: machfb.c,v 1.23.2.2 2005/06/08 11:45:53 tron Exp $ */
/*
* Copyright (c) 2002 Bang Jun-Young
@@ -32,7 +32,8 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machfb.c,v 1.23.2.1 2005/06/08 11:42:17 tron Exp $");
+__KERNEL_RCSID(0,
+ "$NetBSD: machfb.c,v 1.23.2.2 2005/06/08 11:45:53 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -108,8 +109,10 @@
int has_dsp;
int bits_per_pixel;
- int max_x, max_y;
- int virt_x, virt_y;
+ int max_x;
+ int max_y;
+ int virt_x;
+ int virt_y;
int color_depth;
int mem_freq;
@@ -250,30 +253,33 @@
const struct wsscreen_descr *, u_int *);
int mach64_set_screentype(struct mach64_softc *,
const struct wsscreen_descr *);
-int mach64_is_console(struct pci_attach_args *);
+int mach64_is_console(struct pci_attach_args *);
void mach64_cursor(void *, int, int, int);
-int mach64_mapchar(void *, int, u_int *);
+int mach64_mapchar(void *, int, u_int *);
void mach64_putchar(void *, int, int, u_int, long);
void mach64_copycols(void *, int, int, int, int);
void mach64_erasecols(void *, int, int, int, long);
void mach64_copyrows(void *, int, int, int);
void mach64_eraserows(void *, int, int, long);
-int mach64_allocattr(void *, int, int, int, long *);
+int mach64_allocattr(void *, int, int, int, long *);
void mach64_clearscreen(struct mach64_softc *);
void mach64_scroll(void *, void *, int);
-int mach64_putcmap(struct mach64_softc *, struct wsdisplay_cmap *);
-int mach64_getcmap(struct mach64_softc *, struct wsdisplay_cmap *);
-int mach64_putpalreg(struct mach64_softc *, uint8_t, uint8_t, uint8_t, uint8_t);
-void mach64_bitblt(struct mach64_softc *, int, int, int, int, int, int, int, int) ;
-void mach64_rectfill(struct mach64_softc *, int, int, int, int, int);
-void mach64_setup_mono(struct mach64_softc *, int, int, int, int, uint32_t, uint32_t);
+int mach64_putcmap(struct mach64_softc *, struct wsdisplay_cmap *);
+int mach64_getcmap(struct mach64_softc *, struct wsdisplay_cmap *);
+int mach64_putpalreg(struct mach64_softc *, uint8_t, uint8_t, uint8_t,
+ uint8_t);
+void mach64_bitblt(struct mach64_softc *, int, int, int, int, int, int, int,
+ int) ;
+void mach64_rectfill(struct mach64_softc *, int, int, int, int, int);
+void mach64_setup_mono(struct mach64_softc *, int, int, int, int, uint32_t,
+ uint32_t);
void mach64_feed_bytes(struct mach64_softc *, int, uint8_t *);
-void mach64_showpal(struct mach64_softc *);
-int mach64_getwschar(void *, struct wsdisplay_char *);
-int mach64_putwschar(void *, struct wsdisplay_char *);
+void mach64_showpal(struct mach64_softc *);
+int mach64_getwschar(void *, struct wsdisplay_char *);
+int mach64_putwschar(void *, struct wsdisplay_char *);
void set_address(struct rasops_info *, bus_addr_t);
@@ -364,14 +370,14 @@
_mach64_scrlist
};
-int mach64_ioctl(void *, u_long, caddr_t, int, struct proc *);
+int mach64_ioctl(void *, u_long, caddr_t, int, struct proc *);
paddr_t mach64_mmap(void *, off_t, int);
-int mach64_alloc_screen(void *, const struct wsscreen_descr *, void **,
+int mach64_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
void mach64_free_screen(void *, void *);
-int mach64_show_screen(void *, void *, int, void (*)(void *, int, int),
+int mach64_show_screen(void *, void *, int, void (*)(void *, int, int),
void *);
-int mach64_load_font(void *, void *, struct wsdisplay_font *);
+int mach64_load_font(void *, void *, struct wsdisplay_font *);
struct wsdisplay_accessops mach64_accessops = {
mach64_ioctl,
@@ -379,13 +385,13 @@
mach64_alloc_screen,
mach64_free_screen,
mach64_show_screen,
- NULL, /* load_font */
- NULL, /* polls */
+ NULL, /* load_font */
+ NULL, /* polls */
mach64_getwschar, /* getwschar */
mach64_putwschar, /* putwschar */
- NULL, /* scroll */
- NULL, /* getborder */
- NULL /* setborder */
+ NULL, /* scroll */
+ NULL, /* getborder */
+ NULL /* setborder */
};
/*
@@ -400,37 +406,34 @@
static inline u_int32_t
regr(struct mach64_softc *sc, u_int32_t index)
{
-
return bus_space_read_4(sc->sc_regt, sc->sc_regh, index);
}
static inline u_int8_t
regrb(struct mach64_softc *sc, u_int32_t index)
{
-
return bus_space_read_1(sc->sc_regt, sc->sc_regh, index);
}
static inline void
regw(struct mach64_softc *sc, u_int32_t index, u_int32_t data)
{
-
bus_space_write_4(sc->sc_regt, sc->sc_regh, index, data);
- bus_space_barrier(sc->sc_regt, sc->sc_regh, index, 4, BUS_SPACE_BARRIER_WRITE);
+ bus_space_barrier(sc->sc_regt, sc->sc_regh, index, 4,
+ BUS_SPACE_BARRIER_WRITE);
}
static inline void
regwb(struct mach64_softc *sc, u_int32_t index, u_int8_t data)
{
-
bus_space_write_1(sc->sc_regt, sc->sc_regh, index, data);
- bus_space_barrier(sc->sc_regt, sc->sc_regh, index, 1, BUS_SPACE_BARRIER_WRITE);
+ bus_space_barrier(sc->sc_regt, sc->sc_regh, index, 1,
+ BUS_SPACE_BARRIER_WRITE);
}
static inline void
regwb_pll(struct mach64_softc *sc, u_int32_t index, u_int8_t data)
{
-
regwb(sc, CLOCK_CNTL + 1, (index << 2) | PLL_WR_EN);
regwb(sc, CLOCK_CNTL + 2, data);
regwb(sc, CLOCK_CNTL + 1, (index << 2) & ~PLL_WR_EN);
@@ -439,7 +442,6 @@
static inline void
wait_for_fifo(struct mach64_softc *sc, u_int8_t v)
{
-
while ((regr(sc, FIFO_STAT) & 0xffff) > (0x8000 >> v))
;
}
@@ -447,7 +449,6 @@
static inline void
wait_for_idle(struct mach64_softc *sc)
{
-
wait_for_fifo(sc, 16);
while ((regr(sc, GUI_STAT) & 1) != 0)
;
@@ -510,7 +511,8 @@
(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_pcitag, reg)&0xfffffff0;
+ sc->sc_bars[bar].vb_busaddr=pci_conf_read(sc->sc_pc,
+ sc->sc_pcitag, reg)&0xfffffff0;
}
sc->sc_memt = pa->pa_memt;
@@ -523,8 +525,8 @@
if (mach64_chip_id == PCI_PRODUCT_ATI_MACH64_CT ||
((mach64_chip_id == PCI_PRODUCT_ATI_MACH64_VT ||
- mach64_chip_id == PCI_PRODUCT_ATI_RAGE_II) &&
- (mach64_chip_rev & 0x07) == 0))
+ mach64_chip_id == PCI_PRODUCT_ATI_RAGE_II) &&
+ (mach64_chip_rev & 0x07) == 0))
sc->has_dsp = 0;
else
sc->has_dsp = 1;
@@ -538,8 +540,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
@@ -574,7 +576,8 @@
mach64_get_mode(sc, &default_mode);
setmode = 0;
} else {
- memcpy(&default_mode, &mach64_modes[4], sizeof(struct videomode));
+ memcpy(&default_mode, &mach64_modes[4], sizeof(struct
+ videomode));
setmode = 1;
}
#else
@@ -614,15 +617,20 @@
mach64_console_screen.active=1;
sc->active=&mach64_console_screen;
- rasops_init(&mach64_console_screen.ri, mach64_console_screen.ri.ri_height / 16,
- mach64_console_screen.ri.ri_width / 8); /* XXX width/height are nonsense */
+ /* XXX width/height are nonsense, we only want to pick a font */
+ rasops_init(&mach64_console_screen.ri,
+ mach64_console_screen.ri.ri_height / 16,
+ mach64_console_screen.ri.ri_width / 8);
+
+ /* now get the real values */
rasops_reconfig(&mach64_console_screen.ri,
- mach64_console_screen.ri.ri_height / mach64_console_screen.ri.ri_font->fontheight,
- mach64_console_screen.ri.ri_width / mach64_console_screen.ri.ri_font->fontwidth);
+ mach64_console_screen.ri.ri_height /
+ mach64_console_screen.ri.ri_font->fontheight,
+ mach64_console_screen.ri.ri_width /
+ mach64_console_screen.ri.ri_font->fontwidth);
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;
@@ -634,12 +642,11 @@
mach64_defaultscreen.nrows = mach64_console_screen.ri.ri_rows;
mach64_defaultscreen.ncols = mach64_console_screen.ri.ri_cols;
- mach64_allocattr(&mach64_console_screen.ri, WS_DEFAULT_FG, WS_DEFAULT_BG, 0,
- &defattr);
+ mach64_allocattr(&mach64_console_screen.ri, WS_DEFAULT_FG,
+ WS_DEFAULT_BG, 0, &defattr);
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;
@@ -651,8 +658,8 @@
if (console) {
mach64_init_screen(sc, &mach64_console_screen,
&mach64_defaultscreen, 1, &defattr, setmode);
- wsdisplay_cnattach(&mach64_defaultscreen, &mach64_console_screen.ri,
- 0, 0, defattr);
+ wsdisplay_cnattach(&mach64_defaultscreen,
+ &mach64_console_screen.ri, 0, 0, defattr);
}
mach64_init_lut(sc);
@@ -681,12 +688,14 @@
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];
- /* we allocate both chars and attributes in one chunk, attributes first because
- they have the (potentially) bigger alignment */
-
+
+ /*
+ * we allocate both chars and attributes in one chunk, attributes first
+ * because they have the (potentially) bigger alignment
+ */
ri->ri_depth = sc->bits_per_pixel;
ri->ri_width = default_mode.hdisplay;
ri->ri_height = default_mode.vdisplay;
@@ -982,8 +991,7 @@
case 8:
regw(sc, DP_PIX_WIDTH, HOST_8BPP | SRC_8BPP | DST_8BPP);
regw(sc, DP_CHAIN_MASK, DP_CHAIN_8BPP);
- /* XXX huh? We /want/ an 8 bit per channel palette! */
- /*regw(sc, DAC_CNTL, regr(sc, DAC_CNTL) & ~DAC_8BIT_EN);*/
+ /* We want 8 bit per channel */
regw(sc, DAC_CNTL, regr(sc, DAC_CNTL) | DAC_8BIT_EN);
break;
#if 0
@@ -1146,7 +1154,8 @@
int i,idx;
idx=0;
Home |
Main Index |
Thread Index |
Old Index