Module Name: src
Committed By: dyoung
Date: Tue Jul 21 16:04:16 UTC 2009
Modified Files:
src/sys/arch/evbarm/ifpga: ifpga.c ifpga_clock.c ifpga_pci.c
ifpga_pcivar.h ifpgavar.h pl030_rtc.c
Log Message:
device_t/softc split. Compiled, but never run.
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/ifpga/ifpga.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/ifpga/ifpga_clock.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/ifpga/ifpga_pci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/ifpga/ifpga_pcivar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/ifpga/ifpgavar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/ifpga/pl030_rtc.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/evbarm/ifpga/ifpga.c
diff -u src/sys/arch/evbarm/ifpga/ifpga.c:1.22 src/sys/arch/evbarm/ifpga/ifpga.c:1.23
--- src/sys/arch/evbarm/ifpga/ifpga.c:1.22 Sun Apr 27 18:58:46 2008
+++ src/sys/arch/evbarm/ifpga/ifpga.c Tue Jul 21 16:04:16 2009
@@ -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 @@
#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_bs_tag;
struct ifpga_softc *ifpga_sc;
+device_t ifpga_dev;
+
/*
* Print the configuration information for children
*/
@@ -109,10 +111,9 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
&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 @@
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)
Index: src/sys/arch/evbarm/ifpga/ifpga_clock.c
diff -u src/sys/arch/evbarm/ifpga/ifpga_clock.c:1.13 src/sys/arch/evbarm/ifpga/ifpga_clock.c:1.14
--- src/sys/arch/evbarm/ifpga/ifpga_clock.c:1.13 Wed Mar 18 10:22:27 2009
+++ src/sys/arch/evbarm/ifpga/ifpga_clock.c Tue Jul 21 16:04:16 2009
@@ -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 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 @@
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 @@
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);
Index: src/sys/arch/evbarm/ifpga/ifpga_pci.c
diff -u src/sys/arch/evbarm/ifpga/ifpga_pci.c:1.12 src/sys/arch/evbarm/ifpga/ifpga_pci.c:1.13
--- src/sys/arch/evbarm/ifpga/ifpga_pci.c:1.12 Sun Dec 11 12:17:09 2005
+++ src/sys/arch/evbarm/ifpga/ifpga_pci.c Tue Jul 21 16:04:16 2009
@@ -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 @@
#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 @@
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
Index: src/sys/arch/evbarm/ifpga/ifpga_pcivar.h
diff -u src/sys/arch/evbarm/ifpga/ifpga_pcivar.h:1.1 src/sys/arch/evbarm/ifpga/ifpga_pcivar.h:1.2
--- src/sys/arch/evbarm/ifpga/ifpga_pcivar.h:1.1 Sat Oct 27 16:19:09 2001
+++ src/sys/arch/evbarm/ifpga/ifpga_pcivar.h Tue Jul 21 16:04:16 2009
@@ -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;
Index: src/sys/arch/evbarm/ifpga/ifpgavar.h
diff -u src/sys/arch/evbarm/ifpga/ifpgavar.h:1.4 src/sys/arch/evbarm/ifpga/ifpgavar.h:1.5
--- src/sys/arch/evbarm/ifpga/ifpgavar.h:1.4 Sun Dec 11 12:17:09 2005
+++ src/sys/arch/evbarm/ifpga/ifpgavar.h Tue Jul 21 16:04:16 2009
@@ -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 */
Index: src/sys/arch/evbarm/ifpga/pl030_rtc.c
diff -u src/sys/arch/evbarm/ifpga/pl030_rtc.c:1.8 src/sys/arch/evbarm/ifpga/pl030_rtc.c:1.9
--- src/sys/arch/evbarm/ifpga/pl030_rtc.c:1.8 Mon Feb 19 02:08:12 2007
+++ src/sys/arch/evbarm/ifpga/pl030_rtc.c Tue Jul 21 16:04:16 2009
@@ -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 @@
#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 @@
}
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;
}