dcons_crom.c (185108) | dcons_crom.c (186876) |
---|---|
1/*- 2 * Copyright (C) 2003 3 * Hidetoshi Shimokawa. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * $Id: dcons_crom.c,v 1.8 2003/10/23 15:47:21 simokawa Exp $ | 1/*- 2 * Copyright (C) 2003 3 * Hidetoshi Shimokawa. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * $Id: dcons_crom.c,v 1.8 2003/10/23 15:47:21 simokawa Exp $ |
35 * $FreeBSD: head/sys/dev/dcons/dcons_crom.c 185108 2008-11-19 22:09:03Z marius $ | 35 * $FreeBSD: head/sys/dev/dcons/dcons_crom.c 186876 2009-01-07 21:25:44Z marius $ |
36 */ 37 38#include <sys/param.h> 39#include <sys/kernel.h> 40#include <sys/module.h> 41#include <sys/systm.h> 42#include <sys/types.h> 43#include <sys/conf.h> --- 156 unchanged lines hidden (view full) --- 200static int 201dcons_crom_attach(device_t dev) 202{ 203#ifdef NEED_NEW_DRIVER 204 printf("dcons_crom: you need newer firewire driver\n"); 205 return (-1); 206#else 207 struct dcons_crom_softc *sc; | 36 */ 37 38#include <sys/param.h> 39#include <sys/kernel.h> 40#include <sys/module.h> 41#include <sys/systm.h> 42#include <sys/types.h> 43#include <sys/conf.h> --- 156 unchanged lines hidden (view full) --- 200static int 201dcons_crom_attach(device_t dev) 202{ 203#ifdef NEED_NEW_DRIVER 204 printf("dcons_crom: you need newer firewire driver\n"); 205 return (-1); 206#else 207 struct dcons_crom_softc *sc; |
208 int error; |
|
208 | 209 |
210 if (dcons_conf->buf == NULL) 211 return (ENXIO); |
|
209 sc = (struct dcons_crom_softc *) device_get_softc(dev); 210 sc->fd.fc = device_get_ivars(dev); 211 sc->fd.dev = dev; 212 sc->fd.post_explore = NULL; 213 sc->fd.post_busreset = (void *) dcons_crom_post_busreset; 214 215 /* map dcons buffer */ | 212 sc = (struct dcons_crom_softc *) device_get_softc(dev); 213 sc->fd.fc = device_get_ivars(dev); 214 sc->fd.dev = dev; 215 sc->fd.post_explore = NULL; 216 sc->fd.post_busreset = (void *) dcons_crom_post_busreset; 217 218 /* map dcons buffer */ |
216 bus_dma_tag_create( | 219 error = bus_dma_tag_create( |
217 /*parent*/ sc->fd.fc->dmat, 218 /*alignment*/ sizeof(u_int32_t), 219 /*boundary*/ 0, 220 /*lowaddr*/ BUS_SPACE_MAXADDR, 221 /*highaddr*/ BUS_SPACE_MAXADDR, 222 /*filter*/NULL, /*filterarg*/NULL, 223 /*maxsize*/ dcons_conf->size, 224 /*nsegments*/ 1, 225 /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT, 226 /*flags*/ BUS_DMA_ALLOCNOW, 227#if __FreeBSD_version >= 501102 228 /*lockfunc*/busdma_lock_mutex, 229 /*lockarg*/&Giant, 230#endif 231 &sc->dma_tag); | 220 /*parent*/ sc->fd.fc->dmat, 221 /*alignment*/ sizeof(u_int32_t), 222 /*boundary*/ 0, 223 /*lowaddr*/ BUS_SPACE_MAXADDR, 224 /*highaddr*/ BUS_SPACE_MAXADDR, 225 /*filter*/NULL, /*filterarg*/NULL, 226 /*maxsize*/ dcons_conf->size, 227 /*nsegments*/ 1, 228 /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT, 229 /*flags*/ BUS_DMA_ALLOCNOW, 230#if __FreeBSD_version >= 501102 231 /*lockfunc*/busdma_lock_mutex, 232 /*lockarg*/&Giant, 233#endif 234 &sc->dma_tag); |
232 bus_dmamap_create(sc->dma_tag, BUS_DMA_COHERENT, &sc->dma_map); 233 bus_dmamap_load(sc->dma_tag, sc->dma_map, | 235 if (error != 0) 236 return (error); 237 error = bus_dmamap_create(sc->dma_tag, BUS_DMA_COHERENT, &sc->dma_map); 238 if (error != 0) 239 return (error); 240 error = bus_dmamap_load(sc->dma_tag, sc->dma_map, |
234 (void *)dcons_conf->buf, dcons_conf->size, 235 dmamap_cb, sc, 0); | 241 (void *)dcons_conf->buf, dcons_conf->size, 242 dmamap_cb, sc, 0); |
243 if (error != 0) 244 return (error); |
|
236 sc->ehand = EVENTHANDLER_REGISTER(dcons_poll, dcons_crom_poll, 237 (void *)sc, 0); 238 return (0); 239#endif 240} 241 242static int 243dcons_crom_detach(device_t dev) --- 43 unchanged lines hidden --- | 245 sc->ehand = EVENTHANDLER_REGISTER(dcons_poll, dcons_crom_poll, 246 (void *)sc, 0); 247 return (0); 248#endif 249} 250 251static int 252dcons_crom_detach(device_t dev) --- 43 unchanged lines hidden --- |