aac.c (151893) | aac.c (152388) |
---|---|
1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2001 Scott Long 4 * Copyright (c) 2000 BSDi 5 * Copyright (c) 2001 Adaptec, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2001 Scott Long 4 * Copyright (c) 2000 BSDi 5 * Copyright (c) 2001 Adaptec, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac.c 151893 2005-10-31 00:12:19Z csjp $"); | 31__FBSDID("$FreeBSD: head/sys/dev/aac/aac.c 152388 2005-11-13 17:26:36Z schweikh $"); |
32 33/* 34 * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters. 35 */ 36#define AAC_DRIVER_VERSION 0x02000000 | 32 33/* 34 * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters. 35 */ 36#define AAC_DRIVER_VERSION 0x02000000 |
37#define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__ | |
38#define AAC_DRIVERNAME "aac" 39 40#include "opt_aac.h" 41 42/* #include <stddef.h> */ 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/malloc.h> --- 98 unchanged lines hidden (view full) --- 144 aac_sa_get_istatus, 145 aac_sa_clear_istatus, 146 aac_sa_set_mailbox, 147 aac_sa_get_mailbox, 148 aac_sa_set_interrupts, 149 NULL, NULL, NULL 150}; 151 | 37#define AAC_DRIVERNAME "aac" 38 39#include "opt_aac.h" 40 41/* #include <stddef.h> */ 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/malloc.h> --- 98 unchanged lines hidden (view full) --- 143 aac_sa_get_istatus, 144 aac_sa_clear_istatus, 145 aac_sa_set_mailbox, 146 aac_sa_get_mailbox, 147 aac_sa_set_interrupts, 148 NULL, NULL, NULL 149}; 150 |
152/* i960Rx interface */ | 151/* i960Rx interface */ |
153static int aac_rx_get_fwstatus(struct aac_softc *sc); 154static void aac_rx_qnotify(struct aac_softc *sc, int qbit); 155static int aac_rx_get_istatus(struct aac_softc *sc); 156static void aac_rx_clear_istatus(struct aac_softc *sc, int mask); 157static void aac_rx_set_mailbox(struct aac_softc *sc, u_int32_t command, 158 u_int32_t arg0, u_int32_t arg1, 159 u_int32_t arg2, u_int32_t arg3); 160static int aac_rx_get_mailbox(struct aac_softc *sc, int mb); --- 10 unchanged lines hidden (view full) --- 171 aac_rx_set_mailbox, 172 aac_rx_get_mailbox, 173 aac_rx_set_interrupts, 174 aac_rx_send_command, 175 aac_rx_get_outb_queue, 176 aac_rx_set_outb_queue 177}; 178 | 152static int aac_rx_get_fwstatus(struct aac_softc *sc); 153static void aac_rx_qnotify(struct aac_softc *sc, int qbit); 154static int aac_rx_get_istatus(struct aac_softc *sc); 155static void aac_rx_clear_istatus(struct aac_softc *sc, int mask); 156static void aac_rx_set_mailbox(struct aac_softc *sc, u_int32_t command, 157 u_int32_t arg0, u_int32_t arg1, 158 u_int32_t arg2, u_int32_t arg3); 159static int aac_rx_get_mailbox(struct aac_softc *sc, int mb); --- 10 unchanged lines hidden (view full) --- 170 aac_rx_set_mailbox, 171 aac_rx_get_mailbox, 172 aac_rx_set_interrupts, 173 aac_rx_send_command, 174 aac_rx_get_outb_queue, 175 aac_rx_set_outb_queue 176}; 177 |
179/* Rocket/MIPS interface */ | 178/* Rocket/MIPS interface */ |
180static int aac_rkt_get_fwstatus(struct aac_softc *sc); 181static void aac_rkt_qnotify(struct aac_softc *sc, int qbit); 182static int aac_rkt_get_istatus(struct aac_softc *sc); 183static void aac_rkt_clear_istatus(struct aac_softc *sc, int mask); 184static void aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, 185 u_int32_t arg0, u_int32_t arg1, 186 u_int32_t arg2, u_int32_t arg3); 187static int aac_rkt_get_mailbox(struct aac_softc *sc, int mb); --- 99 unchanged lines hidden (view full) --- 287 sc->aac_aifq_head = sc->aac_aifq_tail = AAC_AIFQ_LENGTH; 288 289 /* 290 * Initialise the adapter. 291 */ 292 if ((error = aac_init(sc)) != 0) 293 return(error); 294 | 179static int aac_rkt_get_fwstatus(struct aac_softc *sc); 180static void aac_rkt_qnotify(struct aac_softc *sc, int qbit); 181static int aac_rkt_get_istatus(struct aac_softc *sc); 182static void aac_rkt_clear_istatus(struct aac_softc *sc, int mask); 183static void aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, 184 u_int32_t arg0, u_int32_t arg1, 185 u_int32_t arg2, u_int32_t arg3); 186static int aac_rkt_get_mailbox(struct aac_softc *sc, int mb); --- 99 unchanged lines hidden (view full) --- 286 sc->aac_aifq_head = sc->aac_aifq_tail = AAC_AIFQ_LENGTH; 287 288 /* 289 * Initialise the adapter. 290 */ 291 if ((error = aac_init(sc)) != 0) 292 return(error); 293 |
295 /* | 294 /* |
296 * Allocate and connect our interrupt. 297 */ 298 sc->aac_irq_rid = 0; 299 if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ, 300 &sc->aac_irq_rid, 301 RF_SHAREABLE | 302 RF_ACTIVE)) == NULL) { 303 device_printf(sc->aac_dev, "can't allocate interrupt\n"); --- 17 unchanged lines hidden (view full) --- 321 aac_fast_intr, sc, &sc->aac_intr)) { 322 device_printf(sc->aac_dev, 323 "can't set up MPSAFE interrupt\n"); 324 return (EINVAL); 325 } 326 } 327 } 328 | 295 * Allocate and connect our interrupt. 296 */ 297 sc->aac_irq_rid = 0; 298 if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ, 299 &sc->aac_irq_rid, 300 RF_SHAREABLE | 301 RF_ACTIVE)) == NULL) { 302 device_printf(sc->aac_dev, "can't allocate interrupt\n"); --- 17 unchanged lines hidden (view full) --- 320 aac_fast_intr, sc, &sc->aac_intr)) { 321 device_printf(sc->aac_dev, 322 "can't set up MPSAFE interrupt\n"); 323 return (EINVAL); 324 } 325 } 326 } 327 |
329 /* | 328 /* |
330 * Print a little information about the controller. 331 */ 332 aac_describe_controller(sc); 333 334 /* 335 * Register to probe our containers later. 336 */ 337 sc->aac_ich.ich_func = aac_startup; --- 112 unchanged lines hidden (view full) --- 450 * Create a device to respresent a new container 451 */ 452static void 453aac_add_container(struct aac_softc *sc, struct aac_mntinforesp *mir, int f) 454{ 455 struct aac_container *co; 456 device_t child; 457 | 329 * Print a little information about the controller. 330 */ 331 aac_describe_controller(sc); 332 333 /* 334 * Register to probe our containers later. 335 */ 336 sc->aac_ich.ich_func = aac_startup; --- 112 unchanged lines hidden (view full) --- 449 * Create a device to respresent a new container 450 */ 451static void 452aac_add_container(struct aac_softc *sc, struct aac_mntinforesp *mir, int f) 453{ 454 struct aac_container *co; 455 device_t child; 456 |
458 /* | 457 /* |
459 * Check container volume type for validity. Note that many of 460 * the possible types may never show up. 461 */ 462 if ((mir->Status == ST_OK) && (mir->MntTable[0].VolType != CT_NONE)) { 463 co = (struct aac_container *)malloc(sizeof *co, M_AACBUF, 464 M_NOWAIT | M_ZERO); 465 if (co == NULL) 466 panic("Out of memory?!\n"); | 458 * Check container volume type for validity. Note that many of 459 * the possible types may never show up. 460 */ 461 if ((mir->Status == ST_OK) && (mir->MntTable[0].VolType != CT_NONE)) { 462 co = (struct aac_container *)malloc(sizeof *co, M_AACBUF, 463 M_NOWAIT | M_ZERO); 464 if (co == NULL) 465 panic("Out of memory?!\n"); |
467 debug(1, "id %x name '%.16s' size %u type %d", | 466 debug(1, "id %x name '%.16s' size %u type %d", |
468 mir->MntTable[0].ObjectId, 469 mir->MntTable[0].FileSystemName, 470 mir->MntTable[0].Capacity, mir->MntTable[0].VolType); | 467 mir->MntTable[0].ObjectId, 468 mir->MntTable[0].FileSystemName, 469 mir->MntTable[0].Capacity, mir->MntTable[0].VolType); |
471 | 470 |
472 if ((child = device_add_child(sc->aac_dev, "aacd", -1)) == NULL) 473 device_printf(sc->aac_dev, "device_add_child failed\n"); 474 else 475 device_set_ivars(child, co); 476 device_set_desc(child, aac_describe_code(aac_container_types, 477 mir->MntTable[0].VolType)); 478 co->co_disk = child; 479 co->co_found = f; --- 132 unchanged lines hidden (view full) --- 612 struct aac_close_command *cc; 613 614 debug_called(1); 615 616 sc = device_get_softc(dev); 617 618 sc->aac_state |= AAC_STATE_SUSPEND; 619 | 471 if ((child = device_add_child(sc->aac_dev, "aacd", -1)) == NULL) 472 device_printf(sc->aac_dev, "device_add_child failed\n"); 473 else 474 device_set_ivars(child, co); 475 device_set_desc(child, aac_describe_code(aac_container_types, 476 mir->MntTable[0].VolType)); 477 co->co_disk = child; 478 co->co_found = f; --- 132 unchanged lines hidden (view full) --- 611 struct aac_close_command *cc; 612 613 debug_called(1); 614 615 sc = device_get_softc(dev); 616 617 sc->aac_state |= AAC_STATE_SUSPEND; 618 |
620 /* | 619 /* |
621 * Send a Container shutdown followed by a HostShutdown FIB to the 622 * controller to convince it that we don't want to talk to it anymore. 623 * We've been closed and all I/O completed already 624 */ 625 device_printf(sc->aac_dev, "shutting down controller..."); 626 627 mtx_lock(&sc->aac_io_lock); 628 aac_alloc_sync_fib(sc, &fib); --- 40 unchanged lines hidden (view full) --- 669{ 670 struct aac_softc *sc; 671 672 debug_called(1); 673 674 sc = device_get_softc(dev); 675 676 sc->aac_state |= AAC_STATE_SUSPEND; | 620 * Send a Container shutdown followed by a HostShutdown FIB to the 621 * controller to convince it that we don't want to talk to it anymore. 622 * We've been closed and all I/O completed already 623 */ 624 device_printf(sc->aac_dev, "shutting down controller..."); 625 626 mtx_lock(&sc->aac_io_lock); 627 aac_alloc_sync_fib(sc, &fib); --- 40 unchanged lines hidden (view full) --- 668{ 669 struct aac_softc *sc; 670 671 debug_called(1); 672 673 sc = device_get_softc(dev); 674 675 sc->aac_state |= AAC_STATE_SUSPEND; |
677 | 676 |
678 AAC_MASK_INTERRUPTS(sc); 679 return(0); 680} 681 682/* 683 * Bring the controller back to a state ready for operation. 684 */ 685int --- 157 unchanged lines hidden (view full) --- 843 /* 844 * This flag might be set if the card is out of resources. 845 * Checking it here prevents an infinite loop of deferrals. 846 */ 847 if (sc->flags & AAC_QUEUE_FRZN) 848 break; 849 850 /* | 677 AAC_MASK_INTERRUPTS(sc); 678 return(0); 679} 680 681/* 682 * Bring the controller back to a state ready for operation. 683 */ 684int --- 157 unchanged lines hidden (view full) --- 842 /* 843 * This flag might be set if the card is out of resources. 844 * Checking it here prevents an infinite loop of deferrals. 845 */ 846 if (sc->flags & AAC_QUEUE_FRZN) 847 break; 848 849 /* |
851 * Try to get a command that's been put off for lack of | 850 * Try to get a command that's been put off for lack of |
852 * resources 853 */ 854 cm = aac_dequeue_ready(sc); 855 856 /* | 851 * resources 852 */ 853 cm = aac_dequeue_ready(sc); 854 855 /* |
857 * Try to build a command off the bio queue (ignore error | 856 * Try to build a command off the bio queue (ignore error |
858 * return) 859 */ 860 if (cm == NULL) 861 aac_bio_command(sc, &cm); 862 863 /* nothing to do? */ 864 if (cm == NULL) 865 break; --- 71 unchanged lines hidden (view full) --- 937 if (sc->aac_common->ac_printf[0] != 0) 938 aac_print_printf(sc); 939 940 /* Also check to see if the adapter has a command for us. */ 941 if (sc->flags & AAC_FLAGS_NEW_COMM) 942 continue; 943 for (;;) { 944 if (aac_dequeue_fib(sc, AAC_HOST_NORM_CMD_QUEUE, | 857 * return) 858 */ 859 if (cm == NULL) 860 aac_bio_command(sc, &cm); 861 862 /* nothing to do? */ 863 if (cm == NULL) 864 break; --- 71 unchanged lines hidden (view full) --- 936 if (sc->aac_common->ac_printf[0] != 0) 937 aac_print_printf(sc); 938 939 /* Also check to see if the adapter has a command for us. */ 940 if (sc->flags & AAC_FLAGS_NEW_COMM) 941 continue; 942 for (;;) { 943 if (aac_dequeue_fib(sc, AAC_HOST_NORM_CMD_QUEUE, |
945 &fib_size, &fib)) | 944 &fib_size, &fib)) |
946 break; | 945 break; |
947 | 946 |
948 AAC_PRINT_FIB(sc, fib); | 947 AAC_PRINT_FIB(sc, fib); |
949 | 948 |
950 switch (fib->Header.Command) { 951 case AifRequest: 952 aac_handle_aif(sc, fib); 953 break; 954 default: 955 device_printf(sc->aac_dev, "unknown command " 956 "from controller\n"); 957 break; --- 130 unchanged lines hidden (view full) --- 1088 cm->cm_complete = aac_bio_complete; 1089 cm->cm_private = bp; 1090 cm->cm_timestamp = time_uptime; 1091 cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; 1092 1093 /* build the FIB */ 1094 fib = cm->cm_fib; 1095 fib->Header.Size = sizeof(struct aac_fib_header); | 949 switch (fib->Header.Command) { 950 case AifRequest: 951 aac_handle_aif(sc, fib); 952 break; 953 default: 954 device_printf(sc->aac_dev, "unknown command " 955 "from controller\n"); 956 break; --- 130 unchanged lines hidden (view full) --- 1087 cm->cm_complete = aac_bio_complete; 1088 cm->cm_private = bp; 1089 cm->cm_timestamp = time_uptime; 1090 cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; 1091 1092 /* build the FIB */ 1093 fib = cm->cm_fib; 1094 fib->Header.Size = sizeof(struct aac_fib_header); |
1096 fib->Header.XferState = 1097 AAC_FIBSTATE_HOSTOWNED | 1098 AAC_FIBSTATE_INITIALISED | 1099 AAC_FIBSTATE_EMPTY | | 1095 fib->Header.XferState = 1096 AAC_FIBSTATE_HOSTOWNED | 1097 AAC_FIBSTATE_INITIALISED | 1098 AAC_FIBSTATE_EMPTY | |
1100 AAC_FIBSTATE_FROMHOST | 1101 AAC_FIBSTATE_REXPECTED | 1102 AAC_FIBSTATE_NORM | 1103 AAC_FIBSTATE_ASYNC | 1104 AAC_FIBSTATE_FAST_RESPONSE; 1105 1106 /* build the read/write request */ 1107 ad = (struct aac_disk *)bp->bio_disk->d_drv1; --- 185 unchanged lines hidden (view full) --- 1293 cm->cm_flags = 0; 1294 cm->cm_complete = NULL; 1295 cm->cm_private = NULL; 1296 cm->cm_fib->Header.XferState = AAC_FIBSTATE_EMPTY; 1297 cm->cm_fib->Header.StructType = AAC_FIBTYPE_TFIB; 1298 cm->cm_fib->Header.Flags = 0; 1299 cm->cm_fib->Header.SenderSize = cm->cm_sc->aac_max_fib_size; 1300 | 1099 AAC_FIBSTATE_FROMHOST | 1100 AAC_FIBSTATE_REXPECTED | 1101 AAC_FIBSTATE_NORM | 1102 AAC_FIBSTATE_ASYNC | 1103 AAC_FIBSTATE_FAST_RESPONSE; 1104 1105 /* build the read/write request */ 1106 ad = (struct aac_disk *)bp->bio_disk->d_drv1; --- 185 unchanged lines hidden (view full) --- 1292 cm->cm_flags = 0; 1293 cm->cm_complete = NULL; 1294 cm->cm_private = NULL; 1295 cm->cm_fib->Header.XferState = AAC_FIBSTATE_EMPTY; 1296 cm->cm_fib->Header.StructType = AAC_FIBTYPE_TFIB; 1297 cm->cm_fib->Header.Flags = 0; 1298 cm->cm_fib->Header.SenderSize = cm->cm_sc->aac_max_fib_size; 1299 |
1301 /* | 1300 /* |
1302 * These are duplicated in aac_start to cover the case where an 1303 * intermediate stage may have destroyed them. They're left 1304 * initialised here for debugging purposes only. 1305 */ 1306 cm->cm_fib->Header.ReceiverFibAddress = (u_int32_t)cm->cm_fibphys; 1307 cm->cm_fib->Header.SenderData = 0; 1308 1309 aac_enqueue_free(cm); --- 26 unchanged lines hidden (view full) --- 1336 */ 1337static int 1338aac_alloc_commands(struct aac_softc *sc) 1339{ 1340 struct aac_command *cm; 1341 struct aac_fibmap *fm; 1342 uint64_t fibphys; 1343 int i, error; | 1301 * These are duplicated in aac_start to cover the case where an 1302 * intermediate stage may have destroyed them. They're left 1303 * initialised here for debugging purposes only. 1304 */ 1305 cm->cm_fib->Header.ReceiverFibAddress = (u_int32_t)cm->cm_fibphys; 1306 cm->cm_fib->Header.SenderData = 0; 1307 1308 aac_enqueue_free(cm); --- 26 unchanged lines hidden (view full) --- 1335 */ 1336static int 1337aac_alloc_commands(struct aac_softc *sc) 1338{ 1339 struct aac_command *cm; 1340 struct aac_fibmap *fm; 1341 uint64_t fibphys; 1342 int i, error; |
1344 | 1343 |
1345 debug_called(2); 1346 1347 if (sc->total_fibs + sc->aac_max_fibs_alloc > sc->aac_max_fibs) 1348 return (ENOMEM); 1349 1350 fm = malloc(sizeof(struct aac_fibmap), M_AACBUF, M_NOWAIT|M_ZERO); 1351 if (fm == NULL) 1352 return (ENOMEM); 1353 1354 /* allocate the FIBs in DMAable memory and load them */ 1355 if (bus_dmamem_alloc(sc->aac_fib_dmat, (void **)&fm->aac_fibs, 1356 BUS_DMA_NOWAIT, &fm->aac_fibmap)) { 1357 device_printf(sc->aac_dev, 1358 "Not enough contiguous memory available.\n"); 1359 free(fm, M_AACBUF); 1360 return (ENOMEM); 1361 } 1362 1363 /* Ignore errors since this doesn't bounce */ | 1344 debug_called(2); 1345 1346 if (sc->total_fibs + sc->aac_max_fibs_alloc > sc->aac_max_fibs) 1347 return (ENOMEM); 1348 1349 fm = malloc(sizeof(struct aac_fibmap), M_AACBUF, M_NOWAIT|M_ZERO); 1350 if (fm == NULL) 1351 return (ENOMEM); 1352 1353 /* allocate the FIBs in DMAable memory and load them */ 1354 if (bus_dmamem_alloc(sc->aac_fib_dmat, (void **)&fm->aac_fibs, 1355 BUS_DMA_NOWAIT, &fm->aac_fibmap)) { 1356 device_printf(sc->aac_dev, 1357 "Not enough contiguous memory available.\n"); 1358 free(fm, M_AACBUF); 1359 return (ENOMEM); 1360 } 1361 1362 /* Ignore errors since this doesn't bounce */ |
1364 (void)bus_dmamap_load(sc->aac_fib_dmat, fm->aac_fibmap, fm->aac_fibs, | 1363 (void)bus_dmamap_load(sc->aac_fib_dmat, fm->aac_fibmap, fm->aac_fibs, |
1365 sc->aac_max_fibs_alloc * sc->aac_max_fib_size, 1366 aac_map_command_helper, &fibphys, 0); 1367 1368 /* initialise constant fields in the command structure */ 1369 mtx_lock(&sc->aac_io_lock); 1370 bzero(fm->aac_fibs, sc->aac_max_fibs_alloc * sc->aac_max_fib_size); 1371 for (i = 0; i < sc->aac_max_fibs_alloc; i++) { 1372 cm = sc->aac_commands + sc->total_fibs; --- 12 unchanged lines hidden (view full) --- 1385 sc->total_fibs++; 1386 } 1387 1388 if (i > 0) { 1389 TAILQ_INSERT_TAIL(&sc->aac_fibmap_tqh, fm, fm_link); 1390 debug(1, "total_fibs= %d\n", sc->total_fibs); 1391 mtx_unlock(&sc->aac_io_lock); 1392 return (0); | 1364 sc->aac_max_fibs_alloc * sc->aac_max_fib_size, 1365 aac_map_command_helper, &fibphys, 0); 1366 1367 /* initialise constant fields in the command structure */ 1368 mtx_lock(&sc->aac_io_lock); 1369 bzero(fm->aac_fibs, sc->aac_max_fibs_alloc * sc->aac_max_fib_size); 1370 for (i = 0; i < sc->aac_max_fibs_alloc; i++) { 1371 cm = sc->aac_commands + sc->total_fibs; --- 12 unchanged lines hidden (view full) --- 1384 sc->total_fibs++; 1385 } 1386 1387 if (i > 0) { 1388 TAILQ_INSERT_TAIL(&sc->aac_fibmap_tqh, fm, fm_link); 1389 debug(1, "total_fibs= %d\n", sc->total_fibs); 1390 mtx_unlock(&sc->aac_io_lock); 1391 return (0); |
1393 } | 1392 } |
1394 1395 mtx_unlock(&sc->aac_io_lock); 1396 bus_dmamap_unload(sc->aac_fib_dmat, fm->aac_fibmap); 1397 bus_dmamem_free(sc->aac_fib_dmat, fm->aac_fibs, fm->aac_fibmap); 1398 free(fm, M_AACBUF); 1399 return (ENOMEM); 1400} 1401 --- 78 unchanged lines hidden (view full) --- 1480 } 1481 /* update the FIB size for the s/g count */ 1482 fib->Header.Size += nseg*sizeof(struct aac_sg_entry64); 1483 } 1484 } 1485 1486 /* Fix up the address values in the FIB. Use the command array index 1487 * instead of a pointer since these fields are only 32 bits. Shift | 1393 1394 mtx_unlock(&sc->aac_io_lock); 1395 bus_dmamap_unload(sc->aac_fib_dmat, fm->aac_fibmap); 1396 bus_dmamem_free(sc->aac_fib_dmat, fm->aac_fibs, fm->aac_fibmap); 1397 free(fm, M_AACBUF); 1398 return (ENOMEM); 1399} 1400 --- 78 unchanged lines hidden (view full) --- 1479 } 1480 /* update the FIB size for the s/g count */ 1481 fib->Header.Size += nseg*sizeof(struct aac_sg_entry64); 1482 } 1483 } 1484 1485 /* Fix up the address values in the FIB. Use the command array index 1486 * instead of a pointer since these fields are only 32 bits. Shift |
1488 * the SenderFibAddress over to make room for the fast response bit | 1487 * the SenderFibAddress over to make room for the fast response bit |
1489 * and for the AIF bit 1490 */ 1491 cm->cm_fib->Header.SenderFibAddress = (cm->cm_index << 2); 1492 cm->cm_fib->Header.ReceiverFibAddress = (u_int32_t)cm->cm_fibphys; 1493 1494 /* save a pointer to the command for speedy reverse-lookup */ 1495 cm->cm_fib->Header.SenderData = cm->cm_index; 1496 --- 135 unchanged lines hidden (view full) --- 1632 if ((options & AAC_SUPPORTED_NEW_COMM) 1633 && sc->aac_if.aif_send_command) 1634 sc->flags |= AAC_FLAGS_NEW_COMM; 1635 if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE) 1636 sc->flags |= AAC_FLAGS_ARRAY_64BIT; 1637 } 1638 1639 /* Check for broken hardware that does a lower number of commands */ | 1488 * and for the AIF bit 1489 */ 1490 cm->cm_fib->Header.SenderFibAddress = (cm->cm_index << 2); 1491 cm->cm_fib->Header.ReceiverFibAddress = (u_int32_t)cm->cm_fibphys; 1492 1493 /* save a pointer to the command for speedy reverse-lookup */ 1494 cm->cm_fib->Header.SenderData = cm->cm_index; 1495 --- 135 unchanged lines hidden (view full) --- 1631 if ((options & AAC_SUPPORTED_NEW_COMM) 1632 && sc->aac_if.aif_send_command) 1633 sc->flags |= AAC_FLAGS_NEW_COMM; 1634 if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE) 1635 sc->flags |= AAC_FLAGS_ARRAY_64BIT; 1636 } 1637 1638 /* Check for broken hardware that does a lower number of commands */ |
1640 sc->aac_max_fibs = (sc->flags & AAC_FLAGS_256FIBS ? 256:512); | 1639 sc->aac_max_fibs = (sc->flags & AAC_FLAGS_256FIBS ? 256:512); |
1641 1642 /* Remap mem. resource, if required */ | 1640 1641 /* Remap mem. resource, if required */ |
1643 if ((sc->flags & AAC_FLAGS_NEW_COMM) && | 1642 if ((sc->flags & AAC_FLAGS_NEW_COMM) && |
1644 atu_size > rman_get_size(sc->aac_regs_resource)) { 1645 bus_release_resource( 1646 sc->aac_dev, SYS_RES_MEMORY, 1647 sc->aac_regs_rid, sc->aac_regs_resource); 1648 sc->aac_regs_resource = bus_alloc_resource( 1649 sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid, | 1643 atu_size > rman_get_size(sc->aac_regs_resource)) { 1644 bus_release_resource( 1645 sc->aac_dev, SYS_RES_MEMORY, 1646 sc->aac_regs_rid, sc->aac_regs_resource); 1647 sc->aac_regs_resource = bus_alloc_resource( 1648 sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid, |
1650 0ul, ~0ul, atu_size, RF_ACTIVE); | 1649 0ul, ~0ul, atu_size, RF_ACTIVE); |
1651 if (sc->aac_regs_resource == NULL) { 1652 sc->aac_regs_resource = bus_alloc_resource_any( 1653 sc->aac_dev, SYS_RES_MEMORY, 1654 &sc->aac_regs_rid, RF_ACTIVE); 1655 if (sc->aac_regs_resource == NULL) { 1656 device_printf(sc->aac_dev, 1657 "couldn't allocate register window\n"); 1658 return (ENXIO); --- 25 unchanged lines hidden (view full) --- 1684 options = AAC_GET_MAILBOX(sc, 2); 1685 sc->aac_sg_tablesize = (options >> 16); 1686 options = AAC_GET_MAILBOX(sc, 3); 1687 sc->aac_max_fibs = (options & 0xFFFF); 1688 } 1689 if (sc->aac_max_fib_size > PAGE_SIZE) 1690 sc->aac_max_fib_size = PAGE_SIZE; 1691 sc->aac_max_fibs_alloc = PAGE_SIZE / sc->aac_max_fib_size; | 1650 if (sc->aac_regs_resource == NULL) { 1651 sc->aac_regs_resource = bus_alloc_resource_any( 1652 sc->aac_dev, SYS_RES_MEMORY, 1653 &sc->aac_regs_rid, RF_ACTIVE); 1654 if (sc->aac_regs_resource == NULL) { 1655 device_printf(sc->aac_dev, 1656 "couldn't allocate register window\n"); 1657 return (ENXIO); --- 25 unchanged lines hidden (view full) --- 1683 options = AAC_GET_MAILBOX(sc, 2); 1684 sc->aac_sg_tablesize = (options >> 16); 1685 options = AAC_GET_MAILBOX(sc, 3); 1686 sc->aac_max_fibs = (options & 0xFFFF); 1687 } 1688 if (sc->aac_max_fib_size > PAGE_SIZE) 1689 sc->aac_max_fib_size = PAGE_SIZE; 1690 sc->aac_max_fibs_alloc = PAGE_SIZE / sc->aac_max_fib_size; |
1692 | 1691 |
1693 return (0); 1694} 1695 1696static int 1697aac_init(struct aac_softc *sc) 1698{ 1699 struct aac_adapter_init *ip; 1700 time_t then; --- 117 unchanged lines hidden (view full) --- 1818 sc->aac_commands = malloc(sc->aac_max_fibs * sizeof(struct aac_command), 1819 M_AACBUF, M_WAITOK|M_ZERO); 1820 while (sc->total_fibs < AAC_PREALLOCATE_FIBS) { 1821 if (aac_alloc_commands(sc) != 0) 1822 break; 1823 } 1824 if (sc->total_fibs == 0) 1825 goto out; | 1692 return (0); 1693} 1694 1695static int 1696aac_init(struct aac_softc *sc) 1697{ 1698 struct aac_adapter_init *ip; 1699 time_t then; --- 117 unchanged lines hidden (view full) --- 1817 sc->aac_commands = malloc(sc->aac_max_fibs * sizeof(struct aac_command), 1818 M_AACBUF, M_WAITOK|M_ZERO); 1819 while (sc->total_fibs < AAC_PREALLOCATE_FIBS) { 1820 if (aac_alloc_commands(sc) != 0) 1821 break; 1822 } 1823 if (sc->total_fibs == 0) 1824 goto out; |
1826 | 1825 |
1827 /* 1828 * Fill in the init structure. This tells the adapter about the 1829 * physical location of various important shared data structures. 1830 */ 1831 ip = &sc->aac_common->ac_init; 1832 ip->InitStructRevision = AAC_INIT_STRUCT_REVISION; 1833 if (sc->aac_max_fib_size > sizeof(struct aac_fib)) { 1834 ip->InitStructRevision = AAC_INIT_STRUCT_REVISION_4; --- 6 unchanged lines hidden (view full) --- 1841 ip->AdapterFibsVirtualAddress = 0; 1842 ip->AdapterFibsSize = AAC_ADAPTER_FIBS * sizeof(struct aac_fib); 1843 ip->AdapterFibAlign = sizeof(struct aac_fib); 1844 1845 ip->PrintfBufferAddress = sc->aac_common_busaddr + 1846 offsetof(struct aac_common, ac_printf); 1847 ip->PrintfBufferSize = AAC_PRINTF_BUFSIZE; 1848 | 1826 /* 1827 * Fill in the init structure. This tells the adapter about the 1828 * physical location of various important shared data structures. 1829 */ 1830 ip = &sc->aac_common->ac_init; 1831 ip->InitStructRevision = AAC_INIT_STRUCT_REVISION; 1832 if (sc->aac_max_fib_size > sizeof(struct aac_fib)) { 1833 ip->InitStructRevision = AAC_INIT_STRUCT_REVISION_4; --- 6 unchanged lines hidden (view full) --- 1840 ip->AdapterFibsVirtualAddress = 0; 1841 ip->AdapterFibsSize = AAC_ADAPTER_FIBS * sizeof(struct aac_fib); 1842 ip->AdapterFibAlign = sizeof(struct aac_fib); 1843 1844 ip->PrintfBufferAddress = sc->aac_common_busaddr + 1845 offsetof(struct aac_common, ac_printf); 1846 ip->PrintfBufferSize = AAC_PRINTF_BUFSIZE; 1847 |
1849 /* | 1848 /* |
1850 * The adapter assumes that pages are 4K in size, except on some 1851 * broken firmware versions that do the page->byte conversion twice, 1852 * therefore 'assuming' that this value is in 16MB units (2^24). 1853 * Round up since the granularity is so high. 1854 */ 1855 ip->HostPhysMemPages = ctob(physmem) / AAC_PAGE_SIZE; 1856 if (sc->flags & AAC_FLAGS_BROKEN_MEMMAP) { 1857 ip->HostPhysMemPages = --- 12 unchanged lines hidden (view full) --- 1870 ip->MaxFibSize = sc->aac_max_fib_size; 1871 1872 /* 1873 * Initialise FIB queues. Note that it appears that the layout of the 1874 * indexes and the segmentation of the entries may be mandated by the 1875 * adapter, which is only told about the base of the queue index fields. 1876 * 1877 * The initial values of the indices are assumed to inform the adapter | 1849 * The adapter assumes that pages are 4K in size, except on some 1850 * broken firmware versions that do the page->byte conversion twice, 1851 * therefore 'assuming' that this value is in 16MB units (2^24). 1852 * Round up since the granularity is so high. 1853 */ 1854 ip->HostPhysMemPages = ctob(physmem) / AAC_PAGE_SIZE; 1855 if (sc->flags & AAC_FLAGS_BROKEN_MEMMAP) { 1856 ip->HostPhysMemPages = --- 12 unchanged lines hidden (view full) --- 1869 ip->MaxFibSize = sc->aac_max_fib_size; 1870 1871 /* 1872 * Initialise FIB queues. Note that it appears that the layout of the 1873 * indexes and the segmentation of the entries may be mandated by the 1874 * adapter, which is only told about the base of the queue index fields. 1875 * 1876 * The initial values of the indices are assumed to inform the adapter |
1878 * of the sizes of the respective queues, and theoretically it could | 1877 * of the sizes of the respective queues, and theoretically it could |
1879 * work out the entire layout of the queue structures from this. We 1880 * take the easy route and just lay this area out like everyone else 1881 * does. 1882 * | 1878 * work out the entire layout of the queue structures from this. We 1879 * take the easy route and just lay this area out like everyone else 1880 * does. 1881 * |
1883 * The Linux driver uses a much more complex scheme whereby several 1884 * header records are kept for each queue. We use a couple of generic | 1882 * The Linux driver uses a much more complex scheme whereby several 1883 * header records are kept for each queue. We use a couple of generic |
1885 * list manipulation functions which 'know' the size of each list by 1886 * virtue of a table. 1887 */ 1888 qoffset = offsetof(struct aac_common, ac_qbuf) + AAC_QUEUE_ALIGN; 1889 qoffset &= ~(AAC_QUEUE_ALIGN - 1); 1890 sc->aac_queues = 1891 (struct aac_queue_table *)((uintptr_t)sc->aac_common + qoffset); 1892 ip->CommHeaderAddress = sc->aac_common_busaddr + qoffset; --- 59 unchanged lines hidden (view full) --- 1952 break; 1953 default: 1954 break; 1955 } 1956 1957 /* 1958 * Give the init structure to the controller. 1959 */ | 1884 * list manipulation functions which 'know' the size of each list by 1885 * virtue of a table. 1886 */ 1887 qoffset = offsetof(struct aac_common, ac_qbuf) + AAC_QUEUE_ALIGN; 1888 qoffset &= ~(AAC_QUEUE_ALIGN - 1); 1889 sc->aac_queues = 1890 (struct aac_queue_table *)((uintptr_t)sc->aac_common + qoffset); 1891 ip->CommHeaderAddress = sc->aac_common_busaddr + qoffset; --- 59 unchanged lines hidden (view full) --- 1951 break; 1952 default: 1953 break; 1954 } 1955 1956 /* 1957 * Give the init structure to the controller. 1958 */ |
1960 if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT, | 1959 if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT, |
1961 sc->aac_common_busaddr + 1962 offsetof(struct aac_common, ac_init), 0, 0, 0, 1963 NULL)) { 1964 device_printf(sc->aac_dev, 1965 "error establishing init structure\n"); 1966 error = EIO; 1967 goto out; 1968 } --- 44 unchanged lines hidden (view full) --- 2013 *sp = status; 2014 2015 if (status != AAC_SRB_STS_SUCCESS) 2016 return (-1); 2017 return(0); 2018} 2019 2020int | 1960 sc->aac_common_busaddr + 1961 offsetof(struct aac_common, ac_init), 0, 0, 0, 1962 NULL)) { 1963 device_printf(sc->aac_dev, 1964 "error establishing init structure\n"); 1965 error = EIO; 1966 goto out; 1967 } --- 44 unchanged lines hidden (view full) --- 2012 *sp = status; 2013 2014 if (status != AAC_SRB_STS_SUCCESS) 2015 return (-1); 2016 return(0); 2017} 2018 2019int |
2021aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, | 2020aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, |
2022 struct aac_fib *fib, u_int16_t datasize) 2023{ 2024 debug_called(3); 2025 mtx_assert(&sc->aac_io_lock, MA_OWNED); 2026 2027 if (datasize > AAC_FIB_DATASIZE) 2028 return(EINVAL); 2029 --- 59 unchanged lines hidden (view full) --- 2089{ 2090 u_int32_t pi, ci; 2091 int error; 2092 u_int32_t fib_size; 2093 u_int32_t fib_addr; 2094 2095 debug_called(3); 2096 | 2021 struct aac_fib *fib, u_int16_t datasize) 2022{ 2023 debug_called(3); 2024 mtx_assert(&sc->aac_io_lock, MA_OWNED); 2025 2026 if (datasize > AAC_FIB_DATASIZE) 2027 return(EINVAL); 2028 --- 59 unchanged lines hidden (view full) --- 2088{ 2089 u_int32_t pi, ci; 2090 int error; 2091 u_int32_t fib_size; 2092 u_int32_t fib_addr; 2093 2094 debug_called(3); 2095 |
2097 fib_size = cm->cm_fib->Header.Size; | 2096 fib_size = cm->cm_fib->Header.Size; |
2098 fib_addr = cm->cm_fib->Header.ReceiverFibAddress; 2099 2100 /* get the producer/consumer indices */ 2101 pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX]; 2102 ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX]; 2103 2104 /* wrap the queue? */ 2105 if (pi >= aac_qinfo[queue].size) --- 134 unchanged lines hidden (view full) --- 2240 u_int32_t pi, ci; 2241 int error; 2242 u_int32_t fib_size; 2243 u_int32_t fib_addr; 2244 2245 debug_called(1); 2246 2247 /* Tell the adapter where the FIB is */ | 2097 fib_addr = cm->cm_fib->Header.ReceiverFibAddress; 2098 2099 /* get the producer/consumer indices */ 2100 pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX]; 2101 ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX]; 2102 2103 /* wrap the queue? */ 2104 if (pi >= aac_qinfo[queue].size) --- 134 unchanged lines hidden (view full) --- 2239 u_int32_t pi, ci; 2240 int error; 2241 u_int32_t fib_size; 2242 u_int32_t fib_addr; 2243 2244 debug_called(1); 2245 2246 /* Tell the adapter where the FIB is */ |
2248 fib_size = fib->Header.Size; | 2247 fib_size = fib->Header.Size; |
2249 fib_addr = fib->Header.SenderFibAddress; 2250 fib->Header.ReceiverFibAddress = fib_addr; 2251 2252 /* get the producer/consumer indices */ 2253 pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX]; 2254 ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX]; 2255 2256 /* wrap the queue? */ --- 416 unchanged lines hidden (view full) --- 2673 device += 4; 2674 AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32)); 2675 device += 4; 2676 AAC_SETREG4(sc, device, cm->cm_fib->Header.Size); 2677 AAC_SETREG4(sc, AAC_RKT_IQUE, index); 2678 return 0; 2679} 2680 | 2248 fib_addr = fib->Header.SenderFibAddress; 2249 fib->Header.ReceiverFibAddress = fib_addr; 2250 2251 /* get the producer/consumer indices */ 2252 pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX]; 2253 ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX]; 2254 2255 /* wrap the queue? */ --- 416 unchanged lines hidden (view full) --- 2672 device += 4; 2673 AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32)); 2674 device += 4; 2675 AAC_SETREG4(sc, device, cm->cm_fib->Header.Size); 2676 AAC_SETREG4(sc, AAC_RKT_IQUE, index); 2677 return 0; 2678} 2679 |
2681/* 2682 * New comm. interface: get, set outbound queue index | 2680/* 2681 * New comm. interface: get, set outbound queue index |
2683 */ 2684static int 2685aac_rx_get_outb_queue(struct aac_softc *sc) 2686{ 2687 debug_called(3); 2688 2689 return(AAC_GETREG4(sc, AAC_RX_OQUE)); 2690} --- 44 unchanged lines hidden (view full) --- 2735 if (aac_sync_fib(sc, RequestAdapterInfo, 0, fib, 1)) { 2736 device_printf(sc->aac_dev, "RequestAdapterInfo failed\n"); 2737 aac_release_sync_fib(sc); 2738 mtx_unlock(&sc->aac_io_lock); 2739 return; 2740 } 2741 2742 /* save the kernel revision structure for later use */ | 2682 */ 2683static int 2684aac_rx_get_outb_queue(struct aac_softc *sc) 2685{ 2686 debug_called(3); 2687 2688 return(AAC_GETREG4(sc, AAC_RX_OQUE)); 2689} --- 44 unchanged lines hidden (view full) --- 2734 if (aac_sync_fib(sc, RequestAdapterInfo, 0, fib, 1)) { 2735 device_printf(sc->aac_dev, "RequestAdapterInfo failed\n"); 2736 aac_release_sync_fib(sc); 2737 mtx_unlock(&sc->aac_io_lock); 2738 return; 2739 } 2740 2741 /* save the kernel revision structure for later use */ |
2743 info = (struct aac_adapter_info *)&fib->data[0]; | 2742 info = (struct aac_adapter_info *)&fib->data[0]; |
2744 sc->aac_revision = info->KernelRevision; 2745 2746 device_printf(sc->aac_dev, "Adaptec Raid Controller %d.%d.%d-%d\n", 2747 AAC_DRIVER_VERSION >> 24, 2748 (AAC_DRIVER_VERSION >> 16) & 0xFF, 2749 AAC_DRIVER_VERSION & 0xFF, 2750 AAC_DRIVER_BUILD); 2751 2752 if (bootverbose) { 2753 device_printf(sc->aac_dev, "%s %dMHz, %dMB memory " | 2743 sc->aac_revision = info->KernelRevision; 2744 2745 device_printf(sc->aac_dev, "Adaptec Raid Controller %d.%d.%d-%d\n", 2746 AAC_DRIVER_VERSION >> 24, 2747 (AAC_DRIVER_VERSION >> 16) & 0xFF, 2748 AAC_DRIVER_VERSION & 0xFF, 2749 AAC_DRIVER_BUILD); 2750 2751 if (bootverbose) { 2752 device_printf(sc->aac_dev, "%s %dMHz, %dMB memory " |
2754 "(%dMB cache, %dMB execution), %s\n", | 2753 "(%dMB cache, %dMB execution), %s\n", |
2755 aac_describe_code(aac_cpu_variant, info->CpuVariant), | 2754 aac_describe_code(aac_cpu_variant, info->CpuVariant), |
2756 info->ClockSpeed, info->TotalMem / (1024 * 1024), | 2755 info->ClockSpeed, info->TotalMem / (1024 * 1024), |
2757 info->BufferMem / (1024 * 1024), 2758 info->ExecutionMem / (1024 * 1024), 2759 aac_describe_code(aac_battery_platform, 2760 info->batteryPlatform)); 2761 2762 device_printf(sc->aac_dev, 2763 "Kernel %d.%d-%d, Build %d, S/N %6X\n", 2764 info->KernelRevision.external.comp.major, --- 104 unchanged lines hidden (view full) --- 2869 bcopy(&sc->aac_qstat[as->as_item], &as->as_qstat, 2870 sizeof(struct aac_qstat)); 2871 break; 2872 default: 2873 error = ENOENT; 2874 break; 2875 } 2876 break; | 2756 info->BufferMem / (1024 * 1024), 2757 info->ExecutionMem / (1024 * 1024), 2758 aac_describe_code(aac_battery_platform, 2759 info->batteryPlatform)); 2760 2761 device_printf(sc->aac_dev, 2762 "Kernel %d.%d-%d, Build %d, S/N %6X\n", 2763 info->KernelRevision.external.comp.major, --- 104 unchanged lines hidden (view full) --- 2868 bcopy(&sc->aac_qstat[as->as_item], &as->as_qstat, 2869 sizeof(struct aac_qstat)); 2870 break; 2871 default: 2872 error = ENOENT; 2873 break; 2874 } 2875 break; |
2877 | 2876 |
2878 case FSACTL_SENDFIB: 2879 arg = *(caddr_t*)arg; 2880 case FSACTL_LNX_SENDFIB: 2881 debug(1, "FSACTL_SENDFIB"); 2882 error = aac_ioctl_sendfib(sc, arg); 2883 break; 2884 case FSACTL_AIF_THREAD: 2885 case FSACTL_LNX_AIF_THREAD: --- 8 unchanged lines hidden (view full) --- 2894 * Pass the caller out an AdapterFibContext. 2895 * 2896 * Note that because we only support one opener, we 2897 * basically ignore this. Set the caller's context to a magic 2898 * number just in case. 2899 * 2900 * The Linux code hands the driver a pointer into kernel space, 2901 * and then trusts it when the caller hands it back. Aiee! | 2877 case FSACTL_SENDFIB: 2878 arg = *(caddr_t*)arg; 2879 case FSACTL_LNX_SENDFIB: 2880 debug(1, "FSACTL_SENDFIB"); 2881 error = aac_ioctl_sendfib(sc, arg); 2882 break; 2883 case FSACTL_AIF_THREAD: 2884 case FSACTL_LNX_AIF_THREAD: --- 8 unchanged lines hidden (view full) --- 2893 * Pass the caller out an AdapterFibContext. 2894 * 2895 * Note that because we only support one opener, we 2896 * basically ignore this. Set the caller's context to a magic 2897 * number just in case. 2898 * 2899 * The Linux code hands the driver a pointer into kernel space, 2900 * and then trusts it when the caller hands it back. Aiee! |
2902 * Here, we give it the proc pointer of the per-adapter aif | 2901 * Here, we give it the proc pointer of the per-adapter aif |
2903 * thread. It's only used as a sanity check in other calls. 2904 */ 2905 cookie = (uint32_t)(uintptr_t)sc->aifthread; 2906 error = copyout(&cookie, arg, sizeof(cookie)); 2907 break; 2908 case FSACTL_GET_NEXT_ADAPTER_FIB: 2909 arg = *(caddr_t*)arg; 2910 case FSACTL_LNX_GET_NEXT_ADAPTER_FIB: --- 16 unchanged lines hidden (view full) --- 2927 case FSACTL_LNX_QUERY_DISK: 2928 debug(1, "FSACTL_QUERY_DISK"); 2929 error = aac_query_disk(sc, arg); 2930 break; 2931 case FSACTL_DELETE_DISK: 2932 case FSACTL_LNX_DELETE_DISK: 2933 /* 2934 * We don't trust the underland to tell us when to delete a | 2902 * thread. It's only used as a sanity check in other calls. 2903 */ 2904 cookie = (uint32_t)(uintptr_t)sc->aifthread; 2905 error = copyout(&cookie, arg, sizeof(cookie)); 2906 break; 2907 case FSACTL_GET_NEXT_ADAPTER_FIB: 2908 arg = *(caddr_t*)arg; 2909 case FSACTL_LNX_GET_NEXT_ADAPTER_FIB: --- 16 unchanged lines hidden (view full) --- 2926 case FSACTL_LNX_QUERY_DISK: 2927 debug(1, "FSACTL_QUERY_DISK"); 2928 error = aac_query_disk(sc, arg); 2929 break; 2930 case FSACTL_DELETE_DISK: 2931 case FSACTL_LNX_DELETE_DISK: 2932 /* 2933 * We don't trust the underland to tell us when to delete a |
2935 * container, rather we rely on an AIF coming from the | 2934 * container, rather we rely on an AIF coming from the |
2936 * controller 2937 */ 2938 error = 0; 2939 break; 2940 case FSACTL_GET_PCI_INFO: 2941 arg = *(caddr_t*)arg; 2942 case FSACTL_LNX_GET_PCI_INFO: 2943 debug(1, "FSACTL_GET_PCI_INFO"); --- 153 unchanged lines hidden (view full) --- 3097 3098 /* Is it an event that we should care about? */ 3099 switch (aif->command) { 3100 case AifCmdEventNotify: 3101 switch (aif->data.EN.type) { 3102 case AifEnAddContainer: 3103 case AifEnDeleteContainer: 3104 /* | 2935 * controller 2936 */ 2937 error = 0; 2938 break; 2939 case FSACTL_GET_PCI_INFO: 2940 arg = *(caddr_t*)arg; 2941 case FSACTL_LNX_GET_PCI_INFO: 2942 debug(1, "FSACTL_GET_PCI_INFO"); --- 153 unchanged lines hidden (view full) --- 3096 3097 /* Is it an event that we should care about? */ 3098 switch (aif->command) { 3099 case AifCmdEventNotify: 3100 switch (aif->data.EN.type) { 3101 case AifEnAddContainer: 3102 case AifEnDeleteContainer: 3103 /* |
3105 * A container was added or deleted, but the message | 3104 * A container was added or deleted, but the message |
3106 * doesn't tell us anything else! Re-enumerate the 3107 * containers and sort things out. 3108 */ 3109 aac_alloc_sync_fib(sc, &fib); 3110 mi = (struct aac_mntinfo *)&fib->data[0]; 3111 do { 3112 /* 3113 * Ask the controller for its containers one at --- 20 unchanged lines hidden (view full) --- 3134 * Check the container against our list. 3135 * co->co_found was already set to 0 in a 3136 * previous run. 3137 */ 3138 if ((mir->Status == ST_OK) && 3139 (mir->MntTable[0].VolType != CT_NONE)) { 3140 found = 0; 3141 TAILQ_FOREACH(co, | 3105 * doesn't tell us anything else! Re-enumerate the 3106 * containers and sort things out. 3107 */ 3108 aac_alloc_sync_fib(sc, &fib); 3109 mi = (struct aac_mntinfo *)&fib->data[0]; 3110 do { 3111 /* 3112 * Ask the controller for its containers one at --- 20 unchanged lines hidden (view full) --- 3133 * Check the container against our list. 3134 * co->co_found was already set to 0 in a 3135 * previous run. 3136 */ 3137 if ((mir->Status == ST_OK) && 3138 (mir->MntTable[0].VolType != CT_NONE)) { 3139 found = 0; 3140 TAILQ_FOREACH(co, |
3142 &sc->aac_container_tqh, | 3141 &sc->aac_container_tqh, |
3143 co_link) { 3144 if (co->co_mntobj.ObjectId == 3145 mir->MntTable[0].ObjectId) { 3146 co->co_found = 1; 3147 found = 1; 3148 break; 3149 } 3150 } --- 49 unchanged lines hidden (view full) --- 3200 /* Attach the newly created containers */ 3201 if (added) { 3202 mtx_unlock(&sc->aac_io_lock); 3203 mtx_lock(&Giant); 3204 bus_generic_attach(sc->aac_dev); 3205 mtx_unlock(&Giant); 3206 mtx_lock(&sc->aac_io_lock); 3207 } | 3142 co_link) { 3143 if (co->co_mntobj.ObjectId == 3144 mir->MntTable[0].ObjectId) { 3145 co->co_found = 1; 3146 found = 1; 3147 break; 3148 } 3149 } --- 49 unchanged lines hidden (view full) --- 3199 /* Attach the newly created containers */ 3200 if (added) { 3201 mtx_unlock(&sc->aac_io_lock); 3202 mtx_lock(&Giant); 3203 bus_generic_attach(sc->aac_dev); 3204 mtx_unlock(&Giant); 3205 mtx_lock(&sc->aac_io_lock); 3206 } |
3208 | 3207 |
3209 break; 3210 3211 default: 3212 break; 3213 } 3214 3215 default: 3216 break; --- 287 unchanged lines hidden (view full) --- 3504 }; 3505 3506 child = device_add_child(sc->aac_dev, "aacp", -1); 3507 if (child == NULL) { 3508 device_printf(sc->aac_dev, 3509 "device_add_child failed for passthrough bus %d\n", 3510 i); 3511 free(caminf, M_AACBUF); | 3208 break; 3209 3210 default: 3211 break; 3212 } 3213 3214 default: 3215 break; --- 287 unchanged lines hidden (view full) --- 3503 }; 3504 3505 child = device_add_child(sc->aac_dev, "aacp", -1); 3506 if (child == NULL) { 3507 device_printf(sc->aac_dev, 3508 "device_add_child failed for passthrough bus %d\n", 3509 i); 3510 free(caminf, M_AACBUF); |
3512 break; | 3511 break; |
3513 } 3514 3515 caminf->TargetsPerBus = businfo.TargetsPerBus; 3516 caminf->BusNumber = i; 3517 caminf->InitiatorBusId = businfo.InitiatorBusId[i]; 3518 caminf->aac_sc = sc; 3519 caminf->sim_dev = child; 3520 --- 12 unchanged lines hidden --- | 3512 } 3513 3514 caminf->TargetsPerBus = businfo.TargetsPerBus; 3515 caminf->BusNumber = i; 3516 caminf->InitiatorBusId = businfo.InitiatorBusId[i]; 3517 caminf->aac_sc = sc; 3518 caminf->sim_dev = child; 3519 --- 12 unchanged lines hidden --- |