ips_commands.c (114902) | ips_commands.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_commands.c 114902 2003-05-11 06:36:49Z scottl $ | 28 * $FreeBSD: head/sys/dev/ips/ips_commands.c 116852 2003-06-26 00:03:59Z scottl $ |
29 */ 30 31 32#include <dev/ips/ips.h> 33 34/* 35 * This is an interrupt callback. It is called from 36 * interrupt context when the adapter has completed the --- 224 unchanged lines hidden (view full) --- 261 ips_insert_free_cmd(sc, command); 262 return error; 263} 264 265int ips_get_adapter_info(ips_softc_t *sc) 266{ 267 int error = 0; 268 ips_cmd_status_t *status; | 29 */ 30 31 32#include <dev/ips/ips.h> 33 34/* 35 * This is an interrupt callback. It is called from 36 * interrupt context when the adapter has completed the --- 224 unchanged lines hidden (view full) --- 261 ips_insert_free_cmd(sc, command); 262 return error; 263} 264 265int ips_get_adapter_info(ips_softc_t *sc) 266{ 267 int error = 0; 268 ips_cmd_status_t *status; |
269 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); | 269 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); |
270 if(!status) 271 return ENOMEM; 272 if(ips_get_free_cmd(sc, ips_send_adapter_info_cmd, status, 273 IPS_NOWAIT_FLAG) > 0){ 274 device_printf(sc->dev, "unable to get adapter configuration\n"); 275 free(status, M_DEVBUF); 276 return ENXIO; 277 } | 270 if(!status) 271 return ENOMEM; 272 if(ips_get_free_cmd(sc, ips_send_adapter_info_cmd, status, 273 IPS_NOWAIT_FLAG) > 0){ 274 device_printf(sc->dev, "unable to get adapter configuration\n"); 275 free(status, M_DEVBUF); 276 return ENXIO; 277 } |
278 if(COMMAND_ERROR(status)){ | 278 if (COMMAND_ERROR(status)){ |
279 error = ENXIO; 280 } 281 free(status, M_DEVBUF); 282 return error; 283} 284 285/* Below are a series of functions for sending a drive info request 286 * to the adapter. The flow order is: get, send, callback. It uses --- 80 unchanged lines hidden (view full) --- 367 ips_insert_free_cmd(sc, command); 368 return error; 369 370} 371int ips_get_drive_info(ips_softc_t *sc) 372{ 373 int error = 0; 374 ips_cmd_status_t *status; | 279 error = ENXIO; 280 } 281 free(status, M_DEVBUF); 282 return error; 283} 284 285/* Below are a series of functions for sending a drive info request 286 * to the adapter. The flow order is: get, send, callback. It uses --- 80 unchanged lines hidden (view full) --- 367 ips_insert_free_cmd(sc, command); 368 return error; 369 370} 371int ips_get_drive_info(ips_softc_t *sc) 372{ 373 int error = 0; 374 ips_cmd_status_t *status; |
375 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); | 375 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); |
376 if(!status) 377 return ENOMEM; 378 if(ips_get_free_cmd(sc, ips_send_drive_info_cmd, status, 379 IPS_NOWAIT_FLAG) > 0){ 380 free(status, M_DEVBUF); 381 device_printf(sc->dev, "unable to get drive configuration\n"); 382 return ENXIO; 383 } --- 26 unchanged lines hidden (view full) --- 410 mtx_unlock(&sc->cmd_mtx); 411 ips_insert_free_cmd(sc, command); 412 return 0; 413} 414 415int ips_flush_cache(ips_softc_t *sc) 416{ 417 ips_cmd_status_t *status; | 376 if(!status) 377 return ENOMEM; 378 if(ips_get_free_cmd(sc, ips_send_drive_info_cmd, status, 379 IPS_NOWAIT_FLAG) > 0){ 380 free(status, M_DEVBUF); 381 device_printf(sc->dev, "unable to get drive configuration\n"); 382 return ENXIO; 383 } --- 26 unchanged lines hidden (view full) --- 410 mtx_unlock(&sc->cmd_mtx); 411 ips_insert_free_cmd(sc, command); 412 return 0; 413} 414 415int ips_flush_cache(ips_softc_t *sc) 416{ 417 ips_cmd_status_t *status; |
418 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); | 418 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); |
419 if(!status) 420 return ENOMEM; 421 device_printf(sc->dev, "flushing cache\n"); 422 if(ips_get_free_cmd(sc, ips_send_flush_cache_cmd, status, 423 IPS_NOWAIT_FLAG)){ 424 free(status, M_DEVBUF); 425 device_printf(sc->dev, "ERROR: unable to get a command! can't flush cache!\n"); 426 } --- 102 unchanged lines hidden (view full) --- 529 bus_dma_tag_destroy(command->data_dmatag); 530 ips_insert_free_cmd(sc, command); 531 return error; 532} 533 534int ips_update_nvram(ips_softc_t *sc) 535{ 536 ips_cmd_status_t *status; | 419 if(!status) 420 return ENOMEM; 421 device_printf(sc->dev, "flushing cache\n"); 422 if(ips_get_free_cmd(sc, ips_send_flush_cache_cmd, status, 423 IPS_NOWAIT_FLAG)){ 424 free(status, M_DEVBUF); 425 device_printf(sc->dev, "ERROR: unable to get a command! can't flush cache!\n"); 426 } --- 102 unchanged lines hidden (view full) --- 529 bus_dma_tag_destroy(command->data_dmatag); 530 ips_insert_free_cmd(sc, command); 531 return error; 532} 533 534int ips_update_nvram(ips_softc_t *sc) 535{ 536 ips_cmd_status_t *status; |
537 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); | 537 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); |
538 if(!status) 539 return ENOMEM; 540 if(ips_get_free_cmd(sc, ips_read_nvram, status, IPS_NOWAIT_FLAG)){ 541 free(status, M_DEVBUF); 542 device_printf(sc->dev, "ERROR: unable to get a command! can't update nvram\n"); 543 return 1; 544 } 545 if(COMMAND_ERROR(status)){ --- 51 unchanged lines hidden (view full) --- 597 ips_insert_free_cmd(sc, command); 598 return 0; 599} 600 601 602int ips_clear_adapter(ips_softc_t *sc) 603{ 604 ips_cmd_status_t *status; | 538 if(!status) 539 return ENOMEM; 540 if(ips_get_free_cmd(sc, ips_read_nvram, status, IPS_NOWAIT_FLAG)){ 541 free(status, M_DEVBUF); 542 device_printf(sc->dev, "ERROR: unable to get a command! can't update nvram\n"); 543 return 1; 544 } 545 if(COMMAND_ERROR(status)){ --- 51 unchanged lines hidden (view full) --- 597 ips_insert_free_cmd(sc, command); 598 return 0; 599} 600 601 602int ips_clear_adapter(ips_softc_t *sc) 603{ 604 ips_cmd_status_t *status; |
605 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); | 605 status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); |
606 if(!status) 607 return ENOMEM; 608 device_printf(sc->dev, "syncing config\n"); 609 if(ips_get_free_cmd(sc, ips_send_config_sync_cmd, status, 610 IPS_NOWAIT_FLAG)){ 611 free(status, M_DEVBUF); 612 device_printf(sc->dev, "ERROR: unable to get a command! can't sync cache!\n"); 613 return 1; --- 23 unchanged lines hidden --- | 606 if(!status) 607 return ENOMEM; 608 device_printf(sc->dev, "syncing config\n"); 609 if(ips_get_free_cmd(sc, ips_send_config_sync_cmd, status, 610 IPS_NOWAIT_FLAG)){ 611 free(status, M_DEVBUF); 612 device_printf(sc->dev, "ERROR: unable to get a command! can't sync cache!\n"); 613 return 1; --- 23 unchanged lines hidden --- |