aic7xxx.h (115917) | aic7xxx.h (123579) |
---|---|
1/* 2 * Core definitions and data structures shareable across OS platforms. 3 * 4 * Copyright (c) 1994-2001 Justin T. Gibbs. 5 * Copyright (c) 2000-2001 Adaptec Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGES. 39 * | 1/* 2 * Core definitions and data structures shareable across OS platforms. 3 * 4 * Copyright (c) 1994-2001 Justin T. Gibbs. 5 * Copyright (c) 2000-2001 Adaptec Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGES. 39 * |
40 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#79 $ | 40 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#85 $ |
41 * | 41 * |
42 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx.h 115917 2003-06-06 23:48:19Z gibbs $ | 42 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx.h 123579 2003-12-17 00:02:10Z gibbs $ |
43 */ 44 45#ifndef _AIC7XXX_H_ 46#define _AIC7XXX_H_ 47 48/* Register Definitions */ 49#include "aic7xxx_reg.h" 50 --- 187 unchanged lines hidden (view full) --- 238 * The real 7850 does not support Ultra modes, but there are 239 * several cards that use the generic 7850 PCI ID even though 240 * they are using an Ultra capable chip (7859/7860). We start 241 * out with the AHC_ULTRA feature set and then check the DEVSTATUS 242 * register to determine if the capability is really present. 243 */ 244 AHC_AIC7850_FE = AHC_SPIOCAP|AHC_AUTOPAUSE|AHC_TARGETMODE|AHC_ULTRA, 245 AHC_AIC7860_FE = AHC_AIC7850_FE, | 43 */ 44 45#ifndef _AIC7XXX_H_ 46#define _AIC7XXX_H_ 47 48/* Register Definitions */ 49#include "aic7xxx_reg.h" 50 --- 187 unchanged lines hidden (view full) --- 238 * The real 7850 does not support Ultra modes, but there are 239 * several cards that use the generic 7850 PCI ID even though 240 * they are using an Ultra capable chip (7859/7860). We start 241 * out with the AHC_ULTRA feature set and then check the DEVSTATUS 242 * register to determine if the capability is really present. 243 */ 244 AHC_AIC7850_FE = AHC_SPIOCAP|AHC_AUTOPAUSE|AHC_TARGETMODE|AHC_ULTRA, 245 AHC_AIC7860_FE = AHC_AIC7850_FE, |
246 AHC_AIC7870_FE = AHC_TARGETMODE, | 246 AHC_AIC7870_FE = AHC_TARGETMODE|AHC_AUTOPAUSE, |
247 AHC_AIC7880_FE = AHC_AIC7870_FE|AHC_ULTRA, 248 /* 249 * Although we have space for both the initiator and 250 * target roles on ULTRA2 chips, we currently disable 251 * the initiator role to allow multi-scsi-id target mode 252 * configurations. We can only respond on the same SCSI 253 * ID as our initiator role if we allow initiator operation. 254 * At some point, we should add a configuration knob to --- 106 unchanged lines hidden (view full) --- 361 AHC_ALL_INTERRUPTS = 0x100000, 362 AHC_PAGESCBS = 0x400000, /* Enable SCB paging */ 363 AHC_EDGE_INTERRUPT = 0x800000, /* Device uses edge triggered ints */ 364 AHC_39BIT_ADDRESSING = 0x1000000, /* Use 39 bit addressing scheme. */ 365 AHC_LSCBS_ENABLED = 0x2000000, /* 64Byte SCBs enabled */ 366 AHC_SCB_CONFIG_USED = 0x4000000, /* No SEEPROM but SCB2 had info. */ 367 AHC_NO_BIOS_INIT = 0x8000000, /* No BIOS left over settings. */ 368 AHC_DISABLE_PCI_PERR = 0x10000000, | 247 AHC_AIC7880_FE = AHC_AIC7870_FE|AHC_ULTRA, 248 /* 249 * Although we have space for both the initiator and 250 * target roles on ULTRA2 chips, we currently disable 251 * the initiator role to allow multi-scsi-id target mode 252 * configurations. We can only respond on the same SCSI 253 * ID as our initiator role if we allow initiator operation. 254 * At some point, we should add a configuration knob to --- 106 unchanged lines hidden (view full) --- 361 AHC_ALL_INTERRUPTS = 0x100000, 362 AHC_PAGESCBS = 0x400000, /* Enable SCB paging */ 363 AHC_EDGE_INTERRUPT = 0x800000, /* Device uses edge triggered ints */ 364 AHC_39BIT_ADDRESSING = 0x1000000, /* Use 39 bit addressing scheme. */ 365 AHC_LSCBS_ENABLED = 0x2000000, /* 64Byte SCBs enabled */ 366 AHC_SCB_CONFIG_USED = 0x4000000, /* No SEEPROM but SCB2 had info. */ 367 AHC_NO_BIOS_INIT = 0x8000000, /* No BIOS left over settings. */ 368 AHC_DISABLE_PCI_PERR = 0x10000000, |
369 AHC_HAS_TERM_LOGIC = 0x20000000 | 369 AHC_HAS_TERM_LOGIC = 0x20000000, 370 AHC_SHUTDOWN_RECOVERY = 0x40000000 /* Terminate recovery thread. */ |
370} ahc_flag; 371 372/************************* Hardware SCB Definition ***************************/ 373 374/* 375 * The driver keeps up to MAX_SCB scb structures per card in memory. The SCB 376 * consists of a "hardware SCB" mirroring the fields available on the card 377 * and additional information the kernel stores for each transaction. --- 28 unchanged lines hidden (view full) --- 406 uint32_t residual_datacnt; /* Residual in the current S/G seg */ 407 uint32_t residual_sg_ptr; /* The next S/G for this transfer */ 408 uint8_t scsi_status; /* SCSI status to give to initiator */ 409 uint8_t target_phases; /* Bitmap of phases to execute */ 410 uint8_t data_phase; /* Data-In or Data-Out */ 411 uint8_t initiator_tag; /* Initiator's transaction tag */ 412}; 413 | 371} ahc_flag; 372 373/************************* Hardware SCB Definition ***************************/ 374 375/* 376 * The driver keeps up to MAX_SCB scb structures per card in memory. The SCB 377 * consists of a "hardware SCB" mirroring the fields available on the card 378 * and additional information the kernel stores for each transaction. --- 28 unchanged lines hidden (view full) --- 407 uint32_t residual_datacnt; /* Residual in the current S/G seg */ 408 uint32_t residual_sg_ptr; /* The next S/G for this transfer */ 409 uint8_t scsi_status; /* SCSI status to give to initiator */ 410 uint8_t target_phases; /* Bitmap of phases to execute */ 411 uint8_t data_phase; /* Data-In or Data-Out */ 412 uint8_t initiator_tag; /* Initiator's transaction tag */ 413}; 414 |
415#define MAX_CDB_LEN 16 |
|
414struct hardware_scb { 415/*0*/ union { 416 /* 417 * If the cdb is 12 bytes or less, we embed it directly 418 * in the SCB. For longer cdbs, we embed the address 419 * of the cdb payload as seen by the chip and a DMA 420 * is used to pull it in. 421 */ --- 103 unchanged lines hidden (view full) --- 525 struct ahc_dma_seg* sg_vaddr; 526 SLIST_ENTRY(sg_map_node) links; 527}; 528 529/* 530 * The current state of this SCB. 531 */ 532typedef enum { | 416struct hardware_scb { 417/*0*/ union { 418 /* 419 * If the cdb is 12 bytes or less, we embed it directly 420 * in the SCB. For longer cdbs, we embed the address 421 * of the cdb payload as seen by the chip and a DMA 422 * is used to pull it in. 423 */ --- 103 unchanged lines hidden (view full) --- 527 struct ahc_dma_seg* sg_vaddr; 528 SLIST_ENTRY(sg_map_node) links; 529}; 530 531/* 532 * The current state of this SCB. 533 */ 534typedef enum { |
533 SCB_FREE = 0x0000, | 535 SCB_FLAG_NONE = 0x0000, |
534 SCB_OTHERTCL_TIMEOUT = 0x0002,/* 535 * Another device was active 536 * during the first timeout for 537 * this SCB so we gave ourselves 538 * an additional timeout period 539 * in case it was hogging the 540 * bus. 541 */ --- 13 unchanged lines hidden (view full) --- 555 * payload of the command. This 556 * flag is checked when normal 557 * status is returned to catch 558 * the case of a target not 559 * responding to our attempt 560 * to report the error. 561 */ 562 SCB_TARGET_SCB = 0x2000, | 536 SCB_OTHERTCL_TIMEOUT = 0x0002,/* 537 * Another device was active 538 * during the first timeout for 539 * this SCB so we gave ourselves 540 * an additional timeout period 541 * in case it was hogging the 542 * bus. 543 */ --- 13 unchanged lines hidden (view full) --- 557 * payload of the command. This 558 * flag is checked when normal 559 * status is returned to catch 560 * the case of a target not 561 * responding to our attempt 562 * to report the error. 563 */ 564 SCB_TARGET_SCB = 0x2000, |
563 SCB_SILENT = 0x4000 /* | 565 SCB_SILENT = 0x4000,/* |
564 * Be quiet about transmission type 565 * errors. They are expected and we 566 * don't want to upset the user. This 567 * flag is typically used during DV. 568 */ | 566 * Be quiet about transmission type 567 * errors. They are expected and we 568 * don't want to upset the user. This 569 * flag is typically used during DV. 570 */ |
571 SCB_TIMEDOUT = 0x8000 /* 572 * SCB has timed out and is on the 573 * timedout list. 574 */ |
|
569} scb_flag; 570 571struct scb { 572 struct hardware_scb *hscb; 573 union { 574 SLIST_ENTRY(scb) sle; 575 TAILQ_ENTRY(scb) tqe; 576 } links; 577 LIST_ENTRY(scb) pending_links; | 575} scb_flag; 576 577struct scb { 578 struct hardware_scb *hscb; 579 union { 580 SLIST_ENTRY(scb) sle; 581 TAILQ_ENTRY(scb) tqe; 582 } links; 583 LIST_ENTRY(scb) pending_links; |
578 ahc_io_ctx_t io_ctx; | 584 LIST_ENTRY(scb) timedout_links; 585 aic_io_ctx_t io_ctx; |
579 struct ahc_softc *ahc_softc; 580 scb_flag flags; 581#ifndef __linux__ 582 bus_dmamap_t dmamap; 583#endif 584 struct scb_platform_data *platform_data; 585 struct sg_map_node *sg_map; 586 struct ahc_dma_seg *sg_list; --- 337 unchanged lines hidden (view full) --- 924 struct scb *next_queued_scb; 925 926 /* 927 * SCBs that have been sent to the controller 928 */ 929 LIST_HEAD(, scb) pending_scbs; 930 931 /* | 586 struct ahc_softc *ahc_softc; 587 scb_flag flags; 588#ifndef __linux__ 589 bus_dmamap_t dmamap; 590#endif 591 struct scb_platform_data *platform_data; 592 struct sg_map_node *sg_map; 593 struct ahc_dma_seg *sg_list; --- 337 unchanged lines hidden (view full) --- 931 struct scb *next_queued_scb; 932 933 /* 934 * SCBs that have been sent to the controller 935 */ 936 LIST_HEAD(, scb) pending_scbs; 937 938 /* |
939 * SCBs whose timeout routine has been called. 940 */ 941 LIST_HEAD(, scb) timedout_scbs; 942 943 /* |
|
932 * Counting lock for deferring the release of additional 933 * untagged transactions from the untagged_queues. When 934 * the lock is decremented to 0, all queues in the 935 * untagged_queues array are run. 936 */ 937 u_int untagged_queue_lock; 938 939 /* --- 13 unchanged lines hidden (view full) --- 953 /* 954 * Platform specific data. 955 */ 956 struct ahc_platform_data *platform_data; 957 958 /* 959 * Platform specific device information. 960 */ | 944 * Counting lock for deferring the release of additional 945 * untagged transactions from the untagged_queues. When 946 * the lock is decremented to 0, all queues in the 947 * untagged_queues array are run. 948 */ 949 u_int untagged_queue_lock; 950 951 /* --- 13 unchanged lines hidden (view full) --- 965 /* 966 * Platform specific data. 967 */ 968 struct ahc_platform_data *platform_data; 969 970 /* 971 * Platform specific device information. 972 */ |
961 ahc_dev_softc_t dev_softc; | 973 aic_dev_softc_t dev_softc; |
962 963 /* 964 * Bus specific device information. 965 */ 966 ahc_bus_intr_t bus_intr; 967 968 /* 969 * Bus specific initialization required --- 160 unchanged lines hidden (view full) --- 1130 char channel; 1131 role_t role; /* 1132 * Only guaranteed to be correct if not 1133 * in the busfree state. 1134 */ 1135}; 1136 1137/****************************** PCI Structures ********************************/ | 974 975 /* 976 * Bus specific device information. 977 */ 978 ahc_bus_intr_t bus_intr; 979 980 /* 981 * Bus specific initialization required --- 160 unchanged lines hidden (view full) --- 1142 char channel; 1143 role_t role; /* 1144 * Only guaranteed to be correct if not 1145 * in the busfree state. 1146 */ 1147}; 1148 1149/****************************** PCI Structures ********************************/ |
1150#define AHC_PCI_IOADDR PCIR_BAR(0) /* I/O Address */ 1151#define AHC_PCI_MEMADDR PCIR_BAR(1) /* Mem I/O Address */ 1152 |
|
1138typedef int (ahc_device_setup_t)(struct ahc_softc *); 1139 1140struct ahc_pci_identity { 1141 uint64_t full_id; 1142 uint64_t id_mask; 1143 char *name; 1144 ahc_device_setup_t *setup; 1145}; --- 16 unchanged lines hidden (view full) --- 1162/*************************** Function Declarations ****************************/ 1163/******************************************************************************/ 1164u_int ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl); 1165void ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl); 1166void ahc_busy_tcl(struct ahc_softc *ahc, 1167 u_int tcl, u_int busyid); 1168 1169/***************************** PCI Front End *********************************/ | 1153typedef int (ahc_device_setup_t)(struct ahc_softc *); 1154 1155struct ahc_pci_identity { 1156 uint64_t full_id; 1157 uint64_t id_mask; 1158 char *name; 1159 ahc_device_setup_t *setup; 1160}; --- 16 unchanged lines hidden (view full) --- 1177/*************************** Function Declarations ****************************/ 1178/******************************************************************************/ 1179u_int ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl); 1180void ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl); 1181void ahc_busy_tcl(struct ahc_softc *ahc, 1182 u_int tcl, u_int busyid); 1183 1184/***************************** PCI Front End *********************************/ |
1170struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t); | 1185struct ahc_pci_identity *ahc_find_pci_device(aic_dev_softc_t); |
1171int ahc_pci_config(struct ahc_softc *, 1172 struct ahc_pci_identity *); 1173int ahc_pci_test_register_access(struct ahc_softc *); 1174 1175/*************************** EISA/VL Front End ********************************/ 1176struct aic7770_identity *aic7770_find_device(uint32_t); 1177int aic7770_config(struct ahc_softc *ahc, 1178 struct aic7770_identity *, --- 47 unchanged lines hidden (view full) --- 1226 SEARCH_COUNT, 1227 SEARCH_REMOVE 1228} ahc_search_action; 1229int ahc_search_qinfifo(struct ahc_softc *ahc, int target, 1230 char channel, int lun, u_int tag, 1231 role_t role, uint32_t status, 1232 ahc_search_action action); 1233int ahc_search_untagged_queues(struct ahc_softc *ahc, | 1186int ahc_pci_config(struct ahc_softc *, 1187 struct ahc_pci_identity *); 1188int ahc_pci_test_register_access(struct ahc_softc *); 1189 1190/*************************** EISA/VL Front End ********************************/ 1191struct aic7770_identity *aic7770_find_device(uint32_t); 1192int aic7770_config(struct ahc_softc *ahc, 1193 struct aic7770_identity *, --- 47 unchanged lines hidden (view full) --- 1241 SEARCH_COUNT, 1242 SEARCH_REMOVE 1243} ahc_search_action; 1244int ahc_search_qinfifo(struct ahc_softc *ahc, int target, 1245 char channel, int lun, u_int tag, 1246 role_t role, uint32_t status, 1247 ahc_search_action action); 1248int ahc_search_untagged_queues(struct ahc_softc *ahc, |
1234 ahc_io_ctx_t ctx, | 1249 aic_io_ctx_t ctx, |
1235 int target, char channel, 1236 int lun, uint32_t status, 1237 ahc_search_action action); 1238int ahc_search_disc_list(struct ahc_softc *ahc, int target, 1239 char channel, int lun, u_int tag, 1240 int stop_on_first, int remove, 1241 int save_state); 1242void ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb); 1243int ahc_reset_channel(struct ahc_softc *ahc, char channel, 1244 int initiate_reset); 1245int ahc_abort_scbs(struct ahc_softc *ahc, int target, 1246 char channel, int lun, u_int tag, 1247 role_t role, uint32_t status); 1248void ahc_restart(struct ahc_softc *ahc); 1249void ahc_calc_residual(struct ahc_softc *ahc, 1250 struct scb *scb); | 1250 int target, char channel, 1251 int lun, uint32_t status, 1252 ahc_search_action action); 1253int ahc_search_disc_list(struct ahc_softc *ahc, int target, 1254 char channel, int lun, u_int tag, 1255 int stop_on_first, int remove, 1256 int save_state); 1257void ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb); 1258int ahc_reset_channel(struct ahc_softc *ahc, char channel, 1259 int initiate_reset); 1260int ahc_abort_scbs(struct ahc_softc *ahc, int target, 1261 char channel, int lun, u_int tag, 1262 role_t role, uint32_t status); 1263void ahc_restart(struct ahc_softc *ahc); 1264void ahc_calc_residual(struct ahc_softc *ahc, 1265 struct scb *scb); |
1266void ahc_timeout(struct scb *scb); 1267void ahc_recover_commands(struct ahc_softc *ahc); |
|
1251/*************************** Utility Functions ********************************/ 1252struct ahc_phase_table_entry* 1253 ahc_lookup_phase_entry(int phase); 1254void ahc_compile_devinfo(struct ahc_devinfo *devinfo, 1255 u_int our_id, u_int target, 1256 u_int lun, char channel, 1257 role_t role); 1258/************************** Transfer Negotiation ******************************/ --- 94 unchanged lines hidden --- | 1268/*************************** Utility Functions ********************************/ 1269struct ahc_phase_table_entry* 1270 ahc_lookup_phase_entry(int phase); 1271void ahc_compile_devinfo(struct ahc_devinfo *devinfo, 1272 u_int our_id, u_int target, 1273 u_int lun, char channel, 1274 role_t role); 1275/************************** Transfer Negotiation ******************************/ --- 94 unchanged lines hidden --- |