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).
This commit is contained in:
jmmv 2007-08-29 13:02:41 +00:00
parent ef90294f8c
commit 9220353379
6 changed files with 78 additions and 49 deletions

View File

@ -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 <sys/cdefs.h>
__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 <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/video.h>
#include <dev/cons.h>
#include <dev/wscons/wskbdvar.h>
#include <dev/wscons/wsdisplayvar.h>
@ -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)
{

View File

@ -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 <sys/cdefs.h>
__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 <machine/cpu.h>
#include <machine/bus.h>
#include <machine/video.h>
#include <machine/grfioctl.h>
#include <mac68k/nubus/nubus.h>
#include <mac68k/dev/grfvar.h>
@ -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)
{

View File

@ -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_ */

View File

@ -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 <sys/cdefs.h>
__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 <machine/psl.h>
#include <machine/pte.h>
#include <machine/kcore.h> /* XXX should be pulled in by sys/kcore.h */
#include <machine/video.h>
#define MAXMEM 64*1024 /* XXX - from cmap.h */
#include <uvm/uvm_extern.h>
@ -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);

View File

@ -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 <sys/cdefs.h>
__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 <machine/cpu.h>
#include <machine/pmap.h>
#include <machine/autoconf.h>
#include <machine/video.h>
#include <mac68k/mac68k/macrom.h>
@ -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;

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/device.h>
@ -76,19 +76,12 @@ __KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v 1.54 2007/08/29 12:39:32 jmmv Exp $");
#include <machine/cpu.h>
#include <machine/grfioctl.h>
#include <machine/viareg.h>
#include <machine/video.h>
#include <mac68k/nubus/nubus.h>
#include <mac68k/obio/obiovar.h>
#include <mac68k/dev/grfvar.h>
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 *);