Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/prep/stand/boot Support load kernel from SCSI HDD w...
details: https://anonhg.NetBSD.org/src/rev/ef0949f18433
branches: trunk
changeset: 779329:ef0949f18433
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Sat May 19 14:40:12 2012 +0000
description:
Support load kernel from SCSI HDD with siop. It copy from bebox. (EXPERIMENTAL)
diffstat:
sys/arch/prep/stand/boot/Makefile | 3 +-
sys/arch/prep/stand/boot/boot.c | 17 +-
sys/arch/prep/stand/boot/boot.h | 22 +-
sys/arch/prep/stand/boot/conf.c | 10 +-
sys/arch/prep/stand/boot/devopen.c | 30 +-
sys/arch/prep/stand/boot/filesystem.c | 8 +-
sys/arch/prep/stand/boot/io.c | 163 ++--
sys/arch/prep/stand/boot/pci.c | 192 +++++
sys/arch/prep/stand/boot/sd.c | 740 +++++++++++++++++++
sys/arch/prep/stand/boot/sdvar.h | 164 ++++
sys/arch/prep/stand/boot/siop.c | 1233 +++++++++++++++++++++++++++++++++
sys/arch/prep/stand/boot/version | 4 +-
12 files changed, 2486 insertions(+), 100 deletions(-)
diffs (truncated from 2756 to 300 lines):
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/Makefile
--- a/sys/arch/prep/stand/boot/Makefile Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/Makefile Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2011/01/22 19:19:22 joerg Exp $
+# $NetBSD: Makefile,v 1.26 2012/05/19 14:40:13 kiyohara Exp $
NOMAN= # defined
@@ -22,6 +22,7 @@
SRCS+= boot.c clock.c com.c conf.c cons.c devopen.c
SRCS+= filesystem.c inkernel.c io.c tgets.c prf.c monitor.c
SRCS+= kbd.c ns16550.c vers.c vreset.c vga.c
+SRCS+= pci.c sd.c siop.c
CFLAGS= -Os -mmultiple -ffreestanding
CFLAGS+= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/boot.c
--- a/sys/arch/prep/stand/boot/boot.c Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/boot.c Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.18 2011/01/22 19:19:22 joerg Exp $ */
+/* $NetBSD: boot.c,v 1.19 2012/05/19 14:40:13 kiyohara Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -43,8 +43,10 @@
#include <powerpc/oea/spr.h>
#include "boot.h"
+#include "sdvar.h"
char *names[] = {
+ "sd(0,0,0)netbsd", "sd(0,0,0)onetbsd",
"in()",
};
#define NUMNAMES (sizeof (names) / sizeof (names[0]))
@@ -138,6 +140,12 @@
printf("\n");
printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev);
+ printf("\n");
+
+ /*
+ * Initialize siop@pci0 dev 16 func 0
+ */
+ siop_init(0, 16, 0);
for (;;) {
name = names[n++];
@@ -224,3 +232,10 @@
(void *)marks[MARK_ENTRY]);
}
}
+
+void
+_rtt(void)
+{
+
+ /* XXXX */
+}
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/boot.h
--- a/sys/arch/prep/stand/boot/boot.h Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/boot.h Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.h,v 1.9 2011/07/07 06:01:12 mrg Exp $ */
+/* $NetBSD: boot.h,v 1.10 2012/05/19 14:40:13 kiyohara Exp $ */
#define TICKS_PER_SEC (66666667 / 4) /* 66MHz */
#define NS_PER_TICK (1000000000 / TICKS_PER_SEC)
@@ -40,10 +40,14 @@
void outb(int, char);
void outw(int, u_int16_t);
u_char inb(int);
+u_char readb(u_long);
+u_short readw(u_long);
+u_long readl(u_long);
+void writeb(u_long, u_char);
+void writel(u_long, u_long);
+void _wbinv(uint32_t, uint32_t);
+void _inv(uint32_t, uint32_t);
u_long local_to_PCI(u_long);
-void unlockVideo(int);
-int scan_PCI(int);
-int PCI_vendor(int);
/*
* kbd
@@ -58,6 +62,16 @@
int db_monitor(void);
/*
+ * pci
+ */
+void enablePCI(int, int, int, int);
+int PCISlotnum(u_int, u_int, u_int);
+int PCI_vendor(int);
+u_long PCIAddress(int, u_int, int);
+int scan_PCI(int);
+void unlockVideo(int);
+
+/*
* tgets
*/
int tgets(char *);
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/conf.c
--- a/sys/arch/prep/stand/boot/conf.c Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/conf.c Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.5 2006/04/10 18:40:06 garbled Exp $ */
+/* $NetBSD: conf.c,v 1.6 2012/05/19 14:40:13 kiyohara Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -37,8 +37,14 @@
int inopen(struct open_file *, ...);
int inclose(struct open_file *);
+int sdstrategy(void *, int , daddr_t, size_t, void *, size_t *);
+int sdopen(struct open_file *, ...);
+int sdclose(struct open_file *);
+
struct devsw devsw[] = {
- { "in", instrategy, inopen, inclose, noioctl },
+ { "sd", sdstrategy, sdopen, sdclose, noioctl },
+ { NULL, NULL, NULL, NULL, NULL },
};
+struct devsw pseudo_devsw = { "in", instrategy, inopen, inclose, noioctl };
int ndevs = (sizeof (devsw) / sizeof (devsw[0]));
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/devopen.c
--- a/sys/arch/prep/stand/boot/devopen.c Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/devopen.c Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.3 2006/04/10 18:40:06 garbled Exp $ */
+/* $NetBSD: devopen.c,v 1.4 2012/05/19 14:40:13 kiyohara Exp $ */
/*-
* Copyright (c) 1993 John Brezak
@@ -134,21 +134,31 @@
int dev = 0, ctlr = 0, unit = 0, part = 0;
int adapt = 0;
struct devsw *dp = &devsw[0];
+ extern struct devsw pseudo_devsw;
- if ((error =
- devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file)) != 0)
- return (error);
-
- dp = &devsw[dev];
- if (!dp->dv_open)
- return (ENODEV);
+ error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file);
+ if (error == 0) {
+ dp = &devsw[dev];
+ if (!dp->dv_open)
+ return (ENODEV);
+ } else {
+ if (strcmp(fname, "in()") == 0) {
+ /* special case: kernel in memory */
+ dp = &pseudo_devsw;
+ printf("in memory kernel\n");
+ } else
+ return (error);
+ }
f->f_dev = dp;
if ((error = (*dp->dv_open)(f, ctlr, unit, part)) == 0)
return (0);
- printf("%s(%d,%d,%d): %s\n", devsw[dev].dv_name,
- ctlr, unit, part, strerror(error));
+ if (strcmp(fname, "in()") == 0)
+ printf("in(): %s\n", strerror(error));
+ else
+ printf("%s(%d,%d,%d): %s\n", dp->dv_name,
+ ctlr, unit, part, strerror(error));
return (error);
}
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/filesystem.c
--- a/sys/arch/prep/stand/boot/filesystem.c Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/filesystem.c Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filesystem.c,v 1.3 2008/04/28 20:23:33 martin Exp $ */
+/* $NetBSD: filesystem.c,v 1.4 2012/05/19 14:40:13 kiyohara Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -30,9 +30,13 @@
*/
#include <lib/libsa/stand.h>
+#include <lib/libsa/ustarfs.h>
+#include <lib/libsa/ufs.h>
struct fs_ops file_system[] = {
-{ null_open, null_close, null_read, null_write, null_seek, null_stat },
+ FS_OPS(ffsv1),
+ FS_OPS(ffsv2),
+ FS_OPS(null),
};
int nfsys = sizeof (file_system)/sizeof (struct fs_ops);
diff -r 8787c6a7ecc4 -r ef0949f18433 sys/arch/prep/stand/boot/io.c
--- a/sys/arch/prep/stand/boot/io.c Sat May 19 08:29:32 2012 +0000
+++ b/sys/arch/prep/stand/boot/io.c Sat May 19 14:40:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.4 2006/06/27 23:26:13 garbled Exp $ */
+/* $NetBSD: io.c,v 1.5 2012/05/19 14:40:13 kiyohara Exp $ */
/*-
* Copyright (C) 1995-1997 Gary Thomas (gdt%linuxppc.org@localhost)
@@ -36,31 +36,14 @@
#include <sys/bswap.h>
#include "boot.h"
-#define PCI_NSLOTS 8
-#define PCI_NREGS 5
-#define PCI_DEVID 0
-#define PCI_CMD 1
-#define PCI_CLASS 2
-#define PCI_MEMBASE 4
-
+volatile u_char *PCI_mem = (u_char *)0xc0000000;
volatile u_char *ISA_io = (u_char *)0x80000000;
volatile u_char *ISA_mem = (u_char *)0xc0000000;
volatile char *videomem = (char *)0xc00b8000; /* + vram offset */
-struct PCI_cinfo {
- u_long *config_addr;
- u_long regs[PCI_NREGS];
-} PCI_slots[PCI_NSLOTS] = {
- { (u_long *)0x80808000, {0xDEADBEEF,} },
- { (u_long *)0x80800800, {0xDEADBEEF,} },
- { (u_long *)0x80801000, {0xDEADBEEF,} },
- { (u_long *)0x80802000, {0xDEADBEEF,} },
- { (u_long *)0x80804000, {0xDEADBEEF,} },
- { (u_long *)0x80810000, {0xDEADBEEF,} },
- { (u_long *)0x80820000, {0xDEADBEEF,} },
- { (u_long *)0x80840000, {0xDEADBEEF,} },
-};
+static int dcache_line_size = 32;
+
void
outb(int port, char val)
@@ -83,67 +66,89 @@
return (ISA_io[port]);
}
+u_char
+readb(u_long addr)
+{
+
+ return PCI_mem[addr];
+}
+
+u_short
+readw(u_long addr)
+{
+
+ return le16toh(*((u_short *)&PCI_mem[addr]));
+}
+
+u_long
+readl(u_long addr)
+{
+
+ return le32toh(*((u_long *)&PCI_mem[addr]));
+}
+
+void
+writeb(u_long addr, u_char val)
+{
+
+ PCI_mem[addr] = val;
+}
+
+void
+writel(u_long addr, u_long val)
+{
+
+ *((u_long *)&PCI_mem[addr]) = htole32(val);
+}
+
+void
+_wbinv(uint32_t adr, uint32_t siz)
+{
+ uint32_t bnd;
+
+ asm volatile("eieio");
+ for (bnd = adr + siz; adr < bnd; adr += dcache_line_size)
+ asm volatile ("dcbf 0,%0" :: "r"(adr));
+ asm volatile ("sync");
+}
+
+void
+_inv(uint32_t adr, uint32_t siz)
Home |
Main Index |
Thread Index |
Old Index