Module Name: src Committed By: nisimura Date: Fri Jun 12 00:24:33 UTC 2009
Modified Files: src/sys/arch/sandpoint/stand/netboot: brdsetup.c entry.S globals.h main.c pci.c Log Message: - be more cautious before turning on Dcache. - add lines to determine platform identification . - fix a little ANSI style conversion breakage. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/netboot/brdsetup.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sandpoint/stand/netboot/entry.S cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/netboot/globals.h cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sandpoint/stand/netboot/main.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sandpoint/stand/netboot/pci.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/sandpoint/stand/netboot/brdsetup.c diff -u src/sys/arch/sandpoint/stand/netboot/brdsetup.c:1.6 src/sys/arch/sandpoint/stand/netboot/brdsetup.c:1.7 --- src/sys/arch/sandpoint/stand/netboot/brdsetup.c:1.6 Wed Mar 18 10:22:35 2009 +++ src/sys/arch/sandpoint/stand/netboot/brdsetup.c Fri Jun 12 00:24:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: brdsetup.c,v 1.6 2009/03/18 10:22:35 cegger Exp $ */ +/* $NetBSD: brdsetup.c,v 1.7 2009/06/12 00:24:33 nisimura Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -80,13 +80,21 @@ brdtype = BRD_ENCOREPP1; setup_82C686B(); } + else if ((pcicfgread(pcimaketag(0, 11, 0), PCI_CLASS_REG) >> 16) == + PCI_CLASS_ETH) { + /* tlp (ADMtek AN985) or re (RealTek 8169S) at dev 11 */ + brdtype = BRD_KUROBOX; + consname = "eumb"; + consport = 0x4600; + consspeed = 57600; + } /* now prepare serial console */ - if (strcmp(CONSNAME, "eumb") != 0) - uartbase = 0xfe000000 + CONSPORT; /* 0x3f8, 0x2f8 */ + if (strcmp(consname, "eumb") != 0) + uartbase = 0xfe000000 + consport; /* 0x3f8, 0x2f8 */ else { - uartbase = 0xfc000000 + CONSPORT; /* 0x4500, 0x4600 */ - div = (TICKS_PER_SEC * 4) / CONSSPEED / 16; + uartbase = 0xfc000000 + consport; /* 0x4500, 0x4600 */ + div = (TICKS_PER_SEC * 4) / consspeed / 16; UART_WRITE(DCR, 0x01); /* 2 independent UART */ UART_WRITE(LCR, 0x80); /* turn on DLAB bit */ UART_WRITE(FCR, 0x00); Index: src/sys/arch/sandpoint/stand/netboot/entry.S diff -u src/sys/arch/sandpoint/stand/netboot/entry.S:1.3 src/sys/arch/sandpoint/stand/netboot/entry.S:1.4 --- src/sys/arch/sandpoint/stand/netboot/entry.S:1.3 Mon Nov 5 13:41:48 2007 +++ src/sys/arch/sandpoint/stand/netboot/entry.S Fri Jun 12 00:24:33 2009 @@ -1,6 +1,8 @@ -/* $NetBSD: entry.S,v 1.3 2007/11/05 13:41:48 nisimura Exp $ */ +/* $NetBSD: entry.S,v 1.4 2009/06/12 00:24:33 nisimura Exp $ */ +#include <powerpc/psl.h> #include <powerpc/spr.h> +#include <powerpc/oea/bat.h> #include <powerpc/oea/hid.h> .text @@ -8,11 +10,42 @@ _start: mfspr 11,SPR_HID0 andi. 0,11,HID0_DCE - ori 11,11,HID0_ICE|HID0_DCE + ori 11,11,HID0_ICE ori 8,11,HID0_ICFI bne 1f /* don't invalidate the D-cache */ ori 8,8,HID0_DCFI /* unless it wasn't enabled */ 1: + mfmsr 0 + andi. 0,0,PSL_DR + beq 2f + lis 5, 0xfec00...@ha /* CONFIG_ADDR of PCI */ + lis 6, 0xfee00...@ha /* CONFIG_DATA of PCI */ + mfspr 3,SPR_DBAT0U + mfspr 4,SPR_DBAT0L + bl dbat_sanity_check + beq 3f + mfspr 3,SPR_DBAT1U + mfspr 4,SPR_DBAT1L + bl dbat_sanity_check + beq 3f + mfspr 3,SPR_DBAT2U + mfspr 4,SPR_DBAT2L + bl dbat_sanity_check + beq 3f + mfspr 3,SPR_DBAT3U + mfspr 4,SPR_DBAT3L + bl dbat_sanity_check + beq 3f + +2: /* Disable D-cache */ + li 0,HID0_DCE + andc 11,11,0 + b 4f + +3: /* Enable D-cache */ + ori 11,11,HID0_DCE + +4: sync mtspr SPR_HID0,8 /* enable and invalidate caches */ sync @@ -45,6 +78,33 @@ hang: b hang /* NOTREACHED */ +dbat_sanity_check: + andi. 0,3,BAT_Vs + beq 2f + andi. 0,4,BAT_I|BAT_PP_RW + cmpwi 0,0,BAT_I|BAT_PP_RW + bnelr + rlwinm 0,3,15,4,14 + andis. 3,3,0xfffe0...@ha /* BAT_EPI */ + andis. 4,4,bat_...@ha + cmplw 0,3,4 + bnelr + add 4,4,0 + oris 4,4,0x0001f...@ha + ori 4,4,0x0001f...@l + cmplw 0,3,5 + bgt 1f + cmplw 0,5,4 + bgt 1f + li 5,0 +1: cmplw 0,3,6 + bgt 2f + cmplw 0,6,4 + bgt 2f + li 6,0 +2: cmplw 0,5,6 + blr + /* * run(startsym, endsym, howto, bootinfo, entry) */ Index: src/sys/arch/sandpoint/stand/netboot/globals.h diff -u src/sys/arch/sandpoint/stand/netboot/globals.h:1.8 src/sys/arch/sandpoint/stand/netboot/globals.h:1.9 --- src/sys/arch/sandpoint/stand/netboot/globals.h:1.8 Mon Jan 12 09:41:59 2009 +++ src/sys/arch/sandpoint/stand/netboot/globals.h Fri Jun 12 00:24:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: globals.h,v 1.8 2009/01/12 09:41:59 tsutsui Exp $ */ +/* $NetBSD: globals.h,v 1.9 2009/06/12 00:24:33 nisimura Exp $ */ /* clock feed */ #ifndef TICKS_PER_SEC @@ -11,8 +11,13 @@ #define BRD_SANDPOINTX2 2 #define BRD_SANDPOINTX3 3 #define BRD_ENCOREPP1 10 +#define BRD_KUROBOX 100 #define BRD_UNKNOWN -1 +extern char *consname; +extern int consport; +extern int consspeed; + unsigned mpc107memsize(void); /* PPC processor ctl */ Index: src/sys/arch/sandpoint/stand/netboot/main.c diff -u src/sys/arch/sandpoint/stand/netboot/main.c:1.21 src/sys/arch/sandpoint/stand/netboot/main.c:1.22 --- src/sys/arch/sandpoint/stand/netboot/main.c:1.21 Wed Mar 18 10:22:35 2009 +++ src/sys/arch/sandpoint/stand/netboot/main.c Fri Jun 12 00:24:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.21 2009/03/18 10:22:35 cegger Exp $ */ +/* $NetBSD: main.c,v 1.22 2009/06/12 00:24:33 nisimura Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -55,6 +55,9 @@ extern char bootprog_rev[], bootprog_maker[], bootprog_date[]; int brdtype; +char *consname = CONSNAME; +int consport = CONSPORT; +int consspeed = CONSSPEED; void main(void) @@ -129,9 +132,9 @@ bi_init(bootinfo); bi_mem.memsize = memsize; - snprintf(bi_cons.devname, sizeof(bi_cons.devname), CONSNAME); - bi_cons.addr = CONSPORT; - bi_cons.speed = CONSSPEED; + snprintf(bi_cons.devname, sizeof(bi_cons.devname), consname); + bi_cons.addr = consport; + bi_cons.speed = consspeed; bi_clk.ticks_per_sec = TICKS_PER_SEC; snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), bootfile); snprintf(bi_rdev.devname, sizeof(bi_rdev.devname), rootdev); Index: src/sys/arch/sandpoint/stand/netboot/pci.c diff -u src/sys/arch/sandpoint/stand/netboot/pci.c:1.11 src/sys/arch/sandpoint/stand/netboot/pci.c:1.12 --- src/sys/arch/sandpoint/stand/netboot/pci.c:1.11 Wed Mar 18 10:22:35 2009 +++ src/sys/arch/sandpoint/stand/netboot/pci.c Fri Jun 12 00:24:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.c,v 1.11 2009/03/18 10:22:35 cegger Exp $ */ +/* $NetBSD: pci.c,v 1.12 2009/06/12 00:24:33 nisimura Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ } *tag = ~0; return -1; -} +} int pcilookup(type, list, max) @@ -344,8 +344,7 @@ } static int -_pcilookup(int bus, int (*match)(int, int, int, unsigned long), unsigned long data, list, int index, int limit) -unsigned list[][2]; +_pcilookup(int bus, int (*match)(int, int, int, unsigned long), unsigned long data, unsigned list[][2], int index, int limit) { int device, function, nfuncs; unsigned pciid, bhlcr, class; @@ -375,7 +374,7 @@ continue; if ((*match)(bus, device, function, data)) { list[index][0] = pciid; - list[index][1] = + list[index][1] = pcimaketag(bus, device, function); index += 1; if (index >= limit)