Subject: None
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 04/08/2001 10:37:53
Hi!

The following crashes my machine in bus_dmamem_alloc(). Anyone has an
idea why?

bus_dma_segment_t *cmem_segs;
bus_dma_tag_t cmem_dma_tag;

struct pci_softc {
        struct device sc_dev;
        bus_space_tag_t sc_iot, sc_memt;
        bus_dma_tag_t sc_dmat;
        pci_chipset_tag_t sc_pc;
        int sc_bus, sc_maxndevs;
        u_int sc_intrswiz;
        pcitag_t sc_intrtag;
        int sc_flags;
}; 

extern struct cfdriver pci_cd;

int cmem_init (void) {
        int res, rsegs;
        struct pci_softc **psc;
        
        for (psc = (struct pci_softc **)pci_cd.cd_devs; *psc; psc++) {
                printf ("device: %s\n", psc->sc_dev->dv_xname);
        };

       cmem_dma_tag = softc->sc_dmat;

       res = bus_dmamem_alloc (cmem_dma_tag, CMEM_ALLOC_SIZE, 0, 0, 
            cmem_segs, 1, &rsegs, BUS_DMA_NOWAIT);
        if (res != 0)
                return res;

        printf ("res=%d\n", res);
        printf ("rsegs=%d\n", rsegs);

        return 0;
}

-- 
Emmanuel Dreyfus.
Sryvpvgngvbaf!
Ibhf irarm qr creqer ibger grzcf n qrpbqre har fvtangher fnaf vagrerg.
p99dreyf@criens.u-psud.fr