Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys use the bus independent stuff from ic/ct65550* and leave...
details: https://anonhg.NetBSD.org/src/rev/ecef21d416c0
branches: trunk
changeset: 761866:ecef21d416c0
user: macallan <macallan%NetBSD.org@localhost>
date: Wed Feb 09 21:21:32 2011 +0000
description:
use the bus independent stuff from ic/ct65550* and leave only the PCI specific
bits in pci/chipsfb.c
diffstat:
sys/conf/files | 8 +-
sys/dev/pci/chipsfb.c | 920 +------------------------------------------------
sys/dev/pci/files.pci | 9 +-
3 files changed, 44 insertions(+), 893 deletions(-)
diffs (truncated from 1059 to 300 lines):
diff -r 5b1a15041ecd -r ecef21d416c0 sys/conf/files
--- a/sys/conf/files Wed Feb 09 21:18:04 2011 +0000
+++ b/sys/conf/files Wed Feb 09 21:21:32 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.997 2011/02/06 23:13:04 jmcneill Exp $
+# $NetBSD: files,v 1.998 2011/02/09 21:21:32 macallan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20100430
@@ -1102,12 +1102,18 @@
file dev/ic/vga_raster.c vga_rasterconsole needs-flag
file dev/ic/vga_subr.c vga | vga_rasterconsole
file dev/ic/vga_common.c vga | vga_rasterconsole
+
# Integraphics Systems IGA168x and CyberPro framebuffers (linear non-VGA mode)
#
device igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons, videomode
file dev/ic/igsfb.c igsfb needs-flag
file dev/ic/igsfb_subr.c igsfb
+device chipsfb: wsemuldisplaydev, rasops8, vcons, videomode
+file dev/ic/ct65550.c chipsfb
+defflag opt_chipsfb.h CHIPSFB_DEBUG
+defflag opt_chipsfb.h CHIPSFB_WAIT
+
# STI (hp graphics)
device sti: wsemuldisplaydev
file dev/ic/sti.c sti & (sti_pci | sti_gedoens)
diff -r 5b1a15041ecd -r ecef21d416c0 sys/dev/pci/chipsfb.c
--- a/sys/dev/pci/chipsfb.c Wed Feb 09 21:18:04 2011 +0000
+++ b/sys/dev/pci/chipsfb.c Wed Feb 09 21:21:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chipsfb.c,v 1.25 2011/01/22 15:14:27 cegger Exp $ */
+/* $NetBSD: chipsfb.c,v 1.26 2011/02/09 21:21:32 macallan Exp $ */
/*
* Copyright (c) 2006 Michael Lorenz
@@ -31,228 +31,43 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.25 2011/01/22 15:14:27 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.26 2011/02/09 21:21:32 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/callout.h>
-#include <sys/lwp.h>
#include <sys/kauth.h>
-#include <dev/videomode/videomode.h>
-
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#include <dev/pci/pciio.h>
-#include <dev/pci/chipsfbreg.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-#include <dev/wsfont/wsfont.h>
-#include <dev/rasops/rasops.h>
-#include <dev/wscons/wsdisplay_vconsvar.h>
#include <dev/pci/wsdisplay_pci.h>
-#include <dev/i2c/i2cvar.h>
+
+#include <dev/ic/ct65550reg.h>
+#include <dev/ic/ct65550var.h>
#include "opt_wsemul.h"
#include "opt_chipsfb.h"
-struct chipsfb_softc {
- struct device sc_dev;
+struct chipsfb_pci_softc {
+ struct chipsfb_softc sc_chips;
pci_chipset_tag_t sc_pc;
pcitag_t sc_pcitag;
-
- bus_space_tag_t sc_memt;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_memh;
-
- bus_space_tag_t sc_fbt;
- bus_space_tag_t sc_ioregt;
- bus_space_handle_t sc_fbh;
- bus_space_handle_t sc_ioregh;
- bus_addr_t sc_fb, sc_ioreg;
- bus_size_t sc_fbsize, sc_ioregsize;
-
- void *sc_ih;
-
- size_t memsize;
-
- int bits_per_pixel;
- int width, height, linebytes;
-
- int sc_mode;
- uint32_t sc_bg;
-
- u_char sc_cmap_red[256];
- u_char sc_cmap_green[256];
- u_char sc_cmap_blue[256];
- int sc_dacw;
-
- /*
- * I2C stuff
- * DDC2 clock is on GPIO1, data on GPIO0
- */
- struct i2c_controller sc_i2c;
- uint8_t sc_edid[1024];
- int sc_edidbytes; /* number of bytes read from the monitor */
-
- struct vcons_data vd;
};
-static struct vcons_screen chipsfb_console_screen;
-
-extern const u_char rasops_cmap[768];
-
-static int chipsfb_match(device_t, cfdata_t, void *);
-static void chipsfb_attach(device_t, device_t, void *);
-
-CFATTACH_DECL(chipsfb, sizeof(struct chipsfb_softc), chipsfb_match,
- chipsfb_attach, NULL, NULL);
-
-static void chipsfb_init(struct chipsfb_softc *);
-
-static void chipsfb_cursor(void *, int, int, int);
-static void chipsfb_copycols(void *, int, int, int, int);
-static void chipsfb_erasecols(void *, int, int, int, long);
-static void chipsfb_copyrows(void *, int, int, int);
-static void chipsfb_eraserows(void *, int, int, long);
-
-#if 0
-static int chipsfb_allocattr(void *, int, int, int, long *);
-static void chipsfb_scroll(void *, void *, int);
-static int chipsfb_load_font(void *, void *, struct wsdisplay_font *);
-#endif
-
-static int chipsfb_putcmap(struct chipsfb_softc *,
- struct wsdisplay_cmap *);
-static int chipsfb_getcmap(struct chipsfb_softc *,
- struct wsdisplay_cmap *);
-static int chipsfb_putpalreg(struct chipsfb_softc *, uint8_t, uint8_t,
- uint8_t, uint8_t);
-
-static void chipsfb_bitblt(struct chipsfb_softc *, int, int, int, int,
- int, int, uint8_t);
-static void chipsfb_rectfill(struct chipsfb_softc *, int, int, int, int,
- int);
-static void chipsfb_putchar(void *, int, int, u_int, long);
-static void chipsfb_setup_mono(struct chipsfb_softc *, int, int, int,
- int, uint32_t, uint32_t);
-static void chipsfb_feed(struct chipsfb_softc *, int, uint8_t *);
-
-#if 0
-static void chipsfb_showpal(struct chipsfb_softc *);
-#endif
-static void chipsfb_restore_palette(struct chipsfb_softc *);
-
-static void chipsfb_wait_idle(struct chipsfb_softc *);
-
-static uint32_t chipsfb_probe_vram(struct chipsfb_softc *);
-
-struct wsscreen_descr chipsfb_defaultscreen = {
- "default", /* name */
- 0, 0, /* ncols, nrows */
- NULL, /* textops */
- 8, 16, /* fontwidth, fontheight */
- WSSCREEN_WSCOLORS | WSSCREEN_HILIT, /* capabilities */
- NULL, /* modecookie */
-};
-
-const struct wsscreen_descr *_chipsfb_scrlist[] = {
- &chipsfb_defaultscreen,
- /* XXX other formats, graphics screen? */
-};
-
-struct wsscreen_list chipsfb_screenlist = {
- sizeof(_chipsfb_scrlist) / sizeof(struct wsscreen_descr *), _chipsfb_scrlist
-};
-
-static int chipsfb_ioctl(void *, void *, u_long, void *, int,
+static int chipsfb_pci_match(device_t, cfdata_t, void *);
+static void chipsfb_pci_attach(device_t, device_t, void *);
+static int chipsfb_pci_ioctl(void *, void *, u_long, void *, int,
struct lwp *);
-static paddr_t chipsfb_mmap(void *, void *, off_t, int);
-static void chipsfb_clearscreen(struct chipsfb_softc *);
-static void chipsfb_init_screen(void *, struct vcons_screen *, int,
- long *);
-
-struct wsdisplay_accessops chipsfb_accessops = {
- chipsfb_ioctl,
- chipsfb_mmap,
- NULL, /* vcons_alloc_screen */
- NULL, /* vcons_free_screen */
- NULL, /* vcons_show_screen */
- NULL, /* load_font */
- NULL, /* polls */
- NULL, /* scroll */
-};
-
-/*
- * Inline functions for getting access to register aperture.
- */
-static inline void
-chipsfb_write32(struct chipsfb_softc *sc, uint32_t reg, uint32_t val)
-{
- bus_space_write_4(sc->sc_fbt, sc->sc_fbh, reg, val);
-}
-
-static inline uint32_t
-chipsfb_read32(struct chipsfb_softc *sc, uint32_t reg)
-{
- return bus_space_read_4(sc->sc_fbt, sc->sc_fbh, reg);
-}
-
-static inline void
-chipsfb_write_vga(struct chipsfb_softc *sc, uint32_t reg, uint8_t val)
-{
- bus_space_write_1(sc->sc_iot, sc->sc_ioregh, reg, val);
-}
-
-static inline uint8_t
-chipsfb_read_vga(struct chipsfb_softc *sc, uint32_t reg)
-{
- return bus_space_read_1(sc->sc_iot, sc->sc_ioregh, reg);
-}
-
-static inline uint8_t
-chipsfb_read_indexed(struct chipsfb_softc *sc, uint32_t reg, uint8_t index)
-{
-
- chipsfb_write_vga(sc, reg & 0xfffe, index);
- return chipsfb_read_vga(sc, reg | 0x0001);
-}
-
-static inline void
-chipsfb_write_indexed(struct chipsfb_softc *sc, uint32_t reg, uint8_t index,
- uint8_t val)
-{
-
- chipsfb_write_vga(sc, reg & 0xfffe, index);
- chipsfb_write_vga(sc, reg | 0x0001, val);
-}
-
-static void
-chipsfb_wait_idle(struct chipsfb_softc *sc)
-{
-
-#ifdef CHIPSFB_DEBUG
- chipsfb_write32(sc, CT_OFF_FB + (800 * 598) - 4, 0);
-#endif
-
- /* spin until the blitter is idle */
- while ((chipsfb_read32(sc, CT_BLT_CONTROL) & BLT_IS_BUSY) != 0) {
- }
-
-#ifdef CHIPSFB_DEBUG
- chipsfb_write32(sc, CT_OFF_FB + (800 * 598) - 4, 0xffffffff);
-#endif
-}
+CFATTACH_DECL_NEW(chipsfb_pci, sizeof(struct chipsfb_pci_softc),
+ chipsfb_pci_match, chipsfb_pci_attach, NULL, NULL);
static int
-chipsfb_match(device_t parent, cfdata_t match, void *aux)
+chipsfb_pci_match(device_t parent, cfdata_t match, void *aux)
{
struct pci_attach_args *pa = (struct pci_attach_args *)aux;
@@ -269,736 +84,69 @@
}
static void
-chipsfb_attach(device_t parent, device_t self, void *aux)
+chipsfb_pci_attach(device_t parent, device_t self, void *aux)
{
- struct chipsfb_softc *sc = device_private(self);
+ struct chipsfb_pci_softc *scp = device_private(self);
+ struct chipsfb_softc *sc = &scp->sc_chips;
struct pci_attach_args *pa = aux;
char devinfo[256];
- struct wsemuldisplaydev_attach_args aa;
- struct rasops_info *ri;
- prop_dictionary_t dict;
pcireg_t screg;
- ulong defattr;
- bool console = false;
- int width, height, i, j;
- uint32_t bg, fg, ul;
- dict = device_properties(self);
Home |
Main Index |
Thread Index |
Old Index