aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/sbp2.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/sbp2.h')
-rw-r--r--drivers/ieee1394/sbp2.h80
1 files changed, 33 insertions, 47 deletions
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
index 5483b458bd77..d1dbc0d63177 100644
--- a/drivers/ieee1394/sbp2.h
+++ b/drivers/ieee1394/sbp2.h
@@ -25,7 +25,7 @@
25#define SBP2_DEVICE_NAME "sbp2" 25#define SBP2_DEVICE_NAME "sbp2"
26 26
27/* 27/*
28 * SBP2 specific structures and defines 28 * SBP-2 specific definitions
29 */ 29 */
30 30
31#define ORB_DIRECTION_WRITE_TO_MEDIA 0x0 31#define ORB_DIRECTION_WRITE_TO_MEDIA 0x0
@@ -185,8 +185,9 @@ struct sbp2_status_block {
185 u8 command_set_dependent[24]; 185 u8 command_set_dependent[24];
186} __attribute__((packed)); 186} __attribute__((packed));
187 187
188
188/* 189/*
189 * Miscellaneous SBP2 related config rom defines 190 * SBP2 related configuration ROM definitions
190 */ 191 */
191 192
192#define SBP2_UNIT_DIRECTORY_OFFSET_KEY 0xd1 193#define SBP2_UNIT_DIRECTORY_OFFSET_KEY 0xd1
@@ -207,19 +208,17 @@ struct sbp2_status_block {
207#define SBP2_UNSOLICITED_STATUS_VALUE 0xf 208#define SBP2_UNSOLICITED_STATUS_VALUE 0xf
208 209
209#define SBP2_BUSY_TIMEOUT_ADDRESS 0xfffff0000210ULL 210#define SBP2_BUSY_TIMEOUT_ADDRESS 0xfffff0000210ULL
211/* biggest possible value for Single Phase Retry count is 0xf */
210#define SBP2_BUSY_TIMEOUT_VALUE 0xf 212#define SBP2_BUSY_TIMEOUT_VALUE 0xf
211 213
212#define SBP2_AGENT_RESET_DATA 0xf 214#define SBP2_AGENT_RESET_DATA 0xf
213 215
214/*
215 * Unit spec id and sw version entry for SBP-2 devices
216 */
217
218#define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e 216#define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e
219#define SBP2_SW_VERSION_ENTRY 0x00010483 217#define SBP2_SW_VERSION_ENTRY 0x00010483
220 218
219
221/* 220/*
222 * SCSI specific stuff 221 * SCSI specific definitions
223 */ 222 */
224 223
225#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 224#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000
@@ -237,18 +236,19 @@ struct sbp2_status_block {
237#define SBP2_SCSI_STATUS_COMMAND_TERMINATED 0x22 236#define SBP2_SCSI_STATUS_COMMAND_TERMINATED 0x22
238#define SBP2_SCSI_STATUS_SELECTION_TIMEOUT 0xff 237#define SBP2_SCSI_STATUS_SELECTION_TIMEOUT 0xff
239 238
240/* This is the two dma types we use for cmd_dma below */ 239
240/*
241 * Representations of commands and devices
242 */
243
241enum cmd_dma_types { 244enum cmd_dma_types {
242 CMD_DMA_NONE, 245 CMD_DMA_NONE,
243 CMD_DMA_PAGE, 246 CMD_DMA_PAGE,
244 CMD_DMA_SINGLE 247 CMD_DMA_SINGLE
245}; 248};
246 249
247/* 250/* Per SCSI command */
248 * Encapsulates all the info necessary for an outstanding command.
249 */
250struct sbp2_command_info { 251struct sbp2_command_info {
251
252 struct list_head list; 252 struct list_head list;
253 struct sbp2_command_orb command_orb ____cacheline_aligned; 253 struct sbp2_command_orb command_orb ____cacheline_aligned;
254 dma_addr_t command_orb_dma ____cacheline_aligned; 254 dma_addr_t command_orb_dma ____cacheline_aligned;
@@ -263,18 +263,17 @@ struct sbp2_command_info {
263 enum cmd_dma_types dma_type; 263 enum cmd_dma_types dma_type;
264 unsigned long dma_size; 264 unsigned long dma_size;
265 int dma_dir; 265 int dma_dir;
266
267}; 266};
268 267
269struct sbp2scsi_host_info; 268/* Per FireWire host */
269struct sbp2scsi_host_info {
270 struct hpsb_host *host;
271 struct list_head scsi_ids;
272};
270 273
271/* 274/* Per logical unit */
272 * Information needed on a per scsi id basis (one for each sbp2 device)
273 */
274struct scsi_id_instance_data { 275struct scsi_id_instance_data {
275 /* 276 /* Operation request blocks */
276 * Various sbp2 specific structures
277 */
278 struct sbp2_command_orb *last_orb; 277 struct sbp2_command_orb *last_orb;
279 dma_addr_t last_orb_dma; 278 dma_addr_t last_orb_dma;
280 struct sbp2_login_orb *login_orb; 279 struct sbp2_login_orb *login_orb;
@@ -291,57 +290,49 @@ struct scsi_id_instance_data {
291 dma_addr_t logout_orb_dma; 290 dma_addr_t logout_orb_dma;
292 struct sbp2_status_block status_block; 291 struct sbp2_status_block status_block;
293 292
294 /* 293 /* How to talk to the unit */
295 * Stuff we need to know about the sbp2 device itself
296 */
297 u64 sbp2_management_agent_addr; 294 u64 sbp2_management_agent_addr;
298 u64 sbp2_command_block_agent_addr; 295 u64 sbp2_command_block_agent_addr;
299 u32 speed_code; 296 u32 speed_code;
300 u32 max_payload_size; 297 u32 max_payload_size;
301 298
302 /* 299 /* Pulled from the device's unit directory */
303 * Values pulled from the device's unit directory
304 */
305 u32 sbp2_command_set_spec_id; 300 u32 sbp2_command_set_spec_id;
306 u32 sbp2_command_set; 301 u32 sbp2_command_set;
307 u32 sbp2_unit_characteristics; 302 u32 sbp2_unit_characteristics;
308 u32 sbp2_lun; 303 u32 sbp2_lun;
309 u32 sbp2_firmware_revision; 304 u32 sbp2_firmware_revision;
310 305
311 /* 306 /* Address for the unit to write status blocks to */
312 * Address for the device to write status blocks to
313 */
314 u64 status_fifo_addr; 307 u64 status_fifo_addr;
315 308
316 /* 309 /* Waitqueue flag for logins, reconnects, logouts, query logins */
317 * Waitqueue flag for logins, reconnects, logouts, query logins
318 */
319 int access_complete:1; 310 int access_complete:1;
320 311
321 /* 312 /* Pool of command ORBs for this logical unit */
322 * Pool of command orbs, so we can have more than overlapped command per id
323 */
324 spinlock_t sbp2_command_orb_lock; 313 spinlock_t sbp2_command_orb_lock;
325 struct list_head sbp2_command_orb_inuse; 314 struct list_head sbp2_command_orb_inuse;
326 struct list_head sbp2_command_orb_completed; 315 struct list_head sbp2_command_orb_completed;
327 316
317 /* Backlink to FireWire host; list of units attached to the host */
318 struct sbp2scsi_host_info *hi;
328 struct list_head scsi_list; 319 struct list_head scsi_list;
329 320
330 /* Node entry, as retrieved from NodeMgr entries */ 321 /* IEEE 1394 core's device representations */
331 struct node_entry *ne; 322 struct node_entry *ne;
332 struct unit_directory *ud; 323 struct unit_directory *ud;
333 324
334 /* A backlink to our host_info */ 325 /* SCSI core's device representations */
335 struct sbp2scsi_host_info *hi;
336
337 /* SCSI related pointers */
338 struct scsi_device *sdev; 326 struct scsi_device *sdev;
339 struct Scsi_Host *scsi_host; 327 struct Scsi_Host *scsi_host;
340 328
341 /* Device specific workarounds/brokeness */ 329 /* Device specific workarounds/brokeness */
342 unsigned workarounds; 330 unsigned workarounds;
343 331
332 /* Connection state */
344 atomic_t state; 333 atomic_t state;
334
335 /* For deferred requests to the fetch agent */
345 struct work_struct protocol_work; 336 struct work_struct protocol_work;
346}; 337};
347 338
@@ -352,13 +343,8 @@ enum sbp2lu_state_types {
352 SBP2LU_STATE_IN_SHUTDOWN /* when sbp2_remove was called */ 343 SBP2LU_STATE_IN_SHUTDOWN /* when sbp2_remove was called */
353}; 344};
354 345
355/* Sbp2 host data structure (one per IEEE1394 host) */ 346/* For use in scsi_id_instance_data.workarounds and in the corresponding
356struct sbp2scsi_host_info { 347 * module load parameter */
357 struct hpsb_host *host; /* IEEE1394 host */
358 struct list_head scsi_ids; /* List of scsi ids on this host */
359};
360
361/* Flags for detected oddities and brokeness */
362#define SBP2_WORKAROUND_128K_MAX_TRANS 0x1 348#define SBP2_WORKAROUND_128K_MAX_TRANS 0x1
363#define SBP2_WORKAROUND_INQUIRY_36 0x2 349#define SBP2_WORKAROUND_INQUIRY_36 0x2
364#define SBP2_WORKAROUND_MODE_SENSE_8 0x4 350#define SBP2_WORKAROUND_MODE_SENSE_8 0x4