Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint/stand/netboot Patches by Toru Nishimura:
details: https://anonhg.NetBSD.org/src/rev/e6b6b5e98e5b
branches: trunk
changeset: 754799:e6b6b5e98e5b
user: phx <phx%NetBSD.org@localhost>
date: Thu May 13 10:40:02 2010 +0000
description:
Patches by Toru Nishimura:
- set up DBATs for 80000000-8fffffff and fc000000-ffffffff
- honour DHCP's filename field, use 'netbsd' when unspecified
- PCI-fixups for KuroBox
- determine PCIIDE programming mode for BAR assignment
diffstat:
sys/arch/sandpoint/stand/netboot/brdsetup.c | 41 ++++++++++++++++++++++++----
sys/arch/sandpoint/stand/netboot/dev_net.c | 6 ++--
sys/arch/sandpoint/stand/netboot/entry.S | 30 ++++++++++++++++++++-
sys/arch/sandpoint/stand/netboot/main.c | 27 ++++++++++++-------
sys/arch/sandpoint/stand/netboot/pci.c | 13 ++++----
5 files changed, 89 insertions(+), 28 deletions(-)
diffs (252 lines):
diff -r 195f95442371 -r e6b6b5e98e5b sys/arch/sandpoint/stand/netboot/brdsetup.c
--- a/sys/arch/sandpoint/stand/netboot/brdsetup.c Thu May 13 09:56:12 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/brdsetup.c Thu May 13 10:40:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.12 2010/05/12 18:33:09 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.13 2010/05/13 10:40:02 phx Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -274,7 +274,7 @@
delay(u_int n)
{
u_quad_t tb;
- u_long tbh, tbl, scratch;
+ u_long scratch, tbh, tbl;
tb = mftb();
tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
@@ -308,7 +308,7 @@
void
_inv(uint32_t adr, uint32_t siz)
{
- uint32_t off, bnd;
+ uint32_t bnd, off;
off = adr & (dcache_line_size - 1);
adr -= off;
@@ -342,7 +342,7 @@
unsigned
mpc107memsize()
{
- unsigned tag, val, n, bankn, end;
+ unsigned bankn, end, n, tag, val;
tag = pcimaketag(0, 0, 0);
@@ -411,7 +411,7 @@
void
setup_82C686B()
{
- unsigned pcib, ide, usb12, usb34, ac97, pmgt, val;
+ unsigned ac97, ide, pcib, pmgt, usb12, usb34, val;
pcib = pcimaketag(0, 22, 0);
ide = pcimaketag(0, 22, 1);
@@ -468,7 +468,7 @@
setup_83C553F()
{
#if 0
- unsigned pcib, ide, val;
+ unsigned ide, pcib, val;
pcib = pcimaketag(0, 11, 0);
ide = pcimaketag(0, 11, 1);
@@ -478,7 +478,7 @@
void
pcifixup(void)
{
- unsigned pcib, ide, nic, val, steer, irq;
+ unsigned ide, irq, nic, pcib, steer, usb, val;
int line;
switch (brdtype) {
@@ -678,5 +678,32 @@
val |= (('A' - '@') << 8) | 25;
pcicfgwrite(nic, 0x3c, val);
break;
+
+ case BRD_KUROBOX:
+ nic = pcimaketag(0, 11, 0);
+ val = pcicfgread(nic, 0x3c) & 0xffff0000;
+ val |= (('A' - '@') << 8) | 11;
+ pcicfgwrite(nic, 0x3c, val);
+
+ ide = pcimaketag(0, 12, 0);
+ val = pcicfgread(ide, 0x3c) & 0xffff0000;
+ val |= (('A' - '@') << 8) | 12;
+ pcicfgwrite(ide, 0x3c, val);
+
+ usb = pcimaketag(0, 14, 0);
+ val = pcicfgread(usb, 0x3c) & 0xffff0000;
+ val |= (('A' - '@') << 8) | 14;
+ pcicfgwrite(usb, 0x3c, val);
+
+ usb = pcimaketag(0, 14, 1);
+ val = pcicfgread(usb, 0x3c) & 0xffff0000;
+ val |= (('B' - '@') << 8) | 14;
+ pcicfgwrite(usb, 0x3c, val);
+
+ usb = pcimaketag(0, 14, 2);
+ val = pcicfgread(usb, 0x3c) & 0xffff0000;
+ val |= (('C' - '@') << 8) | 14;
+ pcicfgwrite(usb, 0x3c, val);
+ break;
}
}
diff -r 195f95442371 -r e6b6b5e98e5b sys/arch/sandpoint/stand/netboot/dev_net.c
--- a/sys/arch/sandpoint/stand/netboot/dev_net.c Thu May 13 09:56:12 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/dev_net.c Thu May 13 10:40:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dev_net.c,v 1.7 2009/01/12 09:41:59 tsutsui Exp $ */
+/* $NetBSD: dev_net.c,v 1.8 2010/05/13 10:40:02 phx Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -66,8 +66,8 @@
goto bad;
}
- /* XXX always to use "netbsd" kernel filename */
- strcpy(bootfile, "/netbsd");
+ if (bootfile[0] == '\0')
+ strcpy(bootfile, "netbsd");
if (nfs_mount(netdev_sock, rootip, rootpath) != 0) {
error = errno;
diff -r 195f95442371 -r e6b6b5e98e5b sys/arch/sandpoint/stand/netboot/entry.S
--- a/sys/arch/sandpoint/stand/netboot/entry.S Thu May 13 09:56:12 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/entry.S Thu May 13 10:40:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: entry.S,v 1.5 2010/03/02 21:52:32 matt Exp $ */
+/* $NetBSD: entry.S,v 1.6 2010/05/13 10:40:02 phx Exp $ */
#include <powerpc/psl.h>
#include <powerpc/spr.h>
@@ -47,6 +47,21 @@
ori 11,11,HID0_DCE
4:
+ lis 1,BAT123@ha
+ addi 1,1,BAT123@l
+ lwz 3,0(1)
+ lwz 4,4(1)
+ mtdbatl 1,3
+ mtdbatu 1,4
+ lwz 3,8(1)
+ lwz 4,12(1)
+ mtdbatl 2,3
+ mtdbatu 2,4
+ lwz 3,16(1)
+ lwz 4,20(1)
+ mtdbatl 3,3
+ mtdbatu 3,4
+
sync
mtspr SPR_HID0,8 /* enable and invalidate caches */
sync
@@ -148,3 +163,16 @@
lwbrx 3,0,3
eieio
blr
+
+ .data
+#define xBATL(pa, wimg, pp) \
+ ((pa) | (wimg) | (pp))
+#define xBATU(va, len, v) \
+ ((va) | ((len) & BAT_BL) | ((v) & BAT_V))
+BAT123:
+ .long xBATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW)
+ .long xBATU(0x80000000, BAT_BL_256M, BAT_Vs)
+ .long xBATL(0xfc000000, BAT_I|BAT_G, BAT_PP_RW)
+ .long xBATU(0xfc000000, BAT_BL_64M, BAT_Vs)
+ .long 0
+ .long 0
diff -r 195f95442371 -r e6b6b5e98e5b sys/arch/sandpoint/stand/netboot/main.c
--- a/sys/arch/sandpoint/stand/netboot/main.c Thu May 13 09:56:12 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/main.c Thu May 13 10:40:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.27 2010/05/08 19:41:07 phx Exp $ */
+/* $NetBSD: main.c,v 1.28 2010/05/13 10:40:02 phx Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -64,15 +64,15 @@
void
main(void)
{
- int n, b, d, f, howto;
- unsigned memsize, tag;
- unsigned long marks[MARK_MAX];
struct btinfo_memory bi_mem;
struct btinfo_console bi_cons;
struct btinfo_clock bi_clk;
struct btinfo_bootpath bi_path;
struct btinfo_rootdevice bi_rdev;
- unsigned lnif[1][2], lata[1][2];
+ unsigned long marks[MARK_MAX];
+ unsigned lata[1][2], lnif[1][2];
+ unsigned memsize, tag;
+ int b, d, f, fd, howto, n;
/* determine SDRAM size */
memsize = mpc107memsize();
@@ -132,12 +132,15 @@
if (netif_init(tag) == 0)
printf("no NIC device driver is found\n");
- printf("Try NFS load /netbsd\n");
+ if ((fd = open("net:", 0)) < 0) {
+ if (errno == ENOENT)
+ printf("\"%s\" not found\n", bootfile);
+ goto loadfail;
+ }
+ printf("loading \"%s\" ", bootfile);
marks[MARK_START] = 0;
- if (loadfile("net:", marks, LOAD_KERNEL) < 0) {
- printf("load failed. Restarting...\n");
- _rtt();
- }
+ if (fdloadfile(fd, marks, LOAD_KERNEL) < 0)
+ goto loadfail;
howto = RB_SINGLE | AB_VERBOSE;
#ifdef START_DDB_SESSION
@@ -176,6 +179,10 @@
/* should never come here */
printf("exec returned. Restarting...\n");
_rtt();
+
+ loadfail:
+ printf("load failed. Restarting...\n");
+ _rtt();
}
void
diff -r 195f95442371 -r e6b6b5e98e5b sys/arch/sandpoint/stand/netboot/pci.c
--- a/sys/arch/sandpoint/stand/netboot/pci.c Thu May 13 09:56:12 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/pci.c Thu May 13 10:40:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci.c,v 1.12 2009/06/12 00:24:33 nisimura Exp $ */
+/* $NetBSD: pci.c,v 1.13 2010/05/13 10:40:02 phx Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -219,12 +219,11 @@
val = 0x80 << 8 | 0x08 /* 32B cache line */;
cfgwrite(bus, dev, func, 0x0c, val);
-#if 1
-/* skip IDE controller BAR assignment */
-val = cfgread(bus, dev, func, PCI_CLASS_REG);
-if ((val >> 16) == PCI_CLASS_IDE)
- return 0;
-#endif
+ /* skip legacy mode IDE controller BAR assignment */
+ val = cfgread(bus, dev, func, PCI_CLASS_REG);
+ if ((val >> 16) == PCI_CLASS_IDE && ((val >> 8) & 0x05) == 0)
+ return 0;
+
memassign(bus, dev, func);
/* descending toward PCI-PCI bridge */
Home |
Main Index |
Thread Index |
Old Index