Date: Tue, 28 Apr 2009 20:49:47 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r191638 - head/sys/dev/fb Message-ID: <200904282049.n3SKnlO6059586@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Tue Apr 28 20:49:47 2009 New Revision: 191638 URL: http://svn.freebsd.org/changeset/base/191638 Log: - Change some softc members to be unsigned where more appropriate. - Add some missing const. - Move the size of the window spun by the registers to the softc as neither using va_mem_size for this nor va_mem_base for the start of the bus addresses is appropriate. MFC after: 1 week Modified: head/sys/dev/fb/creator.c Modified: head/sys/dev/fb/creator.c ============================================================================== --- head/sys/dev/fb/creator.c Tue Apr 28 20:39:21 2009 (r191637) +++ head/sys/dev/fb/creator.c Tue Apr 28 20:49:47 2009 (r191638) @@ -66,12 +66,13 @@ struct creator_softc { struct resource *sc_reg[FFB_NREG]; bus_space_tag_t sc_bt[FFB_NREG]; bus_space_handle_t sc_bh[FFB_NREG]; + u_long sc_reg_size; - int sc_height; - int sc_width; + u_int sc_height; + u_int sc_width; - int sc_xmargin; - int sc_ymargin; + u_int sc_xmargin; + u_int sc_ymargin; const u_char *sc_font; @@ -82,7 +83,7 @@ struct creator_softc { int sc_fontw_cache; int sc_pmask_cache; - int sc_flags; + u_int sc_flags; #define CREATOR_AFB (1 << 0) #define CREATOR_CONSOLE (1 << 1) #define CREATOR_CUREN (1 << 2) @@ -96,7 +97,7 @@ struct creator_softc { bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val)) #define C(r, g, b) ((b << 16) | (g << 8) | (r)) -static const uint32_t creator_cmap[] = { +static const uint32_t const creator_cmap[] = { C(0x00, 0x00, 0x00), /* black */ C(0x00, 0x00, 0xff), /* blue */ C(0x00, 0xff, 0x00), /* green */ @@ -120,7 +121,7 @@ static const struct { vm_offset_t virt; vm_paddr_t phys; vm_size_t size; -} creator_fb_map[] = { +} const creator_fb_map[] = { { FFB_VIRT_SFB8R, FFB_PHYS_SFB8R, FFB_SIZE_SFB8R }, { FFB_VIRT_SFB8G, FFB_PHYS_SFB8G, FFB_SIZE_SFB8G }, { FFB_VIRT_SFB8B, FFB_PHYS_SFB8B, FFB_SIZE_SFB8B }, @@ -252,8 +253,6 @@ static video_switch_t creatorvidsw = { .clear = creator_clear, .fill_rect = creator_fill_rect, .bitblt = creator_bitblt, - NULL, /* XXX brain damage */ - NULL, /* XXX brain damage */ .diag = creator_diag, .save_cursor_palette = creator_save_cursor_palette, .load_cursor_palette = creator_load_cursor_palette, @@ -271,7 +270,7 @@ RENDERER(creator, 0, txtrndrsw, gfb_set) RENDERER_MODULE(creator, gfb_set); -static const u_char creator_mouse_pointer[64][8] __aligned(8) = { +static const u_char const creator_mouse_pointer[64][8] __aligned(8) = { { 0x00, 0x00, }, /* ............ */ { 0x80, 0x00, }, /* *........... */ { 0xc0, 0x00, }, /* **.......... */ @@ -953,20 +952,19 @@ creator_bus_attach(device_t dev) sc->sc_bh[i] = rman_get_bushandle(sc->sc_reg[i]); } /* - * The XFree86/Xorg sunffb(4) expects to be able to access the + * The XFree86/X.Org sunffb(4) expects to be able to access the * memory spanned by the first and the last resource as one chunk * via creator_fb_mmap(), using offsets from the first resource, * even though the backing resources are actually non-continuous. * So make sure that the memory we provide is at least backed by * increasing resources. */ - adp->va_mem_base = rman_get_start(sc->sc_reg[0]); for (i = 1; i < FFB_NREG && sc->sc_reg[i] != NULL && rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]); i++) ; - adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) - - adp->va_mem_base + 1; + sc->sc_reg_size = rman_get_end(sc->sc_reg[i - 1]) - + rman_get_start(sc->sc_reg[0]) + 1; if (!(sc->sc_flags & CREATOR_CONSOLE)) { if ((sw = vid_get_switch(CREATOR_DRIVER_NAME)) == NULL) { @@ -1058,7 +1056,7 @@ creator_fb_mmap(struct cdev *dev, vm_off /* * NB: This is a special implementation based on the /dev/fb - * requirements of the XFree86/Xorg sunffb(4). + * requirements of the XFree86/X.Org sunffb(4). */ sc = dev->si_drv1; for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) { @@ -1066,7 +1064,7 @@ creator_fb_mmap(struct cdev *dev, vm_off offset < creator_fb_map[i].virt + creator_fb_map[i].size) { offset += creator_fb_map[i].phys - creator_fb_map[i].virt; - if (offset >= sc->sc_va.va_mem_size) + if (offset >= sc->sc_reg_size) return (EINVAL); *paddr = sc->sc_bh[0] + offset; return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904282049.n3SKnlO6059586>