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

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
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/genalloc.h> #include <linux/genalloc.h>
#include <asm/dma-types.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/tpi.h> #include <asm/tpi.h>
...@@ -32,7 +33,7 @@ struct ccw1 { ...@@ -32,7 +33,7 @@ struct ccw1 {
__u8 cmd_code; __u8 cmd_code;
__u8 flags; __u8 flags;
__u16 count; __u16 count;
__u32 cda; dma32_t cda;
} __attribute__ ((packed,aligned(8))); } __attribute__ ((packed,aligned(8)));
/** /**
...@@ -152,8 +153,8 @@ struct sublog { ...@@ -152,8 +153,8 @@ struct sublog {
struct esw0 { struct esw0 {
struct sublog sublog; struct sublog sublog;
struct erw erw; struct erw erw;
__u32 faddr[2]; dma32_t faddr[2];
__u32 saddr; dma32_t saddr;
} __attribute__ ((packed)); } __attribute__ ((packed));
/** /**
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/blk_types.h> #include <linux/blk_types.h>
#include <asm/dma-types.h>
struct arqb { struct arqb {
u64 data; u64 data;
...@@ -45,7 +46,7 @@ struct msb { ...@@ -45,7 +46,7 @@ struct msb {
u16:12; u16:12;
u16 bs:4; u16 bs:4;
u32 blk_count; u32 blk_count;
u64 data_addr; dma64_t data_addr;
u64 scm_addr; u64 scm_addr;
u64:64; u64:64;
} __packed; } __packed;
...@@ -54,7 +55,7 @@ struct aidaw { ...@@ -54,7 +55,7 @@ struct aidaw {
u8 flags; u8 flags;
u32 :24; u32 :24;
u32 :32; u32 :32;
u64 data_addr; dma64_t data_addr;
} __packed; } __packed;
#define MSB_OC_CLEAR 0 #define MSB_OC_CLEAR 0
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define _ASM_S390_FCX_H #define _ASM_S390_FCX_H
#include <linux/types.h> #include <linux/types.h>
#include <asm/dma-types.h>
#define TCW_FORMAT_DEFAULT 0 #define TCW_FORMAT_DEFAULT 0
#define TCW_TIDAW_FORMAT_DEFAULT 0 #define TCW_TIDAW_FORMAT_DEFAULT 0
...@@ -43,16 +44,16 @@ struct tcw { ...@@ -43,16 +44,16 @@ struct tcw {
u32 r:1; u32 r:1;
u32 w:1; u32 w:1;
u32 :16; u32 :16;
u64 output; dma64_t output;
u64 input; dma64_t input;
u64 tsb; dma64_t tsb;
u64 tccb; dma64_t tccb;
u32 output_count; u32 output_count;
u32 input_count; u32 input_count;
u32 :32; u32 :32;
u32 :32; u32 :32;
u32 :32; u32 :32;
u32 intrg; dma32_t intrg;
} __attribute__ ((packed, aligned(64))); } __attribute__ ((packed, aligned(64)));
#define TIDAW_FLAGS_LAST (1 << (7 - 0)) #define TIDAW_FLAGS_LAST (1 << (7 - 0))
...@@ -73,7 +74,7 @@ struct tidaw { ...@@ -73,7 +74,7 @@ struct tidaw {
u32 flags:8; u32 flags:8;
u32 :24; u32 :24;
u32 count; u32 count;
u64 addr; dma64_t addr;
} __attribute__ ((packed, aligned(16))); } __attribute__ ((packed, aligned(16)));
/** /**
......
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
#define __QDIO_H__ #define __QDIO_H__
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/cio.h> #include <asm/dma-types.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/cio.h>
/* only use 4 queues to save some cachelines */ /* only use 4 queues to save some cachelines */
#define QDIO_MAX_QUEUES_PER_IRQ 4 #define QDIO_MAX_QUEUES_PER_IRQ 4
...@@ -34,9 +35,9 @@ ...@@ -34,9 +35,9 @@
* @dkey: access key for SLSB * @dkey: access key for SLSB
*/ */
struct qdesfmt0 { struct qdesfmt0 {
u64 sliba; dma64_t sliba;
u64 sla; dma64_t sla;
u64 slsba; dma64_t slsba;
u32 : 32; u32 : 32;
u32 akey : 4; u32 akey : 4;
u32 bkey : 4; u32 bkey : 4;
...@@ -74,7 +75,7 @@ struct qdr { ...@@ -74,7 +75,7 @@ struct qdr {
/* private: */ /* private: */
u32 res[9]; u32 res[9];
/* public: */ /* public: */
u64 qiba; dma64_t qiba;
u32 : 32; u32 : 32;
u32 qkey : 4; u32 qkey : 4;
u32 : 28; u32 : 28;
...@@ -146,7 +147,7 @@ struct qaob { ...@@ -146,7 +147,7 @@ struct qaob {
u8 flags; u8 flags;
u16 cbtbs; u16 cbtbs;
u8 sb_count; 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]; u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER];
u64 user0; u64 user0;
u64 res4[2]; u64 res4[2];
...@@ -208,7 +209,7 @@ struct qdio_buffer_element { ...@@ -208,7 +209,7 @@ struct qdio_buffer_element {
u8 scount; u8 scount;
u8 sflags; u8 sflags;
u32 length; u32 length;
u64 addr; dma64_t addr;
} __attribute__ ((packed, aligned(16))); } __attribute__ ((packed, aligned(16)));
/** /**
...@@ -224,7 +225,7 @@ struct qdio_buffer { ...@@ -224,7 +225,7 @@ struct qdio_buffer {
* @sbal: absolute SBAL address * @sbal: absolute SBAL address
*/ */
struct sl_element { struct sl_element {
u64 sbal; dma64_t sbal;
} __attribute__ ((packed)); } __attribute__ ((packed));
/** /**
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/css_chars.h> #include <asm/css_chars.h>
#include <asm/dma-types.h>
#include <asm/cio.h> #include <asm/cio.h>
/** /**
...@@ -53,7 +54,7 @@ struct cmd_scsw { ...@@ -53,7 +54,7 @@ struct cmd_scsw {
__u32 fctl : 3; __u32 fctl : 3;
__u32 actl : 7; __u32 actl : 7;
__u32 stctl : 5; __u32 stctl : 5;
__u32 cpa; dma32_t cpa;
__u32 dstat : 8; __u32 dstat : 8;
__u32 cstat : 8; __u32 cstat : 8;
__u32 count : 16; __u32 count : 16;
...@@ -93,7 +94,7 @@ struct tm_scsw { ...@@ -93,7 +94,7 @@ struct tm_scsw {
u32 fctl:3; u32 fctl:3;
u32 actl:7; u32 actl:7;
u32 stctl:5; u32 stctl:5;
u32 tcw; dma32_t tcw;
u32 dstat:8; u32 dstat:8;
u32 cstat:8; u32 cstat:8;
u32 fcxs:8; u32 fcxs:8;
...@@ -125,7 +126,7 @@ struct eadm_scsw { ...@@ -125,7 +126,7 @@ struct eadm_scsw {
u32 fctl:3; u32 fctl:3;
u32 actl:7; u32 actl:7;
u32 stctl:5; u32 stctl:5;
u32 aob; dma32_t aob;
u32 dstat:8; u32 dstat:8;
u32 cstat:8; u32 cstat:8;
u32:16; u32:16;
......
...@@ -91,8 +91,8 @@ struct chsc_scssc_area { ...@@ -91,8 +91,8 @@ struct chsc_scssc_area {
u16:16; u16:16;
u32:32; u32:32;
u32:32; u32:32;
u64 summary_indicator_addr; dma64_t summary_indicator_addr;
u64 subchannel_indicator_addr; dma64_t subchannel_indicator_addr;
u32 ks:4; u32 ks:4;
u32 kc:4; u32 kc:4;
u32:21; u32:21;
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
#ifndef S390_ORB_H #ifndef S390_ORB_H
#define S390_ORB_H #define S390_ORB_H
#include <linux/types.h>
#include <asm/dma-types.h>
/* /*
* Command-mode operation request block * Command-mode operation request block
*/ */
...@@ -34,7 +37,7 @@ struct cmd_orb { ...@@ -34,7 +37,7 @@ struct cmd_orb {
u32 ils:1; /* incorrect length */ u32 ils:1; /* incorrect length */
u32 zero:6; /* reserved zeros */ u32 zero:6; /* reserved zeros */
u32 orbx:1; /* ORB extension control */ u32 orbx:1; /* ORB extension control */
u32 cpa; /* channel program address */ dma32_t cpa; /* channel program address */
} __packed __aligned(4); } __packed __aligned(4);
/* /*
...@@ -49,7 +52,7 @@ struct tm_orb { ...@@ -49,7 +52,7 @@ struct tm_orb {
u32 lpm:8; u32 lpm:8;
u32:7; u32:7;
u32 x:1; u32 x:1;
u32 tcw; dma32_t tcw;
u32 prio:8; u32 prio:8;
u32:8; u32:8;
u32 rsvpgm:8; u32 rsvpgm:8;
...@@ -71,7 +74,7 @@ struct eadm_orb { ...@@ -71,7 +74,7 @@ struct eadm_orb {
u32 compat2:1; u32 compat2:1;
u32:21; u32:21;
u32 x:1; u32 x:1;
u32 aob; dma32_t aob;
u32 css_prio:8; u32 css_prio:8;
u32:8; u32:8;
u32 scm_prio:8; u32 scm_prio:8;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment