xref: /openbmc/linux/drivers/scsi/qla2xxx/qla_dsd.h (revision 8f762fe5)
1 #ifndef _QLA_DSD_H_
2 #define _QLA_DSD_H_
3 
4 /* 32-bit data segment descriptor (8 bytes) */
5 struct dsd32 {
6 	__le32 address;
7 	__le32 length;
8 };
9 
10 static inline void append_dsd32(struct dsd32 **dsd, struct scatterlist *sg)
11 {
12 	put_unaligned_le32(sg_dma_address(sg), &(*dsd)->address);
13 	put_unaligned_le32(sg_dma_len(sg),     &(*dsd)->length);
14 	(*dsd)++;
15 }
16 
17 /* 64-bit data segment descriptor (12 bytes) */
18 struct dsd64 {
19 	__le64 address;
20 	__le32 length;
21 } __packed;
22 
23 static inline void append_dsd64(struct dsd64 **dsd, struct scatterlist *sg)
24 {
25 	put_unaligned_le64(sg_dma_address(sg), &(*dsd)->address);
26 	put_unaligned_le32(sg_dma_len(sg),     &(*dsd)->length);
27 	(*dsd)++;
28 }
29 
30 #endif
31