twe.c (102291) | twe.c (109623) |
---|---|
1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/twe/twe.c 102291 2002-08-22 21:24:01Z archie $ | 27 * $FreeBSD: head/sys/dev/twe/twe.c 109623 2003-01-21 08:56:16Z alfred $ |
28 */ 29 30/* 31 * Driver for the 3ware Escalade family of IDE RAID controllers. 32 */ 33 34#include <dev/twe/twe_compat.h> 35#include <dev/twe/twereg.h> --- 435 unchanged lines hidden (view full) --- 471 */ 472 srid = tr->tr_command.generic.request_id; 473 bcopy(&tu->tu_command, &tr->tr_command, sizeof(TWE_Command)); 474 tr->tr_command.generic.request_id = srid; 475 476 /* if there's a data buffer, allocate and copy it in */ 477 tr->tr_length = tu->tu_size; 478 if (tr->tr_length > 0) { | 28 */ 29 30/* 31 * Driver for the 3ware Escalade family of IDE RAID controllers. 32 */ 33 34#include <dev/twe/twe_compat.h> 35#include <dev/twe/twereg.h> --- 435 unchanged lines hidden (view full) --- 471 */ 472 srid = tr->tr_command.generic.request_id; 473 bcopy(&tu->tu_command, &tr->tr_command, sizeof(TWE_Command)); 474 tr->tr_command.generic.request_id = srid; 475 476 /* if there's a data buffer, allocate and copy it in */ 477 tr->tr_length = tu->tu_size; 478 if (tr->tr_length > 0) { |
479 if ((tr->tr_data = malloc(tr->tr_length, M_DEVBUF, M_WAITOK)) == NULL) { | 479 if ((tr->tr_data = malloc(tr->tr_length, M_DEVBUF, 0)) == NULL) { |
480 error = ENOMEM; 481 goto cmd_done; 482 } 483 if ((error = copyin(tu->tu_data, tr->tr_data, tr->tr_length)) != 0) 484 goto cmd_done; 485 tr->tr_flags |= TWE_CMD_DATAIN | TWE_CMD_DATAOUT; 486 } 487 --- 66 unchanged lines hidden (view full) --- 554 } else { 555 error = copyout(param->data, tp->tp_data, param->parameter_size_bytes); 556 } 557 free(param, M_DEVBUF); 558 } 559 break; 560 561 case TWEIO_SET_PARAM: | 480 error = ENOMEM; 481 goto cmd_done; 482 } 483 if ((error = copyin(tu->tu_data, tr->tr_data, tr->tr_length)) != 0) 484 goto cmd_done; 485 tr->tr_flags |= TWE_CMD_DATAIN | TWE_CMD_DATAOUT; 486 } 487 --- 66 unchanged lines hidden (view full) --- 554 } else { 555 error = copyout(param->data, tp->tp_data, param->parameter_size_bytes); 556 } 557 free(param, M_DEVBUF); 558 } 559 break; 560 561 case TWEIO_SET_PARAM: |
562 if ((data = malloc(tp->tp_size, M_DEVBUF, M_WAITOK)) == NULL) { | 562 if ((data = malloc(tp->tp_size, M_DEVBUF, 0)) == NULL) { |
563 error = ENOMEM; 564 } else { 565 error = copyin(tp->tp_data, data, tp->tp_size); 566 if (error == 0) 567 error = twe_set_param(sc, tp->tp_table_id, tp->tp_param_id, tp->tp_size, data); 568 free(data, M_DEVBUF); 569 } 570 break; --- 1238 unchanged lines hidden --- | 563 error = ENOMEM; 564 } else { 565 error = copyin(tp->tp_data, data, tp->tp_size); 566 if (error == 0) 567 error = twe_set_param(sc, tp->tp_table_id, tp->tp_param_id, tp->tp_size, data); 568 free(data, M_DEVBUF); 569 } 570 break; --- 1238 unchanged lines hidden --- |