Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc/stand factor out the floppy detection code.
details: https://anonhg.NetBSD.org/src/rev/affb9e30ee8a
branches: trunk
changeset: 757341:affb9e30ee8a
user: christos <christos%NetBSD.org@localhost>
date: Wed Aug 25 20:16:48 2010 +0000
description:
factor out the floppy detection code.
diffstat:
sys/arch/sparc/stand/Makefile.buildboot | 4 ++--
sys/arch/sparc/stand/boot/boot.c | 5 +++--
sys/arch/sparc/stand/common/isfloppy.c | 10 ++++++++++
sys/arch/sparc/stand/common/isfloppy.h | 2 ++
sys/arch/sparc/stand/common/promdev.c | 14 +++-----------
sys/arch/sparc/stand/common/promdev.h | 5 +----
sys/arch/sparc/stand/ofwboot/Makefile | 6 +++---
sys/arch/sparc/stand/ofwboot/boot.c | 5 +++--
8 files changed, 27 insertions(+), 24 deletions(-)
diffs (171 lines):
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/Makefile.buildboot
--- a/sys/arch/sparc/stand/Makefile.buildboot Wed Aug 25 18:16:06 2010 +0000
+++ b/sys/arch/sparc/stand/Makefile.buildboot Wed Aug 25 20:16:48 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.buildboot,v 1.27 2010/05/27 06:58:15 dholland Exp $
+# $NetBSD: Makefile.buildboot,v 1.28 2010/08/25 20:16:48 christos Exp $
#
# This file is for the sparc `boot' and `bootxx' only; it does not
# currently play well on a 64-bit system.
@@ -7,7 +7,7 @@
.PATH: ${.CURDIR}/../common ${.CURDIR}/../../sparc
-COMMONSOURCE= srt0.S promdev.c dvma.c promlib.c
+COMMONSOURCE= srt0.S promdev.c dvma.c promlib.c isfloppy.c
SRCS= ${COMMONSOURCE} ${PROGSOURCE}
NOMAN= # defined
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/boot/boot.c
--- a/sys/arch/sparc/stand/boot/boot.c Wed Aug 25 18:16:06 2010 +0000
+++ b/sys/arch/sparc/stand/boot/boot.c Wed Aug 25 20:16:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.25 2010/08/25 18:11:54 christos Exp $ */
+/* $NetBSD: boot.c,v 1.26 2010/08/25 20:16:48 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
@@ -42,6 +42,7 @@
#include <machine/promlib.h>
#include <sparc/stand/common/promdev.h>
+#include <sparc/stand/common/isfloppy.h>
#include "bootinfo.h"
@@ -225,7 +226,7 @@
loadaddrmask = 0x07ffffffUL;
}
- if (promdev_isfloppy())
+ if (bootdev_isfloppy(prom_bootdevice))
flags &= ~LOAD_BACKWARDS;
marks[MARK_START] = 0;
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/common/isfloppy.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc/stand/common/isfloppy.c Wed Aug 25 20:16:48 2010 +0000
@@ -0,0 +1,10 @@
+#include <lib/libkern/libkern.h>
+#include <sparc/stand/common/isfloppy.h>
+
+int
+bootdev_isfloppy(const char *dev)
+{
+ return strncmp(dev, "fd", 2) == 0 ||
+ strstr(dev, "SUNW,fdtwo") != NULL ||
+ strstr(dev, "fdthree") != NULL;
+}
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/common/isfloppy.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc/stand/common/isfloppy.h Wed Aug 25 20:16:48 2010 +0000
@@ -0,0 +1,2 @@
+
+extern int bootdev_isfloppy(const char *);
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/common/promdev.c
--- a/sys/arch/sparc/stand/common/promdev.c Wed Aug 25 18:16:06 2010 +0000
+++ b/sys/arch/sparc/stand/common/promdev.c Wed Aug 25 20:16:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: promdev.c,v 1.24 2010/08/25 18:11:54 christos Exp $ */
+/* $NetBSD: promdev.c,v 1.25 2010/08/25 20:16:49 christos Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -48,6 +48,7 @@
#include <lib/libsa/net.h>
#include <lib/libkern/libkern.h>
#include <sparc/stand/common/promdev.h>
+#include <sparc/stand/common/isfloppy.h>
#ifndef BOOTXX
#include <sys/disklabel.h>
@@ -105,15 +106,6 @@
static daddr_t doffset = 0;
#endif
-
-int
-bootdev_isfloppy(void)
-{
- return strncmp(prom_bootdevice, "fd", 2) == 0 ||
- strstr(prom_bootdevice, "SUNW,fdtwo") != NULL ||
- strstr(prom_bootdevice, "fdthree") != NULL;
-}
-
void
putchar(int c)
{
@@ -227,7 +219,7 @@
* Don't check disklabel on floppy boot since
* reopening it could cause Data Access Exception later.
*/
- if (bootdev_isfloppy())
+ if (bootdev_isfloppy(prom_bootdevice))
return 0;
/*
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/common/promdev.h
--- a/sys/arch/sparc/stand/common/promdev.h Wed Aug 25 18:16:06 2010 +0000
+++ b/sys/arch/sparc/stand/common/promdev.h Wed Aug 25 20:16:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: promdev.h,v 1.15 2010/08/25 18:11:54 christos Exp $ */
+/* $NetBSD: promdev.h,v 1.16 2010/08/25 20:16:49 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -70,9 +70,6 @@
extern int (*pmap_map)(vaddr_t, paddr_t, psize_t);
extern int (*pmap_extract)(vaddr_t, paddr_t *);
-/* In promdev.c */
-extern int bootdev_isfloppy(void);
-
/* In str0.S: */
extern void sparc_noop(void);
extern void *romp;
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/ofwboot/Makefile
--- a/sys/arch/sparc/stand/ofwboot/Makefile Wed Aug 25 18:16:06 2010 +0000
+++ b/sys/arch/sparc/stand/ofwboot/Makefile Wed Aug 25 20:16:48 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2010/05/27 06:58:15 dholland Exp $
+# $NetBSD: Makefile,v 1.25 2010/08/25 20:16:49 christos Exp $
CURDIR= ${.CURDIR}
S= ${CURDIR}/../../../..
@@ -11,8 +11,8 @@
PROG?= ofwboot
SRCS= srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c
-SRCS+= bootinfo.c loadfile_machdep.c promlib.c prf.c
-.PATH: ${S}/arch/sparc64/sparc64
+SRCS+= bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
+.PATH: ${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
diff -r f22f7151920d -r affb9e30ee8a sys/arch/sparc/stand/ofwboot/boot.c
--- a/sys/arch/sparc/stand/ofwboot/boot.c Wed Aug 25 18:16:06 2010 +0000
+++ b/sys/arch/sparc/stand/ofwboot/boot.c Wed Aug 25 20:16:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.24 2010/08/25 16:38:04 christos Exp $ */
+/* $NetBSD: boot.c,v 1.25 2010/08/25 20:16:49 christos Exp $ */
/*
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
@@ -55,6 +55,7 @@
#include <machine/cpu.h>
#include <machine/promlib.h>
#include <machine/bootinfo.h>
+#include <sparc/stand/common/isfloppy.h>
#include "boot.h"
#include "ofdev.h"
@@ -506,7 +507,7 @@
/* Figure boot arguments */
strncpy(bootdev, prom_getbootpath(), sizeof(bootdev) - 1);
boothowto = bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
- isfloppy = strstr(bootdev, "fd") || strstr(bootdev, "floppy");
+ isfloppy = bootdev_isfloppy(bootdev);
for (;; *kernel = '\0') {
if (boothowto & RB_ASKNAME) {
Home |
Main Index |
Thread Index |
Old Index