Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Build failure for evbarm ifpga_intr.h



On Mon, Apr 27, 2009 at 11:33:06PM +0200, Thomas Klausner wrote:
> making a release for evbarm fails with:
> 
> #    create  INTEGRATOR/assym.h
> cat /archive/cvs/src/sys/arch/arm/arm32/genassym.cf  |  
> /archive/build/tools/bin
> /nbgenassym -- /archive/build/tools/bin/arm--netbsdelf-gcc  -ffreestanding 
> -fno-
> zero-initialized-in-bss  -O2 -std=gnu99 -fno-strict-aliasing   -Werror -Wall 
> -Wn
> o-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes 
> -Wstrict-pro
> totypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code 
> -Wno
> -sign-compare -Wno-pointer-sign -Wno-attributes  -Werror -march=armv4  -I.  
> -I/a
> rchive/cvs/src/sys/../common/include -I/archive/cvs/src/sys/arch  
> -I/archive/cvs
> /src/sys -nostdinc -DPCI_CONFIGURE_VERBOSE -DPLCONSOLE -DPLCOMCNUNIT="0" 
> -DPLCON
> SPEED="38400" -DPLCONMODE="0xb00" -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT 
> -I/archi
> ve/cvs/src/sys/lib/libkern/../../../common/lib/libc/quad 
> -I/archive/cvs/src/sys/
> lib/libkern/../../../common/lib/libc/string 
> -I/archive/cvs/src/sys/lib/libkern/.
> ./../../common/lib/libc/arch/arm/string     > assym.h.tmp &&  mv -f 
> assym.h.tmp
> assym.h
> In file included from /archive/cvs/src/sys/arch/evbarm/ifpga/ifpga_intr.h:50,
>                  from ./machine/intr.h:151,
>                  from /archive/cvs/src/sys/sys/intr.h:35,
>                  from /archive/cvs/src/sys/sys/mutex.h:177,
>                  from /archive/cvs/src/sys/sys/device.h:85,
>                  from ./arm/cpu.h:233,
>                  from ./machine/cpu.h:3,
>                  from ./arm/arm32/param.h:39,
>                  from ./machine/param.h:45,
>                  from /archive/cvs/src/sys/sys/param.h:164,
>                  from /tmp/genassym.20215/assym.c:2:
> /archive/cvs/src/sys/arch/evbarm/ifpga/ifpgavar.h:48: error: field 'sc_dev' 
> has
> incomplete type
> 
> 
> Any ideas?

The attached patch will fix that, but it does not fix the underlying
circular dependencies.

IIUC, Izumi Tsutsui suggests fixing the circular dependency by
relocating the definition of ipl_cookie_t from <machine/intr.h> to
(just for example) <machine/types.h> and eliminating the #include
<machine/intr.h> from <sys/mutex.h>.  Sounds ok to me.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933
Index: sys/arch/evbarm/ifpga/ifpga.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/ifpga/ifpga.c,v
retrieving revision 1.22
diff -p -u -u -p -r1.22 ifpga.c
--- sys/arch/evbarm/ifpga/ifpga.c       27 Apr 2008 18:58:46 -0000      1.22
+++ sys/arch/evbarm/ifpga/ifpga.c       13 Apr 2009 23:43:55 -0000
@@ -66,12 +66,12 @@ __KERNEL_RCSID(0, "$NetBSD: ifpga.c,v 1.
 #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_ta
 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, stru
 }
 
 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, struc
 }
 
 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, stru
 
        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, stru
                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, stru
        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, stru
            &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, stru
                    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: sys/arch/evbarm/ifpga/ifpga_clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/ifpga/ifpga_clock.c,v
retrieving revision 1.13
diff -p -u -u -p -r1.13 ifpga_clock.c
--- sys/arch/evbarm/ifpga/ifpga_clock.c 18 Mar 2009 10:22:27 -0000      1.13
+++ sys/arch/evbarm/ifpga/ifpga_clock.c 13 Apr 2009 23:43:55 -0000
@@ -99,6 +99,7 @@ static struct timecounter ifpga_timecoun
 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);
Index: sys/arch/evbarm/ifpga/ifpga_pci.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/ifpga/ifpga_pci.c,v
retrieving revision 1.12
diff -p -u -u -p -r1.12 ifpga_pci.c
--- sys/arch/evbarm/ifpga/ifpga_pci.c   11 Dec 2005 12:17:09 -0000      1.12
+++ sys/arch/evbarm/ifpga/ifpga_pci.c   13 Apr 2009 23:43:55 -0000
@@ -85,7 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ifpga_pci.c,
 #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
Index: sys/arch/evbarm/ifpga/ifpga_pcivar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/ifpga/ifpga_pcivar.h,v
retrieving revision 1.1
diff -p -u -u -p -r1.1 ifpga_pcivar.h
--- sys/arch/evbarm/ifpga/ifpga_pcivar.h        27 Oct 2001 16:19:09 -0000      
1.1
+++ sys/arch/evbarm/ifpga/ifpga_pcivar.h        13 Apr 2009 23:43:55 -0000
@@ -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: sys/arch/evbarm/ifpga/ifpgavar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/ifpga/ifpgavar.h,v
retrieving revision 1.4
diff -p -u -u -p -r1.4 ifpgavar.h
--- sys/arch/evbarm/ifpga/ifpgavar.h    11 Dec 2005 12:17:09 -0000      1.4
+++ sys/arch/evbarm/ifpga/ifpgavar.h    13 Apr 2009 23:43:55 -0000
@@ -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: sys/arch/evbarm/ifpga/pl030_rtc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/ifpga/pl030_rtc.c,v
retrieving revision 1.8
diff -p -u -u -p -r1.8 pl030_rtc.c
--- sys/arch/evbarm/ifpga/pl030_rtc.c   19 Feb 2007 02:08:12 -0000      1.8
+++ sys/arch/evbarm/ifpga/pl030_rtc.c   13 Apr 2009 23:43:55 -0000
@@ -52,16 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: pl030_rtc.c,
 #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, v
 }
 
 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;
        }
 


Home | Main Index | Thread Index | Old Index