- be more cautious before turning on Dcache.

- add lines to determine platform identification .
- fix a little ANSI style conversion breakage.
This commit is contained in:
nisimura 2009-06-12 00:24:33 +00:00
parent 94cd590d07
commit 1d622581c6
5 changed files with 92 additions and 17 deletions

View File

@ -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 @@ brdsetup(void)
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);

View File

@ -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, 0xfec00000@ha /* CONFIG_ADDR of PCI */
lis 6, 0xfee00000@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 @@ _start:
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,0xfffe0000@ha /* BAT_EPI */
andis. 4,4,BAT_RPN@ha
cmplw 0,3,4
bnelr
add 4,4,0
oris 4,4,0x0001ffff@ha
ori 4,4,0x0001ffff@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)
*/

View File

@ -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 @@ extern int brdtype;
#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 */

View File

@ -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 @@ void bi_add(void *, int, int);
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 @@ main(void)
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);

View File

@ -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 @@ pcifinddev(unsigned vend, unsigned prod, unsigned *tag)
}
*tag = ~0;
return -1;
}
}
int
pcilookup(type, list, max)
@ -344,8 +344,7 @@ clsmatch(int bus, int dev, int func, unsigned long data)
}
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 @@ unsigned list[][2];
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)