Update for walnut.h/ibm405gp.h changes.

This commit is contained in:
simonb 2001-06-24 01:15:41 +00:00
parent 8980655597
commit 6d4b6ead83
5 changed files with 52 additions and 57 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibm405gp.c,v 1.2 2001/06/22 11:37:49 simonb Exp $ */
/* $NetBSD: ibm405gp.c,v 1.3 2001/06/24 01:15:41 simonb Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -40,7 +40,6 @@
#include <sys/systm.h>
#include <machine/bus.h>
#include <machine/walnut.h>
#include <dev/pci/pcivar.h>
#include <powerpc/ibm4xx/ibm405gp.h>
@ -54,7 +53,7 @@ static void setup_pcicfg_window(void)
{
if (pcicfg_ioh)
return;
if (bus_space_map(pcicfg_iot, PCIL_BASE, 0x40 , 0, &pcicfg_ioh))
if (bus_space_map(pcicfg_iot, PCIL0_BASE, 0x40 , 0, &pcicfg_ioh))
panic("Cannot map PCI configuration registers\n");
}
@ -69,29 +68,29 @@ void galaxy_setup_pci(void)
setup_pcicfg_window();
/* Disable all three memory mappers */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM0MA, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM1MA, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM2MA, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PTM1MS, 0x00000000); /* Can't really disable PTM1. */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PTM2MS, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0MA, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM1MA, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM2MA, 0x00000000); /* disabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM1MS, 0x00000000); /* Can't really disable PTM1. */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM2MS, 0x00000000); /* disabled */
/* Setup memory map #0 */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM0MA, 0xF0000001); /* 256M non-prefetchable, enabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0MA, 0xF0000001); /* 256M non-prefetchable, enabled */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM0LA, PCI0_MEM_BASE);
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM0PCILA, PCI0_MEM_BASE);
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PMM0PCIHA, 0);
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0LA, PCI0_MEM_BASE);
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0PCILA, PCI0_MEM_BASE);
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0PCIHA, 0);
/* Configure PCI bridge */
tag = pci_make_tag(0, 0, 0, 0);
// x = pci_conf_read(0, tag, PCI0_CMD); /* Read PCI command register */
// pci_conf_write(0, tag, PCI0_CMD, x | MA | ME); /* enable bus mastering and memory space */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PTM1MS, 0xF0000001); /* Enable PTM1 */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PTM1LA, 0);
pci_conf_write(0, tag, PCI0_PTM1BAR, 0); /* Set up proper PCI->Local address base. Always enabled */
pci_conf_write(0, tag, PCI0_PTM2BAR, 0);
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM1MS, 0xF0000001); /* Enable PTM1 */
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM1LA, 0);
pci_conf_write(0, tag, PCIC0_PTM1BAR, 0); /* Set up proper PCI->Local address base. Always enabled */
pci_conf_write(0, tag, PCIC0_PTM2BAR, 0);
}
void galaxy_show_pci_map(void)
@ -102,38 +101,38 @@ void galaxy_show_pci_map(void)
setup_pcicfg_window();
printf("Local -> PCI map\n");
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM0LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM0MA);
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM0PCILA);
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM0PCIHA);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0MA);
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0PCILA);
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM0PCIHA);
printf("0: %08lx,%08lx -> %08lx%08lx %sprefetchable, %s\n", la, lm, ph, pl,
(lm & 2) ? "":"not ",
(lm & 1) ? "enabled":"disabled");
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM1LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM1MA);
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM1PCILA);
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM1PCIHA);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM1LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM1MA);
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM1PCILA);
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM1PCIHA);
printf("1: %08lx,%08lx -> %08lx%08lx %sprefetchable, %s\n", la, lm, ph, pl,
(lm & 2) ? "":"not ",
(lm & 1) ? "enabled":"disabled");
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM2LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM2MA);
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM2PCILA);
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PMM2PCIHA);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM2LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM2MA);
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM2PCILA);
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PMM2PCIHA);
printf("2: %08lx,%08lx -> %08lx%08lx %sprefetchable, %s\n", la, lm, ph, pl,
(lm & 2) ? "":"not ",
(lm & 1) ? "enabled":"disabled");
printf("PCI -> Local map\n");
tag = pci_make_tag(0, 0, 0, 0);
pl = pci_conf_read(0, tag, PCI0_PTM1BAR);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PTM1LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PTM1MS);
pl = pci_conf_read(0, tag, PCIC0_PTM1BAR);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM1LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM1MS);
printf("1: %08lx -> %08lx,%08lx %s\n", pl, la, lm,
(lm & 1)?"enabled":"disabled");
pl = pci_conf_read(0, tag, PCI0_PTM2BAR);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PTM2LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PTM2MS);
pl = pci_conf_read(0, tag, PCIC0_PTM2BAR);
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM2LA);
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL0_PTM2MS);
printf("2: %08lx -> %08lx,%08lx %s\n", pl, la, lm,
(lm & 1)?"enabled":"disabled");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.1 2001/06/13 06:02:00 simonb Exp $ */
/* $NetBSD: pci_machdep.c,v 1.2 2001/06/24 01:15:41 simonb Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -70,14 +70,12 @@
static bus_space_tag_t pci_iot;
static bus_space_handle_t pci_ioh;
#define OFF(r) ((r)-PCI0_CFGADDR)
void pci_machdep_init(void)
{
if (pci_ioh == 0) {
pci_iot = 0;
if (bus_space_map(pci_iot,PCI0_CFGADDR,8,0,&pci_ioh)){
if (bus_space_map(pci_iot, PCIC0_BASE, 8, 0, &pci_ioh)){
panic("Cannot map PCI registers\n");
}
}
@ -141,9 +139,9 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
pcireg_t data;
/* 405GT BIOS disables interrupts here. Should we? --Art */
bus_space_write_4(pci_iot,pci_ioh, OFF(PCI0_CFGADDR), tag | reg);
data = bus_space_read_4(pci_iot,pci_ioh,OFF(PCI0_CFGDATA));
bus_space_write_4(pci_iot,pci_ioh,OFF(PCI0_CFGADDR), 0); /* 405GP pass2 errata #6 */
bus_space_write_4(pci_iot, pci_ioh, PCIC0_CFGADDR, tag | reg);
data = bus_space_read_4(pci_iot, pci_ioh, PCIC0_CFGDATA);
bus_space_write_4(pci_iot, pci_ioh, PCIC0_CFGADDR, 0); /* 405GP pass2 errata #6 */
return data;
}
@ -151,9 +149,9 @@ void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
bus_space_write_4(pci_iot,pci_ioh, OFF(PCI0_CFGADDR), tag | reg);
bus_space_write_4(pci_iot,pci_ioh,OFF(PCI0_CFGDATA), data);
bus_space_write_4(pci_iot,pci_ioh,OFF(PCI0_CFGADDR), 0); /* 405GP pass2 errata #6 */
bus_space_write_4(pci_iot, pci_ioh, PCIC0_CFGADDR, tag | reg);
bus_space_write_4(pci_iot, pci_ioh, PCIC0_CFGDATA, data);
bus_space_write_4(pci_iot, pci_ioh, PCIC0_CFGADDR, 0); /* 405GP pass2 errata #6 */
}
@ -179,7 +177,7 @@ pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
case 3: *ihp = 2; break; /* Slot 1 Ext IRQ 5 */
case 4: *ihp = 1; break; /* Slot 0 Ext IRQ 6 */
default:
printf("Hmm.. PCI device %d should not exist on this board\n",dev);
printf("Hmm.. PCI device %d should not exist on this board\n", dev);
goto bad;
}
return 0;
@ -192,7 +190,7 @@ bad:
const char *
pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
{
static char irqstr[8]; /* 4 + 2 + NULL + sanity */
static char irqstr[8]; /* 4 + 2 + NUL + sanity */
if (ih == 0 || ih >= ICU_LEN)
panic("pci_intr_string: bogus handle 0x%x\n", ih);

View File

@ -1,4 +1,4 @@
/* $NetBSD: consinit.c,v 1.1 2001/06/13 06:02:01 simonb Exp $ */
/* $NetBSD: consinit.c,v 1.2 2001/06/24 01:15:41 simonb Exp $ */
/*
* Copyright (c) 1998
@ -31,7 +31,7 @@
#include <sys/device.h>
#include <machine/bus.h>
#include <machine/walnut.h>
#include <powerpc/ibm4xx/ibm405gp.h>
#include "com.h"
#if (NCOM > 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.1 2001/06/13 06:02:01 simonb Exp $ */
/* $NetBSD: locore.S,v 1.2 2001/06/24 01:15:41 simonb Exp $ */
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
/*
@ -83,10 +83,8 @@
#include <machine/psl.h>
#include <machine/trap.h>
#include <machine/asm.h>
#include <machine/walnut.h>
#include <powerpc/spr.h>
#include <powerpc/ibm4xx/dcr.h>
#include <powerpc/ibm4xx/pmap.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.3 2001/06/22 13:21:35 simonb Exp $ */
/* $NetBSD: mainbus.c,v 1.4 2001/06/24 01:15:41 simonb Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -79,12 +79,12 @@
#include <machine/bus.h>
#include <machine/walnut.h>
#include <powerpc/ibm4xx/ibm405gp.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
#include <dev/pci/pciconf.h>
#include <powerpc/ibm4xx/ibm405gp.h>
/*
* The devices built in to the 405GP cpu.
*/
@ -96,9 +96,9 @@ const struct ppc405gp_dev {
{ "com", UART0_BASE, 5 },
{ "com", UART1_BASE, 6 },
{ "dsrtc", NVRAM_BASE, -1 },
{ "emac", MIO6_START, 9 }, /* XXX: really irq 9..15 */
{ "gpio", MIO5_START, -1 },
{ "i2c", MIO4_START, -1 },
{ "emac", EMAC0_BASE, 9 }, /* XXX: really irq 9..15 */
{ "gpio", GPIO0_BASE, -1 },
{ "i2c", IIC0_BASE, -1 },
{ "wdog", -1, -1 },
{ "pckbc", KEY_MOUSE_BASE, -1 }, /* XXX: really irq x..x+1 */
{ NULL }