enable PCI_NETBSD_CONFIGURE for ofppc.
the call to pci_configure_bus(9) and it's supporting code is copied verbatim from the prep port. this allows us to completely remove the really gross pegasos specific pegasospci_indirect_attach_hook() that set various pci command regs, since all those devices (mostly work now, see below) and additionally PCI plugin cards work now too. it also makes the pegasos onboard vr(4) ethernet work with disk boot (it previously only worked with netboot.) in the generic macppc ofw pci conf hook and for pegasos, don't configure the viaide(4) device, and don't configure memory space on the fwohci(4) device. with this, and my other recent ofppc/ppc changes the pegasos port is mostly functional. the marvell gige is not working, and my 512mb appears as only about 256mb, but otherwise this port is almost done!
This commit is contained in:
parent
5206bb3800
commit
626bd12a5c
@ -1,4 +1,4 @@
|
||||
# $NetBSD: std.ofppc,v 1.12 2005/12/11 12:18:29 christos Exp $
|
||||
# $NetBSD: std.ofppc,v 1.13 2008/01/11 05:18:58 mrg Exp $
|
||||
#
|
||||
# standard, required NetBSD/ofppc 'options'
|
||||
|
||||
@ -12,3 +12,5 @@ options EXEC_ELF32 # exec ELF binaries
|
||||
options EXEC_SCRIPT # exec #! scripts
|
||||
|
||||
options INTSTK=0x2000
|
||||
|
||||
options PCI_NETBSD_CONFIGURE
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pegasospci.c,v 1.10 2008/01/09 07:35:29 mrg Exp $ */
|
||||
/* $NetBSD: pegasospci.c,v 1.11 2008/01/11 05:18:58 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -37,14 +37,18 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pegasospci.c,v 1.10 2008/01/09 07:35:29 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pegasospci.c,v 1.11 2008/01/11 05:18:58 mrg Exp $");
|
||||
|
||||
#include "opt_pci.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pciconf.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_pci.h>
|
||||
|
||||
@ -62,8 +66,6 @@ struct pegasospci_softc {
|
||||
|
||||
static void pegasospci_attach(struct device *, struct device *, void *);
|
||||
static int pegasospci_match(struct device *, struct cfdata *, void *);
|
||||
static void pegasospci_indirect_attach_hook(struct device *, struct device *,
|
||||
struct pcibus_attach_args *);
|
||||
static pcireg_t pegasospci_indirect_conf_read(void *, pcitag_t, int);
|
||||
static void pegasospci_indirect_conf_write(void *, pcitag_t, int, pcireg_t);
|
||||
|
||||
@ -135,6 +137,9 @@ pegasospci_attach(struct device *parent, struct device *self, void *aux)
|
||||
struct genppc_pci_chipset_businfo *pbi;
|
||||
int isprim = 0, node = ca->ca_node;
|
||||
uint32_t reg[2], busrange[2];
|
||||
#ifdef PCI_NETBSD_CONFIGURE
|
||||
struct extent *ioext, *memext;
|
||||
#endif
|
||||
|
||||
aprint_normal("\n");
|
||||
|
||||
@ -188,7 +193,6 @@ pegasospci_attach(struct device *parent, struct device *self, void *aux)
|
||||
/* Pegasos2: primary PCI host (33MHz) @ 0x80000000 */
|
||||
pc->pc_addr = mapiodev(PEGASOS2_PCI0_ADDR, 4);
|
||||
pc->pc_data = mapiodev(PEGASOS2_PCI0_DATA, 4);
|
||||
pc->pc_attach_hook = pegasospci_indirect_attach_hook;
|
||||
} else {
|
||||
/* Pegasos2: second PCI host (66MHz) @ 0xc0000000 */
|
||||
pc->pc_addr = mapiodev(PEGASOS2_PCI1_ADDR, 4);
|
||||
@ -208,6 +212,19 @@ pegasospci_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
genofw_setup_pciintr_map((void *)pc, pbi, pc->pc_node);
|
||||
|
||||
#ifdef PCI_NETBSD_CONFIGURE
|
||||
ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF,
|
||||
NULL, 0, EX_NOWAIT);
|
||||
memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF,
|
||||
NULL, 0, EX_NOWAIT);
|
||||
|
||||
if (pci_configure_bus(pc, ioext, memext, NULL, 0, CACHELINESIZE))
|
||||
printf("pci_configure_bus() failed\n");
|
||||
|
||||
extent_destroy(ioext);
|
||||
extent_destroy(memext);
|
||||
#endif /* PCI_NETBSD_CONFIGURE */
|
||||
|
||||
memset(&pba, 0, sizeof(pba));
|
||||
pba.pba_memt = pc->pc_memt;
|
||||
pba.pba_iot = pc->pc_iot;
|
||||
@ -221,46 +238,6 @@ pegasospci_attach(struct device *parent, struct device *self, void *aux)
|
||||
config_found_ia(self, "pcibus", &pba, pcibusprint);
|
||||
}
|
||||
|
||||
static void
|
||||
pegasospci_indirect_attach_hook(struct device *parent, struct device *self,
|
||||
struct pcibus_attach_args *pba)
|
||||
{
|
||||
pcitag_t tag;
|
||||
pcireg_t reg;
|
||||
pci_chipset_tag_t pc;
|
||||
|
||||
if (pba->pba_bus != 0)
|
||||
return;
|
||||
|
||||
aprint_normal(": indirect configuration space access");
|
||||
|
||||
/*
|
||||
* SmartFirmware 1.2 only initializes the devices it will use,
|
||||
* i.e. ATA, USB, serial, network. Devices like Firewire or Audio
|
||||
* are lacking the IO/MEM-enable flags in the PCI command register,
|
||||
* although the interrupt assignments and BARs are correctly set up.
|
||||
*/
|
||||
pc = pba->pba_pc;
|
||||
|
||||
/* VT6306 IEEE 1394: device 1 */
|
||||
tag = pci_make_tag(pc, pba->pba_bus, 1, 0);
|
||||
reg = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
reg |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE;
|
||||
pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
|
||||
/* VT82C686A AC97: device 12, function 5 */
|
||||
tag = pci_make_tag(pc, pba->pba_bus, 12, 5);
|
||||
reg = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
reg |= PCI_COMMAND_IO_ENABLE;
|
||||
pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
|
||||
/* VT6102 (Rhine II) 10/100 Ethernet: device 13, function 0 */
|
||||
tag = pci_make_tag(pc, pba->pba_bus, 13, 0);
|
||||
reg = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
reg |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE;
|
||||
pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
}
|
||||
|
||||
static pcireg_t
|
||||
pegasospci_indirect_conf_read(void *cookie, pcitag_t tag, int reg)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pci_machdep_ofw.c,v 1.6 2007/11/05 15:49:03 garbled Exp $ */
|
||||
/* $NetBSD: pci_machdep_ofw.c,v 1.7 2008/01/11 05:18:58 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep_ofw.c,v 1.6 2007/11/05 15:49:03 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep_ofw.c,v 1.7 2008/01/11 05:18:58 mrg Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -459,6 +459,22 @@ genofw_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev, int func,
|
||||
PCI_PRODUCT(id) == PCI_PRODUCT_MOT_RAVEN)
|
||||
return (PCI_CONF_ALL & ~PCI_CONF_MAP_MEM);
|
||||
|
||||
/*
|
||||
* Pegasos2 specific stuff.
|
||||
*/
|
||||
if (strncmp(model_name, "Pegasos2", 8) == 0) {
|
||||
|
||||
/* we want to leave viaide(4) alone */
|
||||
if (PCI_VENDOR(id) == PCI_VENDOR_VIATECH &&
|
||||
PCI_PRODUCT(id) == PCI_PRODUCT_VIATECH_VT82C586A_IDE)
|
||||
return 0;
|
||||
|
||||
/* we want to leave fwochi(4) without mem space */
|
||||
if (PCI_VENDOR(id) == PCI_VENDOR_VIATECH &&
|
||||
PCI_PRODUCT(id) == PCI_PRODUCT_VIATECH_VT6306)
|
||||
return (PCI_CONF_ALL & ~PCI_CONF_MAP_MEM);
|
||||
}
|
||||
|
||||
/* NOTE, all device specific stuff must be above this line */
|
||||
/* don't do this on the primary host bridge */
|
||||
if (bus == 0 && dev == 0 && func == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user