From 92203533790b3281f55dda5d8939126f570318ae Mon Sep 17 00:00:00 2001 From: jmmv Date: Wed, 29 Aug 2007 13:02:41 +0000 Subject: [PATCH] Move the definition of multiple video-related variables into a new header file (machine/video.h) so that we can kill all the "manual" externs spread around the code (which were inconsistent among them). --- sys/arch/mac68k/dev/maccons.c | 8 ++-- sys/arch/mac68k/dev/macfb.c | 15 ++----- sys/arch/mac68k/include/video.h | 54 +++++++++++++++++++++++++ sys/arch/mac68k/mac68k/machdep.c | 28 ++++++------- sys/arch/mac68k/mac68k/pmap_bootstrap.c | 9 ++--- sys/arch/mac68k/obio/grf_obio.c | 13 ++---- 6 files changed, 78 insertions(+), 49 deletions(-) create mode 100644 sys/arch/mac68k/include/video.h diff --git a/sys/arch/mac68k/dev/maccons.c b/sys/arch/mac68k/dev/maccons.c index 0f26142ff2b7..955d3da2beb2 100644 --- a/sys/arch/mac68k/dev/maccons.c +++ b/sys/arch/mac68k/dev/maccons.c @@ -1,4 +1,4 @@ -/* $NetBSD: maccons.c,v 1.6 2005/12/11 12:18:02 christos Exp $ */ +/* $NetBSD: maccons.c,v 1.7 2007/08/29 13:02:41 jmmv Exp $ */ /* * Copyright (C) 1999 Scott Reynolds. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: maccons.c,v 1.6 2005/12/11 12:18:02 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: maccons.c,v 1.7 2007/08/29 13:02:41 jmmv Exp $"); #include "wsdisplay.h" #include "wskbd.h" @@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: maccons.c,v 1.6 2005/12/11 12:18:02 christos Exp $") #include #include +#include #include #include #include @@ -54,9 +55,6 @@ void maccnpollc(dev_t, int); static int maccons_initted = (-1); -/* From Booter via locore */ -extern u_int32_t mac68k_vidphys; - void maccnprobe(struct consdev *cp) { diff --git a/sys/arch/mac68k/dev/macfb.c b/sys/arch/mac68k/dev/macfb.c index 46f2b6cc31b3..dffe68b7e8ad 100644 --- a/sys/arch/mac68k/dev/macfb.c +++ b/sys/arch/mac68k/dev/macfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: macfb.c,v 1.16 2007/08/29 12:39:31 jmmv Exp $ */ +/* $NetBSD: macfb.c,v 1.17 2007/08/29 13:02:41 jmmv Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis * All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.16 2007/08/29 12:39:31 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.17 2007/08/29 13:02:41 jmmv Exp $"); #include "opt_wsdisplay_compat.h" #include "grf.h" @@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.16 2007/08/29 12:39:31 jmmv Exp $"); #include #include +#include #include #include #include @@ -117,16 +118,6 @@ static void init_itefont(void); static struct macfb_devconfig macfb_console_dc; -/* From Booter via locore */ -extern long videoaddr; -extern long videorowbytes; -extern long videobitdepth; -extern long videowidth; -extern long videoheight; -extern u_int32_t mac68k_vidlog; -extern u_int32_t mac68k_vidphys; -extern u_int32_t mac68k_vidlen; - static int macfb_is_console(paddr_t addr) { diff --git a/sys/arch/mac68k/include/video.h b/sys/arch/mac68k/include/video.h new file mode 100644 index 000000000000..30625ff92dee --- /dev/null +++ b/sys/arch/mac68k/include/video.h @@ -0,0 +1,54 @@ +/* $NetBSD: video.h,v 1.1 2007/08/29 13:02:41 jmmv Exp $ */ +/* + * Copyright (c) 2007 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifndef _CPU_VIDEO_H_ +#define _CPU_VIDEO_H_ + +/* From Booter via locore */ +extern long videoaddr; /* Address used in kernel for video */ +extern long videorowbytes; /* Length of row in video RAM */ +extern long videobitdepth; /* Number of bits per pixel */ +extern long videowidth; /* Framebuffer width */ +extern long videoheight; /* Framebuffer height */ + +/* + * Values for IIvx-like internal video + * -- should be zero if it is not used (usual case). + */ +extern uint32_t mac68k_vidlog; /* logical addr */ +extern uint32_t mac68k_vidphys; /* physical addr */ +extern uint32_t mac68k_vidlen; /* mem length */ + +#endif /* _CPU_VIDEO_H_ */ diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index c2b35c4c5d1d..988d814c9c94 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.317 2007/08/29 12:39:32 jmmv Exp $ */ +/* $NetBSD: machdep.c,v 1.318 2007/08/29 13:02:41 jmmv Exp $ */ /* * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.317 2007/08/29 12:39:32 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.318 2007/08/29 13:02:41 jmmv Exp $"); #include "opt_adb.h" #include "opt_ddb.h" @@ -159,6 +159,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.317 2007/08/29 12:39:32 jmmv Exp $"); #include #include #include /* XXX should be pulled in by sys/kcore.h */ +#include #define MAXMEM 64*1024 /* XXX - from cmap.h */ #include @@ -208,20 +209,15 @@ u_long nblog[NBMAXRANGES]; /* Start logical addr of this range */ long nblen[NBMAXRANGES]; /* Length of this range If the length is */ /* negative, all phys addrs are the same. */ -/* From Booter via locore */ -long videoaddr; /* Addr used in kernel for video */ -long videorowbytes; /* Length of row in video RAM */ -long videobitdepth; /* Number of bits per pixel */ -long videowidth; /* Framebuffer width */ -long videoheight; /* Framebuffer height */ - -/* - * Values for IIvx-like internal video - * -- should be zero if it is not used (usual case). - */ -u_int32_t mac68k_vidlog; /* logical addr */ -u_int32_t mac68k_vidphys; /* physical addr */ -u_int32_t mac68k_vidlen; /* mem length */ +/* Definitions for the variables defined in machine/video.h */ +long videoaddr; +long videorowbytes; +long videobitdepth; +long videowidth; +long videoheight; +uint32_t mac68k_vidlog; +uint32_t mac68k_vidphys; +uint32_t mac68k_vidlen; /* Callback and cookie to run bell */ int (*mac68k_bell_callback)(void *, int, int, int); diff --git a/sys/arch/mac68k/mac68k/pmap_bootstrap.c b/sys/arch/mac68k/mac68k/pmap_bootstrap.c index 20c918c3ec90..abd9592cd1c0 100644 --- a/sys/arch/mac68k/mac68k/pmap_bootstrap.c +++ b/sys/arch/mac68k/mac68k/pmap_bootstrap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.71 2007/08/29 12:39:32 jmmv Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.72 2007/08/29 13:02:42 jmmv Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.71 2007/08/29 12:39:32 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.72 2007/08/29 13:02:42 jmmv Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.71 2007/08/29 12:39:32 jmmv Exp #include #include #include +#include #include @@ -84,10 +85,6 @@ u_long high[8]; u_long maxaddr; /* PA of the last physical page */ int vidlen; #define VIDMAPSIZE btoc(vidlen) -extern u_int32_t mac68k_vidphys; -extern u_int32_t videoaddr; -extern u_int32_t videorowbytes; -extern long videoheight; static u_int32_t newvideoaddr; extern void * ROMBase; diff --git a/sys/arch/mac68k/obio/grf_obio.c b/sys/arch/mac68k/obio/grf_obio.c index f8c2c373da64..63173b0e2d08 100644 --- a/sys/arch/mac68k/obio/grf_obio.c +++ b/sys/arch/mac68k/obio/grf_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_obio.c,v 1.54 2007/08/29 12:39:32 jmmv Exp $ */ +/* $NetBSD: grf_obio.c,v 1.55 2007/08/29 13:02:42 jmmv Exp $ */ /* * Copyright (C) 1998 Scott Reynolds @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v 1.54 2007/08/29 12:39:32 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v 1.55 2007/08/29 13:02:42 jmmv Exp $"); #include #include @@ -76,19 +76,12 @@ __KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v 1.54 2007/08/29 12:39:32 jmmv Exp $"); #include #include #include +#include #include #include #include -extern u_int32_t mac68k_vidphys; -extern u_int32_t mac68k_vidlen; -extern long videoaddr; -extern long videorowbytes; -extern long videobitdepth; -extern long videowidth; -extern long videoheight; - static int grfiv_mode(struct grf_softc *, int, void *); static int grfiv_match(struct device *, struct cfdata *, void *); static void grfiv_attach(struct device *, struct device *, void *);