ips.c (114902) | ips.c (116852) |
---|---|
1/*- 2 * Copyright (c) 2002 Adaptec Inc. 3 * All rights reserved. 4 * 5 * Written by: David Jeffery 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 2002 Adaptec Inc. 3 * All rights reserved. 4 * 5 * Written by: David Jeffery 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/dev/ips/ips.c 114902 2003-05-11 06:36:49Z scottl $ | 28 * $FreeBSD: head/sys/dev/ips/ips.c 116852 2003-06-26 00:03:59Z scottl $ |
29 */ 30 31 32#include <dev/ips/ips.h> 33#include <sys/stat.h> 34#include <sys/time.h> 35#include <machine/clock.h> 36 --- 280 unchanged lines hidden (view full) --- 317 if (sc->state != IPS_OFFLINE) 318 sc->timer = timeout(ips_timeout, sc, 10*hz); 319 splx(mask); 320} 321 322/* check card and initialize it */ 323int ips_adapter_init(ips_softc_t *sc) 324{ | 29 */ 30 31 32#include <dev/ips/ips.h> 33#include <sys/stat.h> 34#include <sys/time.h> 35#include <machine/clock.h> 36 --- 280 unchanged lines hidden (view full) --- 317 if (sc->state != IPS_OFFLINE) 318 sc->timer = timeout(ips_timeout, sc, 10*hz); 319 splx(mask); 320} 321 322/* check card and initialize it */ 323int ips_adapter_init(ips_softc_t *sc) 324{ |
325 int i; |
|
325 DEVICE_PRINTF(1,sc->dev, "initializing\n"); 326 if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, 327 /* alignemnt */ 1, 328 /* boundary */ 0, 329 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, 330 /* highaddr */ BUS_SPACE_MAXADDR, 331 /* filter */ NULL, 332 /* filterarg */ NULL, --- 21 unchanged lines hidden (view full) --- 354 &sc->sg_dmatag) != 0) { 355 device_printf(sc->dev, "can't alloc SG dma tag\n"); 356 goto error; 357 } 358 /* create one command buffer until we know how many commands this card 359 can handle */ 360 sc->max_cmds = 1; 361 ips_cmdqueue_init(sc); | 326 DEVICE_PRINTF(1,sc->dev, "initializing\n"); 327 if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, 328 /* alignemnt */ 1, 329 /* boundary */ 0, 330 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, 331 /* highaddr */ BUS_SPACE_MAXADDR, 332 /* filter */ NULL, 333 /* filterarg */ NULL, --- 21 unchanged lines hidden (view full) --- 355 &sc->sg_dmatag) != 0) { 356 device_printf(sc->dev, "can't alloc SG dma tag\n"); 357 goto error; 358 } 359 /* create one command buffer until we know how many commands this card 360 can handle */ 361 sc->max_cmds = 1; 362 ips_cmdqueue_init(sc); |
363 callout_handle_init(&sc->timer); |
|
362 363 if(sc->ips_adapter_reinit(sc, 0)) 364 goto error; 365 366 mtx_init(&sc->cmd_mtx, "ips command mutex", NULL, MTX_DEF); | 364 365 if(sc->ips_adapter_reinit(sc, 0)) 366 goto error; 367 368 mtx_init(&sc->cmd_mtx, "ips command mutex", NULL, MTX_DEF); |
367 if(ips_get_adapter_info(sc) || ips_get_drive_info(sc)){ 368 device_printf(sc->dev, "failed to get configuration data from device\n"); | 369 if ((i = ips_get_adapter_info(sc)) != 0) { 370 device_printf(sc->dev, "failed to get adapter configuration data from device (%d)\n", i); |
369 goto error; 370 } | 371 goto error; 372 } |
373 if ((i = ips_get_drive_info(sc)) != 0) { 374 device_printf(sc->dev, "failed to get drive configuration data from device (%d)\n", i); 375 goto error; 376 } |
|
371 ips_update_nvram(sc); /* no error check as failure doesn't matter */ 372 373 ips_cmdqueue_free(sc); 374 if(sc->adapter_info.max_concurrent_cmds) 375 sc->max_cmds = min(128, sc->adapter_info.max_concurrent_cmds); 376 else 377 sc->max_cmds = 32; 378 if(ips_cmdqueue_init(sc)){ --- 319 unchanged lines hidden --- | 377 ips_update_nvram(sc); /* no error check as failure doesn't matter */ 378 379 ips_cmdqueue_free(sc); 380 if(sc->adapter_info.max_concurrent_cmds) 381 sc->max_cmds = min(128, sc->adapter_info.max_concurrent_cmds); 382 else 383 sc->max_cmds = 32; 384 if(ips_cmdqueue_init(sc)){ --- 319 unchanged lines hidden --- |