View | Details | Raw Unified | Return to bug 20891
Collapse All | Expand All

(-)ds1.c 2000/08/21 12:24:30 (-4 / +37 lines)
Lines 114-119 Link Here
114
       int             regid, irqid;
114
       int             regid, irqid;
115
       void            *ih;
115
       void            *ih;
116
116
117
        void *buf;
118
117
       u_int32_t *pbase, pbankbase, pbanksize;
119
       u_int32_t *pbase, pbankbase, pbanksize;
118
       volatile struct pbank *pbank[2 * 64];
120
       volatile struct pbank *pbank[2 * 64];
119
       volatile struct rbank *rbank;
121
       volatile struct rbank *rbank;
Lines 809-821 Link Here
809
       memsz = 64 * 2 * pcs + 2 * 2 * rcs + 5 * 2 * ecs + ws;
811
       memsz = 64 * 2 * pcs + 2 * 2 * rcs + 5 * 2 * ecs + ws;
810
       memsz += (64 + 1) * 4;
812
       memsz += (64 + 1) * 4;
811
813
812
       if (bus_dmamem_alloc(sc->parent_dmat, &buf, BUS_DMA_NOWAIT, &map))
814
       /* this is put in so suspend/resume works and init still works. */
815
       if(sc->buf == NULL)
816
       {
817
           if (bus_dmamem_alloc(sc->parent_dmat, &buf, BUS_DMA_NOWAIT, &map))
813
               return -1;
818
               return -1;
814
       if (bus_dmamap_load(sc->parent_dmat, map, buf, memsz, ds_setmap, sc, 0)
819
           if (bus_dmamap_load(sc->parent_dmat, map, buf, memsz, ds_setmap, sc,
815
           || !sc->ctrlbase) {
816
0)
820
0)
821
               || !sc->ctrlbase) {
817
               device_printf(sc->dev, "pcs=%d, rcs=%d, ecs=%d, ws=%d, memsz=%d\
822
               device_printf(sc->dev, "pcs=%d, rcs=%d, ecs=%d, ws=%d, memsz=%d\
818
                             pcs, rcs, ecs, ws, memsz);
823
                             pcs, rcs, ecs, ws, memsz);
819
               return -1;
824
               return -1;
825
           }
826
           sc->buf = buf;
827
       } else {
828
           buf = sc->buf;
820
       }
829
       }
821
830
822
       cb = 0;
831
       cb = 0;
Lines 971-981 Link Here
971
       return ENXIO;
980
       return ENXIO;
972
}
981
}
973
982
983
/* the idea for this code is stolen from neomagic.c */
984
985
static int 
986
ds_pci_resume(device_t dev)
987
{
988
       snddev_info *d; 
989
       struct sc_info *sc;
990
991
       d = device_get_softc(dev);
992
       sc = pcm_getdevinfo(dev);
993
994
995
       if(ds_init(sc) == -1)
996
       {
997
           device_printf(dev, "unable to reinitialize the card\n");
998
           return ENXIO;
999
       }           
1000
       if (mixer_reinit(d) == -1) {
1001
               device_printf(dev, "unable to reinitialize the mixer\n");
1002
               return ENXIO;
1003
       }
1004
       return 0;
1005
}
1006
974
static device_method_t ds1_methods[] = {
1007
static device_method_t ds1_methods[] = {
975
       /* Device interface */
1008
       /* Device interface */
976
       DEVMETHOD(device_probe,         ds_pci_probe),
1009
       DEVMETHOD(device_probe,         ds_pci_probe),
977
       DEVMETHOD(device_attach,        ds_pci_attach),
1010
       DEVMETHOD(device_attach,        ds_pci_attach),
978
1011
       DEVMETHOD(device_resume,        ds_pci_resume),
979
       { 0, 0 }
1012
       { 0, 0 }
980
};
1013
};

Return to bug 20891