Module Name: src Committed By: tsutsui Date: Sun Feb 12 08:25:10 UTC 2023
Modified Files: src/sys/arch/next68k/stand/boot: boot.c conf.c devopen.c en.c machdep.c rtc.c scsi.c scsivar.h sd.c Added Files: src/sys/arch/next68k/stand/boot: samachdep.h Log Message: Use common declarations and macros in proper headers. Also fix inconsistent sdopen() and sdstrategy() args and remove useless #if 0'ed out code. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/stand/boot/boot.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/stand/boot/conf.c \ src/sys/arch/next68k/stand/boot/devopen.c \ src/sys/arch/next68k/stand/boot/rtc.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/stand/boot/en.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/stand/boot/machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/stand/boot/samachdep.h cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/scsi.c cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/arch/next68k/stand/boot/scsivar.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/stand/boot/sd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/next68k/stand/boot/boot.c diff -u src/sys/arch/next68k/stand/boot/boot.c:1.13 src/sys/arch/next68k/stand/boot/boot.c:1.14 --- src/sys/arch/next68k/stand/boot/boot.c:1.13 Sat Feb 11 02:33:27 2023 +++ src/sys/arch/next68k/stand/boot/boot.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.13 2023/02/11 02:33:27 tsutsui Exp $ */ +/* $NetBSD: boot.c,v 1.14 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1994 Rolf Grossmann * All rights reserved. @@ -34,17 +34,17 @@ #include <lib/libsa/stand.h> #include <lib/libsa/loadfile.h> +#include <lib/libsa/dev_net.h> #include <lib/libkern/libkern.h> #include <machine/cpu.h> /* for NEXT_RAMBASE */ #include <next68k/next68k/nextrom.h> -#define KERN_LOADADDR NEXT_RAMBASE +#include "samachdep.h" -extern int errno; +#define KERN_LOADADDR NEXT_RAMBASE -extern char *mg; #define MON(type, off) (*(type *)((u_int) (mg) + off)) int devparse(const char *, int *, char *, char *, char *, char **); @@ -56,18 +56,11 @@ int devparse(const char *, int *, char * * Boot device is derived from PROM provided information. */ -extern char bootprog_rev[]; -extern char bootprog_name[]; -extern int build; #define KNAMEN 100 char kernel[KNAMEN]; int entry_point; /* return value filled in by machdep_start */ int turbo; -extern void rtc_init(void); - -extern int try_bootp; - volatile int qq; int Index: src/sys/arch/next68k/stand/boot/conf.c diff -u src/sys/arch/next68k/stand/boot/conf.c:1.7 src/sys/arch/next68k/stand/boot/conf.c:1.8 --- src/sys/arch/next68k/stand/boot/conf.c:1.7 Sun Dec 11 12:18:29 2005 +++ src/sys/arch/next68k/stand/boot/conf.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.7 2005/12/11 12:18:29 christos Exp $ */ +/* $NetBSD: conf.c,v 1.8 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -45,21 +45,15 @@ #include <netif.h> #include <dev_net.h> +#include "samachdep.h" + /* * Device configuration */ -extern int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *); -extern int sdopen(struct open_file *, ...); -extern int sdclose(struct open_file *); #define sdioctl noioctl -/* ### now from libsa -extern int enstrategy(void *, int, daddr_t, size_t, void *, size_t *); -extern int enopen(struct open_file *, ...); -extern int enclose(struct open_file *); #define enioctl noioctl -*/ struct devsw devsw[] = { { "sd", sdstrategy, sdopen, sdclose, sdioctl }, Index: src/sys/arch/next68k/stand/boot/devopen.c diff -u src/sys/arch/next68k/stand/boot/devopen.c:1.7 src/sys/arch/next68k/stand/boot/devopen.c:1.8 --- src/sys/arch/next68k/stand/boot/devopen.c:1.7 Sat Feb 4 14:38:09 2023 +++ src/sys/arch/next68k/stand/boot/devopen.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.7 2023/02/04 14:38:09 tsutsui Exp $ */ +/* $NetBSD: devopen.c,v 1.8 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1994 Rolf Grossmann * All rights reserved. @@ -33,7 +33,7 @@ #include <lib/libkern/libkern.h> int devlookup(const char *, int); -int devparse(const char *, int *, char *, char *, char *, char **); +int devparse(const char *, int *, int *, int *, int *, char **); int devlookup(const char *d, int len) @@ -64,7 +64,7 @@ devlookup(const char *d, int len) */ int devparse(const char *fname, int *dev, - char *count, char *lun, char *part, char **file) + int *count, int *lun, int *part, char **file) { int i; const char *s, *args[3]; @@ -120,7 +120,7 @@ devopen(struct open_file *f, const char { int error; int dev; - char count, lun, part; + int count, lun, part; struct devsw *dp; dev = 0; /* default device is first in table (usually scsi disk) */ Index: src/sys/arch/next68k/stand/boot/rtc.c diff -u src/sys/arch/next68k/stand/boot/rtc.c:1.7 src/sys/arch/next68k/stand/boot/rtc.c:1.8 --- src/sys/arch/next68k/stand/boot/rtc.c:1.7 Sat Feb 4 14:38:09 2023 +++ src/sys/arch/next68k/stand/boot/rtc.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.7 2023/02/04 14:38:09 tsutsui Exp $ */ +/* $NetBSD: rtc.c,v 1.8 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1997 Rolf Grossmann * All rights reserved. @@ -35,12 +35,9 @@ #include <lib/libsa/stand.h> #include <lib/libsa/net.h> -u_char rtc_read(u_char); -void rtc_init(void); - +#include "samachdep.h" -/* ### where shall I put this definition? */ -#define DELAY(n) { register int N = (n); while (--N > 0); } +u_char rtc_read(u_char); static volatile u_int *scr2 = (u_int *)NEXT_P_SCR2_CON; static u_char new_clock; Index: src/sys/arch/next68k/stand/boot/en.c diff -u src/sys/arch/next68k/stand/boot/en.c:1.19 src/sys/arch/next68k/stand/boot/en.c:1.20 --- src/sys/arch/next68k/stand/boot/en.c:1.19 Thu Mar 8 03:12:02 2018 +++ src/sys/arch/next68k/stand/boot/en.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: en.c,v 1.19 2018/03/08 03:12:02 mrg Exp $ */ +/* $NetBSD: en.c,v 1.20 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1996 Rolf Grossmann * All rights reserved. @@ -37,6 +37,7 @@ #include <next68k/next68k/nextrom.h> #include "enreg.h" #include "dmareg.h" +#include "samachdep.h" #include <stand.h> #include <netif.h> @@ -45,7 +46,6 @@ #include <lib/libkern/libkern.h> -extern char *mg; #define MON(type, off) (*(type *)((u_int) (mg) + off)) #define PRINTF(x) printf x; @@ -80,8 +80,6 @@ struct netif_driver en_driver = { en_ifs, sizeof(en_ifs) / sizeof(en_ifs[0]) }; -extern int turbo; - /* ### int netdev_sock; static int open_count; */ Index: src/sys/arch/next68k/stand/boot/machdep.c diff -u src/sys/arch/next68k/stand/boot/machdep.c:1.8 src/sys/arch/next68k/stand/boot/machdep.c:1.9 --- src/sys/arch/next68k/stand/boot/machdep.c:1.8 Sat Feb 4 14:38:09 2023 +++ src/sys/arch/next68k/stand/boot/machdep.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.8 2023/02/04 14:38:09 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.9 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1998 Darrin Jewell * Copyright (c) 1994 Rolf Grossmann @@ -35,12 +35,12 @@ #include <stand.h> #include <next68k/next68k/nextrom.h> +#include "samachdep.h" + char *mg; #define MON(type, off) (*(type *)((u_int) (mg) + off)) -extern int entry_point; - #ifdef DEBUG int debug = 1; #else @@ -86,7 +86,6 @@ putchar(int c) __dead void _rtt(void) { - extern __dead void _halt(void); printf("Press any key to halt.\n"); getchar(); Index: src/sys/arch/next68k/stand/boot/scsi.c diff -u src/sys/arch/next68k/stand/boot/scsi.c:1.12 src/sys/arch/next68k/stand/boot/scsi.c:1.13 --- src/sys/arch/next68k/stand/boot/scsi.c:1.12 Thu Feb 9 15:20:40 2023 +++ src/sys/arch/next68k/stand/boot/scsi.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: scsi.c,v 1.12 2023/02/09 15:20:40 tsutsui Exp $ */ +/* $NetBSD: scsi.c,v 1.13 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1994, 1997 Rolf Grossmann * All rights reserved. @@ -33,17 +33,15 @@ #include <next68k/dev/espreg.h> #include <dev/ic/ncr53c9xreg.h> #include <dev/scsipi/scsi_message.h> -#if 0 -#include <next/next/prominfo.h> -#else #include <next68k/next68k/nextrom.h> -#endif #include "scsireg.h" #include "dmareg.h" #include "scsivar.h" #include <lib/libsa/stand.h> +#include "samachdep.h" + struct scsi_softc scsi_softc, *sc = &scsi_softc; char the_dma_buffer[MAX_DMASIZE+DMA_ENDALIGNMENT], *dma_buffer; @@ -51,12 +49,9 @@ int scsi_msgin(void); int dma_start(char *addr, int len); int dma_done(void); -void scsi_init(void); void scsierror(char *error); short scsi_getbyte(volatile uint8_t *sr); int scsi_wait_for_intr(void); -int scsiicmd(char target, char lun, - u_char *cbuf, int clen, char *addr, int *len); #define NDPRINTF(x) #define PRINTF(x) @@ -136,17 +131,11 @@ scsi_getbyte(volatile uint8_t *sr) int scsi_wait_for_intr(void) { -#if 0 - extern struct prominfo *pi; - volitle int = pi->pi_intrstat; /* ### use constant? */ -#else - extern char *mg; #define MON(type, off) (*(type *)((u_int) (mg) + off)) volatile int *intrstat = MON(volatile int *,MG_intrstat); #ifdef SCSI_DEBUG /* volatile int *intrmask = MON(volatile int *,MG_intrmask); */ #endif -#endif int count; for(count = 0; count < SCSI_TIMEOUT; count++) { Index: src/sys/arch/next68k/stand/boot/scsivar.h diff -u src/sys/arch/next68k/stand/boot/scsivar.h:1.1.1.1 src/sys/arch/next68k/stand/boot/scsivar.h:1.2 --- src/sys/arch/next68k/stand/boot/scsivar.h:1.1.1.1 Tue Jun 9 07:53:06 1998 +++ src/sys/arch/next68k/stand/boot/scsivar.h Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: scsivar.h,v 1.1.1.1 1998/06/09 07:53:06 dbj Exp $ */ +/* $NetBSD: scsivar.h,v 1.2 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1994 Rolf Grossmann * All rights reserved. @@ -69,4 +69,5 @@ struct scsi_softc { extern struct scsi_softc scsi_softc; -#define DELAY(n) { register int N = (n); while (--N > 0); } +void scsi_init(void); +int scsiicmd(char, char, u_char *, int, char *, int *); Index: src/sys/arch/next68k/stand/boot/sd.c diff -u src/sys/arch/next68k/stand/boot/sd.c:1.16 src/sys/arch/next68k/stand/boot/sd.c:1.17 --- src/sys/arch/next68k/stand/boot/sd.c:1.16 Thu Feb 9 15:20:40 2023 +++ src/sys/arch/next68k/stand/boot/sd.c Sun Feb 12 08:25:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.16 2023/02/09 15:20:40 tsutsui Exp $ */ +/* $NetBSD: sd.c,v 1.17 2023/02/12 08:25:09 tsutsui Exp $ */ /* * Copyright (c) 1994 Rolf Grossmann * All rights reserved. @@ -38,7 +38,10 @@ #include <dev/scsipi/scsipi_disk.h> #include <lib/libsa/stand.h> #include <lib/libkern/libkern.h> /* for bzero() */ + #include "dmareg.h" +#include "scsivar.h" +#include "samachdep.h" #ifdef SD_DEBUG #define DPRINTF(x) printf x; @@ -62,14 +65,8 @@ struct sd_softc { #define NSD 7 #define MAXRETRIES 5 /* must be at least one */ -void scsi_init(void); -int scsiicmd(char, char, u_char *, int, char *, int *); -int sdstrategy(struct sd_softc *ss, int rw, daddr_t dblk, size_t size, - void *buf, size_t *rsize); int sdprobe(char target, char lun); int sdgetinfo(struct sd_softc *ss); -int sdopen(struct open_file *f, char count, char lun, char part); -int sdclose(struct open_file *f); int sdprobe(char target, char lun) @@ -187,12 +184,20 @@ sdgetinfo(struct sd_softc *ss) } int -sdopen(struct open_file *f, char count, char lun, char part) +sdopen(struct open_file *f, ...) { + va_list ap; + int count, lun, part; register struct sd_softc *ss; char unit, cnt; int error; + va_start(ap, f); + count = va_arg(ap, int); + lun = va_arg(ap, int); + part = va_arg(ap, int); + va_end(ap); + DPRINTF(("open: sd(%d,%d,%d)\n", count, lun, part)); if (lun >= NSD) @@ -242,9 +247,10 @@ sdclose(struct open_file *f) } int -sdstrategy(struct sd_softc *ss, int rw, daddr_t dblk, size_t size, +sdstrategy(void *devdata, int rw, daddr_t dblk, size_t size, void *buf, size_t *rsize) { + struct sd_softc *ss = devdata; u_long blk = dblk + ss->sc_pinfo.offset[ss->sc_part]; struct scsipi_rw_10 cdb; int error; Added files: Index: src/sys/arch/next68k/stand/boot/samachdep.h diff -u /dev/null src/sys/arch/next68k/stand/boot/samachdep.h:1.1 --- /dev/null Sun Feb 12 08:25:10 2023 +++ src/sys/arch/next68k/stand/boot/samachdep.h Sun Feb 12 08:25:09 2023 @@ -0,0 +1,66 @@ +/* $NetBSD: samachdep.h,v 1.1 2023/02/12 08:25:09 tsutsui Exp $ */ + +/* + * Copyright (c) 1982, 1990, 1993 + * The Regents of the University of California. 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. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)samachdep.h 8.1 (Berkeley) 6/10/93 + */ + +#include <sys/param.h> +#include <lib/libsa/stand.h> + +/* boot.c */ +extern int entry_point; +extern int turbo; + +/* en.c */ +int enstrategy(void *, int, daddr_t, size_t, void *, size_t *); +int enopen(struct open_file *, ...); +int enclose(struct open_file *); + +/* machdep.c */ +extern char *mg; + +/* rtc.c */ +void rtc_init(void); + +/* sd.c */ +int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *); +int sdopen(struct open_file *, ...); +int sdclose(struct open_file *); + +/* srt0.S */ +__dead void _halt(void); + +/* vers.c (generated by sys/conf/newvers_stand.sh) */ +extern char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; + +/* build.c (generated by ${.CURDIR}/newvers.sh) */ +extern int build; + +#define DELAY(n) { register int N = (n); while (--N > 0); }