Commit 1bcf7f48 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390/cio: use bitwise types to allow for type checking



Change types of I/O structure members which contain physical addresses to
dma32_t and dma64_t bitwise types.

This allows to make use of sparse (aka "make C=1") to find incorrect usage
of physical addresses.

Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 8b19e145
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@

#include <linux/bitops.h>
#include <linux/genalloc.h>
#include <asm/dma-types.h>
#include <asm/types.h>
#include <asm/tpi.h>

@@ -32,7 +33,7 @@ struct ccw1 {
	__u8  cmd_code;
	__u8  flags;
	__u16 count;
	__u32 cda;
	dma32_t cda;
} __attribute__ ((packed,aligned(8)));

/**
@@ -152,8 +153,8 @@ struct sublog {
struct esw0 {
	struct sublog sublog;
	struct erw erw;
	__u32  faddr[2];
	__u32  saddr;
	dma32_t faddr[2];
	dma32_t saddr;
} __attribute__ ((packed));

/**
+3 −2
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include <linux/types.h>
#include <linux/device.h>
#include <linux/blk_types.h>
#include <asm/dma-types.h>

struct arqb {
	u64 data;
@@ -45,7 +46,7 @@ struct msb {
	u16:12;
	u16 bs:4;
	u32 blk_count;
	u64 data_addr;
	dma64_t data_addr;
	u64 scm_addr;
	u64:64;
} __packed;
@@ -54,7 +55,7 @@ struct aidaw {
	u8 flags;
	u32 :24;
	u32 :32;
	u64 data_addr;
	dma64_t data_addr;
} __packed;

#define MSB_OC_CLEAR	0
+7 −6
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#define _ASM_S390_FCX_H

#include <linux/types.h>
#include <asm/dma-types.h>

#define TCW_FORMAT_DEFAULT		0
#define TCW_TIDAW_FORMAT_DEFAULT	0
@@ -43,16 +44,16 @@ struct tcw {
	u32 r:1;
	u32 w:1;
	u32 :16;
	u64 output;
	u64 input;
	u64 tsb;
	u64 tccb;
	dma64_t output;
	dma64_t input;
	dma64_t tsb;
	dma64_t tccb;
	u32 output_count;
	u32 input_count;
	u32 :32;
	u32 :32;
	u32 :32;
	u32 intrg;
	dma32_t intrg;
} __attribute__ ((packed, aligned(64)));

#define TIDAW_FLAGS_LAST		(1 << (7 - 0))
@@ -73,7 +74,7 @@ struct tidaw {
	u32 flags:8;
	u32 :24;
	u32 count;
	u64 addr;
	dma64_t addr;
} __attribute__ ((packed, aligned(16)));

/**
+9 −8
Original line number Diff line number Diff line
@@ -9,8 +9,9 @@
#define __QDIO_H__

#include <linux/interrupt.h>
#include <asm/cio.h>
#include <asm/dma-types.h>
#include <asm/ccwdev.h>
#include <asm/cio.h>

/* only use 4 queues to save some cachelines */
#define QDIO_MAX_QUEUES_PER_IRQ		4
@@ -34,9 +35,9 @@
 * @dkey: access key for SLSB
 */
struct qdesfmt0 {
	u64 sliba;
	u64 sla;
	u64 slsba;
	dma64_t sliba;
	dma64_t sla;
	dma64_t slsba;
	u32	 : 32;
	u32 akey : 4;
	u32 bkey : 4;
@@ -74,7 +75,7 @@ struct qdr {
	/* private: */
	u32 res[9];
	/* public: */
	u64 qiba;
	dma64_t qiba;
	u32	   : 32;
	u32 qkey   : 4;
	u32	   : 28;
@@ -146,7 +147,7 @@ struct qaob {
	u8 flags;
	u16 cbtbs;
	u8 sb_count;
	u64 sba[QDIO_MAX_ELEMENTS_PER_BUFFER];
	dma64_t sba[QDIO_MAX_ELEMENTS_PER_BUFFER];
	u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER];
	u64 user0;
	u64 res4[2];
@@ -208,7 +209,7 @@ struct qdio_buffer_element {
	u8 scount;
	u8 sflags;
	u32 length;
	u64 addr;
	dma64_t addr;
} __attribute__ ((packed, aligned(16)));

/**
@@ -224,7 +225,7 @@ struct qdio_buffer {
 * @sbal: absolute SBAL address
 */
struct sl_element {
	u64 sbal;
	dma64_t sbal;
} __attribute__ ((packed));

/**
+4 −3
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@

#include <linux/types.h>
#include <asm/css_chars.h>
#include <asm/dma-types.h>
#include <asm/cio.h>

/**
@@ -53,7 +54,7 @@ struct cmd_scsw {
	__u32 fctl : 3;
	__u32 actl : 7;
	__u32 stctl : 5;
	__u32 cpa;
	dma32_t cpa;
	__u32 dstat : 8;
	__u32 cstat : 8;
	__u32 count : 16;
@@ -93,7 +94,7 @@ struct tm_scsw {
	u32 fctl:3;
	u32 actl:7;
	u32 stctl:5;
	u32 tcw;
	dma32_t tcw;
	u32 dstat:8;
	u32 cstat:8;
	u32 fcxs:8;
@@ -125,7 +126,7 @@ struct eadm_scsw {
	u32 fctl:3;
	u32 actl:7;
	u32 stctl:5;
	u32 aob;
	dma32_t aob;
	u32 dstat:8;
	u32 cstat:8;
	u32:16;
Loading