Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcmips/tx code clean up.
details: https://anonhg.NetBSD.org/src/rev/cef3ee142276
branches: trunk
changeset: 485296:cef3ee142276
user: uch <uch%NetBSD.org@localhost>
date: Mon Apr 24 13:02:13 2000 +0000
description:
code clean up.
diffstat:
sys/arch/hpcmips/tx/tx39.c | 51 ++---
sys/arch/hpcmips/tx/tx3912video.c | 314 ++++++++++++++++------------------
sys/arch/hpcmips/tx/tx3912videovar.h | 34 +--
3 files changed, 183 insertions(+), 216 deletions(-)
diffs (truncated from 618 to 300 lines):
diff -r 8a2def46609f -r cef3ee142276 sys/arch/hpcmips/tx/tx39.c
--- a/sys/arch/hpcmips/tx/tx39.c Mon Apr 24 13:01:23 2000 +0000
+++ b/sys/arch/hpcmips/tx/tx39.c Mon Apr 24 13:02:13 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: tx39.c,v 1.15 2000/04/11 17:57:43 uch Exp $ */
+/* $NetBSD: tx39.c,v 1.16 2000/04/24 13:02:14 uch Exp $ */
/*
- * Copyright (c) 1999, 2000, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000 UCHIYAMA Yasushi
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -9,20 +9,20 @@
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- * 2. The name of the developer may NOT be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -165,23 +165,14 @@
caddr_t *kernend;
{
#ifdef TX391X
- tx_chipset_tag_t tc;
- u_int32_t fb_start, fb_addr, fb_size, fb_line_bytes;
-
- /* Initialize to access TX39 configuration register */
- tc = tx_conf_get_tag();
+ paddr_t fb_end;
- fb_start = MIPS_KSEG0_TO_PHYS(*kernend);
- tx3912video_init(tc, fb_start, bootinfo->fb_width,
- bootinfo->fb_height, &fb_addr, &fb_size,
- &fb_line_bytes);
-
- /* Setup bootinfo */
- bootinfo->fb_line_bytes = fb_line_bytes;
- bootinfo->fb_addr = (unsigned char*)MIPS_PHYS_TO_KSEG1(fb_addr);
-
+ fb_end = MIPS_KSEG0_TO_PHYS(mem_clusters[0].start +
+ mem_clusters[0].size - 1);
+ tx3912video_init(MIPS_KSEG0_TO_PHYS(*kernend), &fb_end);
+
/* Skip V-RAM area */
- *kernend += fb_size;
+ *kernend = (caddr_t)MIPS_PHYS_TO_KSEG0(fb_end);
#endif /* TX391X */
#ifdef TX392X
/*
diff -r 8a2def46609f -r cef3ee142276 sys/arch/hpcmips/tx/tx3912video.c
--- a/sys/arch/hpcmips/tx/tx3912video.c Mon Apr 24 13:01:23 2000 +0000
+++ b/sys/arch/hpcmips/tx/tx3912video.c Mon Apr 24 13:02:13 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: tx3912video.c,v 1.9 2000/04/03 03:35:38 sato Exp $ */
+/* $NetBSD: tx3912video.c,v 1.10 2000/04/24 13:02:13 uch Exp $ */
/*
- * Copyright (c) 1999, 2000, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000 UCHIYAMA Yasushi
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -9,22 +9,23 @@
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- * 2. The name of the developer may NOT be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+
#include "opt_tx39_debug.h"
#include "hpcfb.h"
@@ -34,7 +35,7 @@
#include <sys/extent.h>
#include <machine/bus.h>
-#include <machine/bootinfo.h> /* bootinfo */
+#include <machine/bootinfo.h>
#include <hpcmips/tx/tx39var.h>
#include <hpcmips/tx/tx3912videovar.h>
@@ -48,31 +49,20 @@
#endif
#include <machine/autoconf.h> /* XXX */
-#undef TX3912VIDEO_DEBUG
+#define TX3912VIDEO_DEBUG
-void tx3912video_framebuffer_init __P((tx_chipset_tag_t, u_int32_t,
- u_int32_t));
-int tx3912video_framebuffer_alloc __P((tx_chipset_tag_t, u_int32_t,
- int, int, int, u_int32_t*,
- u_int32_t*));
-void tx3912video_reset __P((tx_chipset_tag_t));
-void tx3912video_resolution_init __P((tx_chipset_tag_t, int, int));
-int tx3912video_fbdepth __P((tx_chipset_tag_t, int));
+static struct tx3912video_chip {
+ tx_chipset_tag_t vc_tc;
-int tx3912video_match __P((struct device*, struct cfdata*, void*));
-void tx3912video_attach __P((struct device*, struct device*, void*));
-int tx3912video_print __P((void*, const char*));
-
-struct tx3912video_chip {
- u_int32_t vc_fbaddr;
- u_int32_t vc_fbsize;
- int vc_fbdepth;
- int vc_fbwidth;
- int vc_fbheight;
+ paddr_t vc_fbaddr;
+ size_t vc_fbsize;
+ int vc_fbdepth;
+ int vc_fbwidth;
+ int vc_fbheight;
void (*vc_drawline) __P((int, int, int, int));
void (*vc_drawdot) __P((int, int));
-};
+} tx3912video_chip;
struct tx3912video_softc {
struct device sc_dev;
@@ -80,19 +70,22 @@
struct tx3912video_chip *sc_chip;
};
-struct fb_attach_args {
- const char *fba_name;
-};
+void tx3912video_framebuffer_init __P((struct tx3912video_chip *));
+int tx3912video_framebuffer_alloc __P((struct tx3912video_chip *, paddr_t,
+ paddr_t *));
+void tx3912video_reset __P((struct tx3912video_chip *));
+void tx3912video_resolution_init __P((struct tx3912video_chip *));
+
+int tx3912video_match __P((struct device *, struct cfdata *, void *));
+void tx3912video_attach __P((struct device *, struct device *, void *));
+int tx3912video_print __P((void *, const char *));
struct cfattach tx3912video_ca = {
sizeof(struct tx3912video_softc), tx3912video_match,
tx3912video_attach
};
-/* console */
-struct tx3912video_chip tx3912video_chip;
-
-void tx3912video_attach_drawfunc __P((struct tx3912video_chip*));
+void __tx3912video_attach_drawfunc __P((struct tx3912video_chip*));
int
tx3912video_match(parent, cf, aux)
@@ -100,7 +93,7 @@
struct cfdata *cf;
void *aux;
{
- return 1;
+ return (1);
}
void
@@ -109,23 +102,28 @@
struct device *self;
void *aux;
{
- struct txsim_attach_args *ta = aux;
- struct tx3912video_softc *sc = (void*)self;
- tx_chipset_tag_t tc = ta->ta_tc;
- struct mainbus_attach_args ma; /* XXX */
- txreg_t reg;
-
- sc->sc_chip = &tx3912video_chip;
+ struct tx3912video_softc *sc = (void *)self;
+ struct tx3912video_chip *chip;
+ const char *depth_print[] = {
+ [TX3912_VIDEOCTRL1_BITSEL_MONOCHROME] = "monochrome",
+ [TX3912_VIDEOCTRL1_BITSEL_2BITGREYSCALE] = "2bit greyscale",
+ [TX3912_VIDEOCTRL1_BITSEL_4BITGREYSCALE] = "4bit greyscale",
+ [TX3912_VIDEOCTRL1_BITSEL_8BITCOLOR] = "8bit color"
+ };
- printf(": ");
- tx3912video_fbdepth(tc, 1);
- printf(", frame buffer 0x%08x-0x%08x", sc->sc_chip->vc_fbaddr,
- sc->sc_chip->vc_fbaddr + sc->sc_chip->vc_fbsize);
-
- printf("\n");
+ sc->sc_chip = chip = &tx3912video_chip;
+ /* print video module information */
+ printf(": %s, frame buffer 0x%08x-0x%08x\n",
+ depth_print[(ffs(chip->vc_fbdepth) - 1) & 0x3],
+ (unsigned)chip->vc_fbaddr,
+ (unsigned)(chip->vc_fbaddr + chip->vc_fbsize));
+
+ /* if serial console, power off video module */
#ifndef TX3912VIDEO_DEBUG
if (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) {
+ tx_chipset_tag_t tc = ta->ta_tc;
+ txreg_t reg;
printf("%s: power off\n", sc->sc_dev.dv_xname);
reg = tx_conf_read(tc, TX3912_VIDEOCTRL1_REG);
reg &= ~(TX3912_VIDEOCTRL1_DISPON |
@@ -134,9 +132,9 @@
}
#endif /* TX3912VIDEO_DEBUG */
- /* attach debug draw routine */
- tx3912video_attach_drawfunc(sc->sc_chip);
-
+ /* attach debug draw routine (debugging use) */
+ __tx3912video_attach_drawfunc(sc->sc_chip);
+
/* Attach frame buffer device */
#if NHPCFB > 0
if (!(bootinfo->bi_cnuse & BI_CNUSE_SERIAL)) {
@@ -144,9 +142,12 @@
panic("tx3912video_attach: can't init fb console");
}
}
- ma.ma_name = "bivideo"; /* XXX */
- config_found(self, &ma, tx3912video_print);
-#endif
+ {
+ struct mainbus_attach_args ma; /* XXX */
+ ma.ma_name = "bivideo"; /* XXX */
+ config_found(self, &ma, tx3912video_print);
+ }
+#endif /* NHPCFB > 0 */
}
int
@@ -154,32 +155,31 @@
void *aux;
const char *pnp;
{
- return pnp ? QUIET : UNCONF;
+ return (pnp ? QUIET : UNCONF);
}
int
-tx3912video_init(tc, fb_start, fb_width, fb_height, fb_addr, fb_size,
- fb_line_bytes)
- tx_chipset_tag_t tc;
- u_int32_t fb_start; /* Physical address */
Home |
Main Index |
Thread Index |
Old Index