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