amr.c (140687) | amr.c (140688) |
---|---|
1/*- 2 * Copyright (c) 1999,2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * Copyright (c) 2005 Scott Long 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 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/*- 29 * Copyright (c) 2002 Eric Moore | 1/*- 2 * Copyright (c) 1999,2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * Copyright (c) 2005 Scott Long 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 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/*- 29 * Copyright (c) 2002 Eric Moore |
30 * Copyright (c) 2002 LSI Logic Corporation | 30 * Copyright (c) 2002, 2004 LSI Logic Corporation |
31 * All rights reserved. 32 * 33 * Redistribution and use in source and binary forms, with or without 34 * modification, are permitted provided that the following conditions 35 * are met: 36 * 1. Redistributions of source code must retain the above copyright 37 * notice, this list of conditions and the following disclaimer. 38 * 2. Redistributions in binary form must reproduce the above copyright --- 12 unchanged lines hidden (view full) --- 51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55 * SUCH DAMAGE. 56 */ 57 58#include <sys/cdefs.h> | 31 * All rights reserved. 32 * 33 * Redistribution and use in source and binary forms, with or without 34 * modification, are permitted provided that the following conditions 35 * are met: 36 * 1. Redistributions of source code must retain the above copyright 37 * notice, this list of conditions and the following disclaimer. 38 * 2. Redistributions in binary form must reproduce the above copyright --- 12 unchanged lines hidden (view full) --- 51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55 * SUCH DAMAGE. 56 */ 57 58#include <sys/cdefs.h> |
59__FBSDID("$FreeBSD: head/sys/dev/amr/amr.c 140687 2005-01-23 23:22:34Z scottl $"); | 59__FBSDID("$FreeBSD: head/sys/dev/amr/amr.c 140688 2005-01-23 23:25:41Z scottl $"); |
60 61/* 62 * Driver for the AMI MegaRaid family of controllers. 63 */ 64 65#include <sys/param.h> 66#include <sys/systm.h> 67#include <sys/malloc.h> --- 390 unchanged lines hidden (view full) --- 458 debug(1, "unknown ioctl 0x%lx", cmd); 459 return(ENOIOCTL); 460 } 461 462 error = 0; 463 dp = NULL; 464 ac = NULL; 465 | 60 61/* 62 * Driver for the AMI MegaRaid family of controllers. 63 */ 64 65#include <sys/param.h> 66#include <sys/systm.h> 67#include <sys/malloc.h> --- 390 unchanged lines hidden (view full) --- 458 debug(1, "unknown ioctl 0x%lx", cmd); 459 return(ENOIOCTL); 460 } 461 462 error = 0; 463 dp = NULL; 464 ac = NULL; 465 |
466 /* Logical Drive not supported by the driver */ 467 if (au_cmd[0] == 0xa4 && au_cmd[1] == 0x1c) 468 return (ENOIOCTL); 469 |
|
466 /* handle inbound data buffer */ | 470 /* handle inbound data buffer */ |
467 if (au_length != 0) { | 471 if (au_length != 0 && au_cmd[0] != 0x06) { |
468 if ((dp = malloc(au_length, M_DEVBUF, M_WAITOK)) == NULL) 469 return(ENOMEM); 470 471 if ((error = copyin(au_buffer, dp, au_length)) != 0) { 472 free(dp, M_DEVBUF); 473 return (error); 474 } 475 debug(2, "copyin %ld bytes from %p -> %p", au_length, au_buffer, dp); --- 568 unchanged lines hidden (view full) --- 1044 return (error); 1045} 1046 1047static int 1048amr_quartz_poll_command1(struct amr_softc *sc, struct amr_command *ac) 1049{ 1050 int count, error; 1051 | 472 if ((dp = malloc(au_length, M_DEVBUF, M_WAITOK)) == NULL) 473 return(ENOMEM); 474 475 if ((error = copyin(au_buffer, dp, au_length)) != 0) { 476 free(dp, M_DEVBUF); 477 return (error); 478 } 479 debug(2, "copyin %ld bytes from %p -> %p", au_length, au_buffer, dp); --- 568 unchanged lines hidden (view full) --- 1048 return (error); 1049} 1050 1051static int 1052amr_quartz_poll_command1(struct amr_softc *sc, struct amr_command *ac) 1053{ 1054 int count, error; 1055 |
1052 if ((sc->amr_state & AMR_STATE_CRASHDUMP) == 0) { | 1056 if ((sc->amr_state & AMR_STATE_INTEN) == 0) { |
1053 count=0; 1054 while (sc->amr_busyslots) { 1055 msleep(sc, &sc->amr_io_lock, PRIBIO | PCATCH, "amrpoll", hz); 1056 if(count++>10) { 1057 break; 1058 } 1059 } 1060 --- 858 unchanged lines hidden (view full) --- 1919int 1920amr_dump_blocks(struct amr_softc *sc, int unit, u_int32_t lba, void *data, int blks) 1921{ 1922 struct amr_command *ac; 1923 int error = EIO; 1924 1925 debug_called(1); 1926 | 1057 count=0; 1058 while (sc->amr_busyslots) { 1059 msleep(sc, &sc->amr_io_lock, PRIBIO | PCATCH, "amrpoll", hz); 1060 if(count++>10) { 1061 break; 1062 } 1063 } 1064 --- 858 unchanged lines hidden (view full) --- 1923int 1924amr_dump_blocks(struct amr_softc *sc, int unit, u_int32_t lba, void *data, int blks) 1925{ 1926 struct amr_command *ac; 1927 int error = EIO; 1928 1929 debug_called(1); 1930 |
1927 sc->amr_state |= AMR_STATE_CRASHDUMP; | 1931 sc->amr_state |= AMR_STATE_INTEN; |
1928 1929 /* get ourselves a command buffer */ 1930 if ((ac = amr_alloccmd(sc)) == NULL) 1931 goto out; 1932 /* set command flags */ 1933 ac->ac_flags |= AMR_CMD_PRIORITY | AMR_CMD_DATAOUT; 1934 1935 /* point the command at our data */ --- 10 unchanged lines hidden (view full) --- 1946 if (sc->amr_poll_command(ac)) 1947 goto out; 1948 error = ac->ac_status; 1949 1950 out: 1951 if (ac != NULL) 1952 amr_releasecmd(ac); 1953 | 1932 1933 /* get ourselves a command buffer */ 1934 if ((ac = amr_alloccmd(sc)) == NULL) 1935 goto out; 1936 /* set command flags */ 1937 ac->ac_flags |= AMR_CMD_PRIORITY | AMR_CMD_DATAOUT; 1938 1939 /* point the command at our data */ --- 10 unchanged lines hidden (view full) --- 1950 if (sc->amr_poll_command(ac)) 1951 goto out; 1952 error = ac->ac_status; 1953 1954 out: 1955 if (ac != NULL) 1956 amr_releasecmd(ac); 1957 |
1954 sc->amr_state &= ~AMR_STATE_CRASHDUMP; | 1958 sc->amr_state &= ~AMR_STATE_INTEN; |
1955 return (error); 1956} 1957 1958 1959 1960#ifdef AMR_DEBUG 1961/******************************************************************************** 1962 * Print the command (ac) in human-readable format --- 25 unchanged lines hidden --- | 1959 return (error); 1960} 1961 1962 1963 1964#ifdef AMR_DEBUG 1965/******************************************************************************** 1966 * Print the command (ac) in human-readable format --- 25 unchanged lines hidden --- |