2020#ifndef HPSA_CMD_H
2121#define HPSA_CMD_H
2222
23+ #include <linux/compiler.h>
24+
2325/* general boundary defintions */
2426#define SENSEINFOBYTES 32 /* may vary between hbas */
2527#define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */
@@ -200,12 +202,10 @@ union u64bit {
200202 MAX_EXT_TARGETS + 1) /* + 1 is for the controller itself */
201203
202204/* SCSI-3 Commands */
203- #pragma pack(1)
204-
205205#define HPSA_INQUIRY 0x12
206206struct InquiryData {
207207 u8 data_byte [36 ];
208- };
208+ } __packed ;
209209
210210#define HPSA_REPORT_LOG 0xc2 /* Report Logical LUNs */
211211#define HPSA_REPORT_PHYS 0xc3 /* Report Physical LUNs */
@@ -221,7 +221,7 @@ struct raid_map_disk_data {
221221 u8 xor_mult [2 ]; /**< XOR multipliers for this position,
222222 * valid for data disks only */
223223 u8 reserved [2 ];
224- };
224+ } __packed ;
225225
226226struct raid_map_data {
227227 __le32 structure_size ; /* Size of entire structure in bytes */
@@ -247,14 +247,14 @@ struct raid_map_data {
247247 __le16 dekindex ; /* Data encryption key index. */
248248 u8 reserved [16 ];
249249 struct raid_map_disk_data data [RAID_MAP_MAX_ENTRIES ];
250- };
250+ } __packed ;
251251
252252struct ReportLUNdata {
253253 u8 LUNListLength [4 ];
254254 u8 extended_response_flag ;
255255 u8 reserved [3 ];
256256 u8 LUN [HPSA_MAX_LUN ][8 ];
257- };
257+ } __packed ;
258258
259259struct ext_report_lun_entry {
260260 u8 lunid [8 ];
@@ -269,20 +269,20 @@ struct ext_report_lun_entry {
269269 u8 lun_count ; /* multi-lun device, how many luns */
270270 u8 redundant_paths ;
271271 u32 ioaccel_handle ; /* ioaccel1 only uses lower 16 bits */
272- };
272+ } __packed ;
273273
274274struct ReportExtendedLUNdata {
275275 u8 LUNListLength [4 ];
276276 u8 extended_response_flag ;
277277 u8 reserved [3 ];
278278 struct ext_report_lun_entry LUN [HPSA_MAX_PHYS_LUN ];
279- };
279+ } __packed ;
280280
281281struct SenseSubsystem_info {
282282 u8 reserved [36 ];
283283 u8 portname [8 ];
284284 u8 reserved1 [1108 ];
285- };
285+ } __packed ;
286286
287287/* BMIC commands */
288288#define BMIC_READ 0x26
@@ -317,36 +317,36 @@ union SCSI3Addr {
317317 u8 Targ :6 ;
318318 u8 Mode :2 ; /* b10 */
319319 } LogUnit ;
320- };
320+ } __packed ;
321321
322322struct PhysDevAddr {
323323 u32 TargetId :24 ;
324324 u32 Bus :6 ;
325325 u32 Mode :2 ;
326326 /* 2 level target device addr */
327327 union SCSI3Addr Target [2 ];
328- };
328+ } __packed ;
329329
330330struct LogDevAddr {
331331 u32 VolId :30 ;
332332 u32 Mode :2 ;
333333 u8 reserved [4 ];
334- };
334+ } __packed ;
335335
336336union LUNAddr {
337337 u8 LunAddrBytes [8 ];
338338 union SCSI3Addr SCSI3Lun [4 ];
339339 struct PhysDevAddr PhysDev ;
340340 struct LogDevAddr LogDev ;
341- };
341+ } __packed ;
342342
343343struct CommandListHeader {
344344 u8 ReplyQueue ;
345345 u8 SGList ;
346346 __le16 SGTotal ;
347347 __le64 tag ;
348348 union LUNAddr LUN ;
349- };
349+ } __packed ;
350350
351351struct RequestBlock {
352352 u8 CDBLen ;
@@ -365,18 +365,18 @@ struct RequestBlock {
365365#define GET_DIR (tad ) (((tad) >> 6) & 0x03)
366366 u16 Timeout ;
367367 u8 CDB [16 ];
368- };
368+ } __packed ;
369369
370370struct ErrDescriptor {
371371 __le64 Addr ;
372372 __le32 Len ;
373- };
373+ } __packed ;
374374
375375struct SGDescriptor {
376376 __le64 Addr ;
377377 __le32 Len ;
378378 __le32 Ext ;
379- };
379+ } __packed ;
380380
381381union MoreErrInfo {
382382 struct {
@@ -390,15 +390,16 @@ union MoreErrInfo {
390390 u8 offense_num ; /* byte # of offense 0-base */
391391 u32 offense_value ;
392392 } Invalid_Cmd ;
393- };
393+ } __packed ;
394+
394395struct ErrorInfo {
395396 u8 ScsiStatus ;
396397 u8 SenseLen ;
397398 u16 CommandStatus ;
398399 u32 ResidualCnt ;
399400 union MoreErrInfo MoreErrInfo ;
400401 u8 SenseInfo [SENSEINFOBYTES ];
401- };
402+ } __packed ;
402403/* Command types */
403404#define CMD_IOCTL_PEND 0x01
404405#define CMD_SCSI 0x03
@@ -451,7 +452,7 @@ struct CommandList {
451452 bool retry_pending ;
452453 struct hpsa_scsi_dev_t * device ;
453454 atomic_t refcount ; /* Must be last to avoid memset in hpsa_cmd_init() */
454- } __aligned (COMMANDLIST_ALIGNMENT );
455+ } __packed __aligned (COMMANDLIST_ALIGNMENT );
455456
456457/* Max S/G elements in I/O accelerator command */
457458#define IOACCEL1_MAXSGENTRIES 24
@@ -489,7 +490,7 @@ struct io_accel1_cmd {
489490 __le64 host_addr ; /* 0x70 - 0x77 */
490491 u8 CISS_LUN [8 ]; /* 0x78 - 0x7F */
491492 struct SGDescriptor SG [IOACCEL1_MAXSGENTRIES ];
492- } __aligned (IOACCEL1_COMMANDLIST_ALIGNMENT );
493+ } __packed __aligned (IOACCEL1_COMMANDLIST_ALIGNMENT );
493494
494495#define IOACCEL1_FUNCTION_SCSIIO 0x00
495496#define IOACCEL1_SGLOFFSET 32
@@ -519,7 +520,7 @@ struct ioaccel2_sg_element {
519520 u8 chain_indicator ;
520521#define IOACCEL2_CHAIN 0x80
521522#define IOACCEL2_LAST_SG 0x40
522- };
523+ } __packed ;
523524
524525/*
525526 * SCSI Response Format structure for IO Accelerator Mode 2
@@ -559,7 +560,7 @@ struct io_accel2_scsi_response {
559560 u8 sense_data_len ; /* sense/response data length */
560561 u8 resid_cnt [4 ]; /* residual count */
561562 u8 sense_data_buff [32 ]; /* sense/response data buffer */
562- };
563+ } __packed ;
563564
564565/*
565566 * Structure for I/O accelerator (mode 2 or m2) commands.
@@ -592,7 +593,7 @@ struct io_accel2_cmd {
592593 __le32 tweak_upper ; /* Encryption tweak, upper 4 bytes */
593594 struct ioaccel2_sg_element sg [IOACCEL2_MAXSGENTRIES ];
594595 struct io_accel2_scsi_response error_data ;
595- } __aligned (IOACCEL2_COMMANDLIST_ALIGNMENT );
596+ } __packed __aligned (IOACCEL2_COMMANDLIST_ALIGNMENT );
596597
597598/*
598599 * defines for Mode 2 command struct
@@ -618,15 +619,15 @@ struct hpsa_tmf_struct {
618619 __le64 abort_tag ; /* cciss tag of SCSI cmd or TMF to abort */
619620 __le64 error_ptr ; /* Error Pointer */
620621 __le32 error_len ; /* Error Length */
621- } __aligned (IOACCEL2_COMMANDLIST_ALIGNMENT );
622+ } __packed __aligned (IOACCEL2_COMMANDLIST_ALIGNMENT );
622623
623624/* Configuration Table Structure */
624625struct HostWrite {
625626 __le32 TransportRequest ;
626627 __le32 command_pool_addr_hi ;
627628 __le32 CoalIntDelay ;
628629 __le32 CoalIntCount ;
629- };
630+ } __packed ;
630631
631632#define SIMPLE_MODE 0x02
632633#define PERFORMANT_MODE 0x04
@@ -675,7 +676,7 @@ struct CfgTable {
675676#define HPSA_EVENT_NOTIFY_ACCEL_IO_PATH_STATE_CHANGE (1 << 30)
676677#define HPSA_EVENT_NOTIFY_ACCEL_IO_PATH_CONFIG_CHANGE (1 << 31)
677678 __le32 clear_event_notify ;
678- };
679+ } __packed ;
679680
680681#define NUM_BLOCKFETCH_ENTRIES 8
681682struct TransTable_struct {
@@ -686,14 +687,14 @@ struct TransTable_struct {
686687 __le32 RepQCtrAddrHigh32 ;
687688#define MAX_REPLY_QUEUES 64
688689 struct vals32 RepQAddr [MAX_REPLY_QUEUES ];
689- };
690+ } __packed ;
690691
691692struct hpsa_pci_info {
692693 unsigned char bus ;
693694 unsigned char dev_fn ;
694695 unsigned short domain ;
695696 u32 board_id ;
696- };
697+ } __packed ;
697698
698699struct bmic_identify_controller {
699700 u8 configured_logical_drive_count ; /* offset 0 */
@@ -702,7 +703,7 @@ struct bmic_identify_controller {
702703 u8 pad2 [136 ];
703704 u8 controller_mode ; /* offset 292 */
704705 u8 pad3 [32 ];
705- };
706+ } __packed ;
706707
707708
708709struct bmic_identify_physical_device {
@@ -845,7 +846,7 @@ struct bmic_identify_physical_device {
845846 u8 max_link_rate [256 ];
846847 u8 neg_phys_link_rate [256 ];
847848 u8 box_conn_name [8 ];
848- } __attribute((aligned (512 )));
849+ } __packed __attribute((aligned (512 )));
849850
850851struct bmic_sense_subsystem_info {
851852 u8 primary_slot_number ;
@@ -858,7 +859,7 @@ struct bmic_sense_subsystem_info {
858859 u8 secondary_array_serial_number [32 ];
859860 u8 secondary_cache_serial_number [32 ];
860861 u8 pad [332 ];
861- };
862+ } __packed ;
862863
863864struct bmic_sense_storage_box_params {
864865 u8 reserved [36 ];
@@ -870,7 +871,6 @@ struct bmic_sense_storage_box_params {
870871 u8 reserver_3 [84 ];
871872 u8 phys_connector [2 ];
872873 u8 reserved_4 [296 ];
873- };
874+ } __packed ;
874875
875- #pragma pack()
876876#endif /* HPSA_CMD_H */
0 commit comments