scc_core.c (157299) | scc_core.c (157351) |
---|---|
1/*- 2 * Copyright (c) 2004-2006 Marcel Moolenaar 3 * 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 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004-2006 Marcel Moolenaar 3 * 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 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/scc/scc_core.c 157299 2006-03-30 18:33:22Z marcel $"); | 28__FBSDID("$FreeBSD: head/sys/dev/scc/scc_core.c 157351 2006-04-01 04:51:56Z marcel $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <sys/kernel.h> 35#include <sys/malloc.h> 36#include <sys/queue.h> --- 271 unchanged lines hidden (view full) --- 308 309 free(sc->sc_chan, M_SCC); 310 311 mtx_destroy(&sc->sc_hwmtx); 312 return (0); 313} 314 315int | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <sys/kernel.h> 35#include <sys/malloc.h> 36#include <sys/queue.h> --- 271 unchanged lines hidden (view full) --- 308 309 free(sc->sc_chan, M_SCC); 310 311 mtx_destroy(&sc->sc_hwmtx); 312 return (0); 313} 314 315int |
316scc_bfe_probe(device_t dev) | 316scc_bfe_probe(device_t dev, u_int regshft, u_int rclk) |
317{ 318 struct scc_softc *sc; 319 struct scc_class *cl; 320 u_long size; 321 int error; 322 323 /* 324 * Initialize the instance. Note that the instance (=softc) does --- 32 unchanged lines hidden (view full) --- 357 358 /* 359 * Fill in the bus access structure and call the hardware specific 360 * probe method. 361 */ 362 sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); 363 sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); 364 sc->sc_bas.range = size; | 317{ 318 struct scc_softc *sc; 319 struct scc_class *cl; 320 u_long size; 321 int error; 322 323 /* 324 * Initialize the instance. Note that the instance (=softc) does --- 32 unchanged lines hidden (view full) --- 357 358 /* 359 * Fill in the bus access structure and call the hardware specific 360 * probe method. 361 */ 362 sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); 363 sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); 364 sc->sc_bas.range = size; |
365 sc->sc_bas.rclk = sc->sc_class->cl_rclk; 366 sc->sc_bas.regshft = sc->sc_class->cl_regshft; | 365 sc->sc_bas.rclk = rclk; 366 sc->sc_bas.regshft = regshft; |
367 368 error = SCC_PROBE(sc); 369 bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); 370 return ((error == 0) ? BUS_PROBE_DEFAULT : error); 371} 372 373struct resource * 374scc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, --- 62 unchanged lines hidden (view full) --- 437 switch (index) { 438 case SCC_IVAR_CHANNEL: 439 *result = ch->ch_nr; 440 break; 441 case SCC_IVAR_CLASS: 442 *result = cl->cl_class; 443 break; 444 case SCC_IVAR_CLOCK: | 367 368 error = SCC_PROBE(sc); 369 bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); 370 return ((error == 0) ? BUS_PROBE_DEFAULT : error); 371} 372 373struct resource * 374scc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, --- 62 unchanged lines hidden (view full) --- 437 switch (index) { 438 case SCC_IVAR_CHANNEL: 439 *result = ch->ch_nr; 440 break; 441 case SCC_IVAR_CLASS: 442 *result = cl->cl_class; 443 break; 444 case SCC_IVAR_CLOCK: |
445 *result = cl->cl_rclk; | 445 *result = sc->sc_bas.rclk; |
446 break; 447 case SCC_IVAR_MODE: 448 *result = m->m_mode; 449 break; 450 case SCC_IVAR_REGSHFT: | 446 break; 447 case SCC_IVAR_MODE: 448 *result = m->m_mode; 449 break; 450 case SCC_IVAR_REGSHFT: |
451 *result = cl->cl_regshft; | 451 *result = sc->sc_bas.regshft; |
452 break; 453 case SCC_IVAR_HWMTX: 454 *result = (uintptr_t)&sc->sc_hwmtx; 455 break; 456 default: 457 return (EINVAL); 458 } 459 return (0); --- 83 unchanged lines hidden --- | 452 break; 453 case SCC_IVAR_HWMTX: 454 *result = (uintptr_t)&sc->sc_hwmtx; 455 break; 456 default: 457 return (EINVAL); 458 } 459 return (0); --- 83 unchanged lines hidden --- |