device_t/softc split. Compiled, but never run.
This commit is contained in:
parent
5e279a4e0f
commit
57ba504b86
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ifpga.c,v 1.22 2008/04/27 18:58:46 matt Exp $ */
|
||||
/* $NetBSD: ifpga.c,v 1.23 2009/07/21 16:04:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 ARM Ltd
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ifpga.c,v 1.22 2008/04/27 18:58:46 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ifpga.c,v 1.23 2009/07/21 16:04:16 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -66,12 +66,12 @@ __KERNEL_RCSID(0, "$NetBSD: ifpga.c,v 1.22 2008/04/27 18:58:46 matt Exp $");
|
|||
#include "locators.h"
|
||||
|
||||
/* Prototypes */
|
||||
static int ifpga_match (struct device *, struct cfdata *, void *);
|
||||
static void ifpga_attach (struct device *, struct device *, void *);
|
||||
static int ifpga_match (device_t, cfdata_t, void *);
|
||||
static void ifpga_attach (device_t, device_t, void *);
|
||||
static int ifpga_print (void *, const char *);
|
||||
|
||||
/* Drive and attach structures */
|
||||
CFATTACH_DECL(ifpga, sizeof(struct ifpga_softc),
|
||||
CFATTACH_DECL_NEW(ifpga, sizeof(struct ifpga_softc),
|
||||
ifpga_match, ifpga_attach, NULL, NULL);
|
||||
|
||||
int ifpga_found;
|
||||
|
@ -91,6 +91,8 @@ static struct bus_space ifpga_pci_mem_tag;
|
|||
static struct bus_space ifpga_bs_tag;
|
||||
|
||||
struct ifpga_softc *ifpga_sc;
|
||||
device_t ifpga_dev;
|
||||
|
||||
/*
|
||||
* Print the configuration information for children
|
||||
*/
|
||||
|
@ -109,10 +111,9 @@ ifpga_print(void *aux, const char *pnp)
|
|||
}
|
||||
|
||||
static int
|
||||
ifpga_search(struct device *parent, struct cfdata *cf,
|
||||
const int *ldesc, void *aux)
|
||||
ifpga_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
struct ifpga_softc *sc = (struct ifpga_softc *)parent;
|
||||
struct ifpga_softc *sc = device_private(parent);
|
||||
struct ifpga_attach_args ifa;
|
||||
int tryagain;
|
||||
|
||||
|
@ -133,7 +134,7 @@ ifpga_search(struct device *parent, struct cfdata *cf,
|
|||
}
|
||||
|
||||
static int
|
||||
ifpga_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
ifpga_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
#if 0
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
|
@ -151,9 +152,9 @@ ifpga_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
static void
|
||||
ifpga_attach(struct device *parent, struct device *self, void *aux)
|
||||
ifpga_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ifpga_softc *sc = (struct ifpga_softc *)self;
|
||||
struct ifpga_softc *sc = device_private(self);
|
||||
u_int id, sysclk;
|
||||
#if defined(PCI_NETBSD_CONFIGURE) && NPCI > 0
|
||||
struct extent *ioext, *memext, *pmemext;
|
||||
|
@ -176,13 +177,14 @@ ifpga_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
sc->sc_iot = &ifpga_bs_tag;
|
||||
|
||||
ifpga_dev = self;
|
||||
ifpga_sc = sc;
|
||||
|
||||
/* Now map in the IFPGA motherboard registers. */
|
||||
if (bus_space_map(sc->sc_iot, IFPGA_IO_SC_BASE, IFPGA_IO_SC_SIZE, 0,
|
||||
&sc->sc_sc_ioh))
|
||||
panic("%s: Cannot map system controller registers",
|
||||
self->dv_xname);
|
||||
device_xname(self));
|
||||
|
||||
id = bus_space_read_4(sc->sc_iot, sc->sc_sc_ioh, IFPGA_SC_ID);
|
||||
|
||||
|
@ -221,7 +223,7 @@ ifpga_attach(struct device *parent, struct device *self, void *aux)
|
|||
panic(" Unsupported bus");
|
||||
}
|
||||
|
||||
printf("\n%s: FPGA ", self->dv_xname);
|
||||
printf("\n%s: FPGA ", device_xname(self));
|
||||
|
||||
switch (id & IFPGA_SC_ID_FPGA_MASK)
|
||||
{
|
||||
|
@ -246,20 +248,22 @@ ifpga_attach(struct device *parent, struct device *self, void *aux)
|
|||
if (bus_space_map(sc->sc_iot, IFPGA_IO_IRQ_BASE, IFPGA_IO_IRQ_SIZE,
|
||||
BUS_SPACE_MAP_LINEAR, &sc->sc_irq_ioh))
|
||||
panic("%s: Cannot map irq controller registers",
|
||||
self->dv_xname);
|
||||
device_xname(self));
|
||||
|
||||
/* We can write to the IRQ/FIQ controller now. */
|
||||
ifpga_intr_postinit();
|
||||
|
||||
/* Map the core module */
|
||||
if (bus_space_map(sc->sc_iot, IFPGA_IO_CM_BASE, IFPGA_IO_CM_SIZE, 0,
|
||||
&sc->sc_cm_ioh))
|
||||
panic("%s: Cannot map core module registers", self->dv_xname);
|
||||
&sc->sc_cm_ioh)) {
|
||||
panic("%s: Cannot map core module registers",
|
||||
device_xname(self));
|
||||
}
|
||||
|
||||
/* Map the timers */
|
||||
if (bus_space_map(sc->sc_iot, IFPGA_IO_TMR_BASE, IFPGA_IO_TMR_SIZE, 0,
|
||||
&sc->sc_tmr_ioh))
|
||||
panic("%s: Cannot map timer registers", self->dv_xname);
|
||||
panic("%s: Cannot map timer registers", device_xname(self));
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
@ -275,7 +279,7 @@ ifpga_attach(struct device *parent, struct device *self, void *aux)
|
|||
&pci_sc->sc_conf_ioh)
|
||||
|| bus_space_map(pci_sc->sc_memt, IFPGA_V360_REG_BASE,
|
||||
IFPGA_V360_REG_SIZE, 0, &pci_sc->sc_reg_ioh))
|
||||
panic("%s: Cannot map pci memory", self->dv_xname);
|
||||
panic("%s: Cannot map pci memory", device_xname(self));
|
||||
|
||||
{
|
||||
pcireg_t id_reg, class_reg;
|
||||
|
@ -287,7 +291,7 @@ ifpga_attach(struct device *parent, struct device *self, void *aux)
|
|||
pci_sc->sc_reg_ioh, V360_PCI_CC_REV);
|
||||
|
||||
pci_devinfo(id_reg, class_reg, 1, buf, sizeof(buf));
|
||||
printf("%s: %s\n", self->dv_xname, buf);
|
||||
printf("%s: %s\n", device_xname(self), buf);
|
||||
}
|
||||
|
||||
#if defined(PCI_NETBSD_CONFIGURE)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ifpga_clock.c,v 1.13 2009/03/18 10:22:27 cegger Exp $ */
|
||||
/* $NetBSD: ifpga_clock.c,v 1.14 2009/07/21 16:04:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 ARM Ltd
|
||||
|
@ -39,7 +39,7 @@
|
|||
/* Include header files */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ifpga_clock.c,v 1.13 2009/03/18 10:22:27 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ifpga_clock.c,v 1.14 2009/07/21 16:04:16 dyoung Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -99,6 +99,7 @@ static struct timecounter ifpga_timecounter = {
|
|||
static volatile uint32_t ifpga_base;
|
||||
|
||||
extern struct ifpga_softc *ifpga_sc;
|
||||
extern device_t ifpga_dev;
|
||||
|
||||
static int clock_started = 0;
|
||||
|
||||
|
@ -287,7 +288,7 @@ cpu_initclocks(void)
|
|||
IPL_CLOCK, clockhandler, 0);
|
||||
if (ifpga_sc->sc_clockintr == NULL)
|
||||
panic("%s: Cannot install timer 1 interrupt handler",
|
||||
ifpga_sc->sc_dev.dv_xname);
|
||||
device_xname(ifpga_dev));
|
||||
|
||||
ifpga_sc->sc_clock_count
|
||||
= load_timer(IFPGA_TIMER1_BASE, intvl);
|
||||
|
@ -306,7 +307,7 @@ cpu_initclocks(void)
|
|||
IPL_HIGH, statclockhandler, 0);
|
||||
if (ifpga_sc->sc_statclockintr == NULL)
|
||||
panic("%s: Cannot install timer 2 interrupt handler",
|
||||
ifpga_sc->sc_dev.dv_xname);
|
||||
device_xname(ifpga_dev));
|
||||
load_timer(IFPGA_TIMER2_BASE, statint);
|
||||
|
||||
tc_init(&ifpga_timecounter);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ifpga_pci.c,v 1.12 2005/12/11 12:17:09 christos Exp $ */
|
||||
/* $NetBSD: ifpga_pci.c,v 1.13 2009/07/21 16:04:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 ARM Ltd
|
||||
|
@ -64,7 +64,7 @@
|
|||
#define _ARM32_BUS_DMA_PRIVATE
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ifpga_pci.c,v 1.12 2005/12/11 12:17:09 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ifpga_pci.c,v 1.13 2009/07/21 16:04:16 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -85,7 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ifpga_pci.c,v 1.12 2005/12/11 12:17:09 christos Exp
|
|||
#include <evbarm/dev/v360reg.h>
|
||||
|
||||
|
||||
void ifpga_pci_attach_hook (struct device *, struct device *,
|
||||
void ifpga_pci_attach_hook (device_t, device_t,
|
||||
struct pcibus_attach_args *);
|
||||
int ifpga_pci_bus_maxdevs (void *, int);
|
||||
pcitag_t ifpga_pci_make_tag (void *, int, int, int);
|
||||
|
@ -156,7 +156,7 @@ pci_intr(void *arg)
|
|||
|
||||
|
||||
void
|
||||
ifpga_pci_attach_hook(struct device *parent, struct device *self,
|
||||
ifpga_pci_attach_hook(device_t parent, device_t self,
|
||||
struct pcibus_attach_args *pba)
|
||||
{
|
||||
#ifdef PCI_DEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ifpga_pcivar.h,v 1.1 2001/10/27 16:19:09 rearnsha Exp $ */
|
||||
/* $NetBSD: ifpga_pcivar.h,v 1.2 2009/07/21 16:04:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 ARM Ltd
|
||||
|
@ -30,8 +30,6 @@
|
|||
*/
|
||||
|
||||
struct ifpga_pci_softc {
|
||||
struct device sc_dev;
|
||||
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_io_ioh;
|
||||
bus_space_handle_t sc_conf_ioh;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ifpgavar.h,v 1.4 2005/12/11 12:17:09 christos Exp $ */
|
||||
/* $NetBSD: ifpgavar.h,v 1.5 2009/07/21 16:04:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 ARM Ltd
|
||||
|
@ -45,7 +45,6 @@
|
|||
typedef paddr_t ifpga_addr_t;
|
||||
|
||||
struct ifpga_softc {
|
||||
struct device sc_dev; /* Device node */
|
||||
bus_space_tag_t sc_iot; /* Bus tag */
|
||||
bus_space_handle_t sc_sc_ioh; /* System Controller handle */
|
||||
bus_space_handle_t sc_cm_ioh; /* Core Module handle */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pl030_rtc.c,v 1.8 2007/02/19 02:08:12 briggs Exp $ */
|
||||
/* $NetBSD: pl030_rtc.c,v 1.9 2009/07/21 16:04:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 ARM Ltd
|
||||
|
@ -32,7 +32,7 @@
|
|||
/* Include header files */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pl030_rtc.c,v 1.8 2007/02/19 02:08:12 briggs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pl030_rtc.c,v 1.9 2009/07/21 16:04:16 dyoung Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -52,16 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: pl030_rtc.c,v 1.8 2007/02/19 02:08:12 briggs Exp $")
|
|||
#define PL030_RTC_SIZE 0x14
|
||||
|
||||
struct plrtc_softc {
|
||||
struct device sc_dev;
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
struct todr_chip_handle sc_todr;
|
||||
};
|
||||
|
||||
static int plrtc_probe (struct device *, struct cfdata *, void *);
|
||||
static void plrtc_attach (struct device *, struct device *, void *);
|
||||
static int plrtc_probe (device_t, cfdata_t, void *);
|
||||
static void plrtc_attach (device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(plrtc, sizeof(struct plrtc_softc),
|
||||
CFATTACH_DECL_NEW(plrtc, sizeof(struct plrtc_softc),
|
||||
plrtc_probe, plrtc_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
|
@ -86,21 +85,21 @@ plrtc_settime(todr_chip_handle_t todr, volatile struct timeval *tv)
|
|||
}
|
||||
|
||||
static int
|
||||
plrtc_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
plrtc_probe(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
plrtc_attach(struct device *parent, struct device *self, void *aux)
|
||||
plrtc_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ifpga_attach_args *ifa = aux;
|
||||
struct plrtc_softc *sc = (struct plrtc_softc *)self;
|
||||
struct plrtc_softc *sc = device_private(self);
|
||||
|
||||
sc->sc_iot = ifa->ifa_iot;
|
||||
if (bus_space_map(ifa->ifa_iot, ifa->ifa_addr, PL030_RTC_SIZE, 0,
|
||||
&sc->sc_ioh)) {
|
||||
printf("%s: unable to map device\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: unable to map device\n", device_xname(self));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue