2005-04-16 18:20:36 -04:00
|
|
|
#ifndef S390_CIO_IOASM_H
|
|
|
|
#define S390_CIO_IOASM_H
|
|
|
|
|
2007-04-27 10:01:31 -04:00
|
|
|
#include <asm/chpid.h>
|
2006-01-06 03:19:21 -05:00
|
|
|
#include "schid.h"
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
/*
|
|
|
|
* TPI info structure
|
|
|
|
*/
|
|
|
|
struct tpi_info {
|
2006-01-06 03:19:21 -05:00
|
|
|
struct subchannel_id schid;
|
2005-04-16 18:20:36 -04:00
|
|
|
__u32 intparm; /* interruption parameter */
|
|
|
|
__u32 adapter_IO : 1;
|
|
|
|
__u32 reserved2 : 1;
|
|
|
|
__u32 isc : 3;
|
|
|
|
__u32 reserved3 : 12;
|
|
|
|
__u32 int_type : 3;
|
|
|
|
__u32 reserved4 : 12;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some S390 specific IO instructions as inline
|
|
|
|
*/
|
|
|
|
|
2006-01-06 03:19:21 -05:00
|
|
|
static inline int stsch(struct subchannel_id schid,
|
|
|
|
volatile struct schib *addr)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2006-09-28 10:56:43 -04:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
2005-04-16 18:20:36 -04:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" stsch 0(%2)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
|
|
|
: "=d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2006-01-06 03:19:25 -05:00
|
|
|
static inline int stsch_err(struct subchannel_id schid,
|
|
|
|
volatile struct schib *addr)
|
|
|
|
{
|
2006-09-28 10:56:43 -04:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
|
|
|
int ccode = -EIO;
|
2006-01-06 03:19:25 -05:00
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" stsch 0(%2)\n"
|
|
|
|
"0: ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2006-01-06 03:19:25 -05:00
|
|
|
"1:\n"
|
2006-09-28 10:56:43 -04:00
|
|
|
EX_TABLE(0b,1b)
|
|
|
|
: "+d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc");
|
2006-01-06 03:19:25 -05:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2006-01-06 03:19:21 -05:00
|
|
|
static inline int msch(struct subchannel_id schid,
|
|
|
|
volatile struct schib *addr)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2006-09-28 10:56:43 -04:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
2005-04-16 18:20:36 -04:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" msch 0(%2)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
|
|
|
: "=d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2006-01-06 03:19:21 -05:00
|
|
|
static inline int msch_err(struct subchannel_id schid,
|
|
|
|
volatile struct schib *addr)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2006-09-28 10:56:43 -04:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
|
|
|
int ccode = -EIO;
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" msch 0(%2)\n"
|
|
|
|
"0: ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2005-04-16 18:20:36 -04:00
|
|
|
"1:\n"
|
2006-09-28 10:56:43 -04:00
|
|
|
EX_TABLE(0b,1b)
|
|
|
|
: "+d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2006-01-06 03:19:21 -05:00
|
|
|
static inline int tsch(struct subchannel_id schid,
|
|
|
|
volatile struct irb *addr)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2006-09-28 10:56:43 -04:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
2005-04-16 18:20:36 -04:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" tsch 0(%2)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
|
|
|
: "=d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2005-09-03 18:58:01 -04:00
|
|
|
static inline int tpi( volatile struct tpi_info *addr)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" tpi 0(%1)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
|
|
|
: "=d" (ccode) : "a" (addr), "m" (*addr) : "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2005-09-03 18:58:01 -04:00
|
|
|
static inline int chsc(void *chsc_area)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2006-01-06 03:19:21 -05:00
|
|
|
typedef struct { char _[4096]; } addr_type;
|
2005-04-16 18:20:36 -04:00
|
|
|
int cc;
|
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" .insn rre,0xb25f0000,%2,0\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2006-01-06 03:19:21 -05:00
|
|
|
: "=d" (cc), "=m" (*(addr_type *) chsc_area)
|
|
|
|
: "d" (chsc_area), "m" (*(addr_type *) chsc_area)
|
2006-09-28 10:56:43 -04:00
|
|
|
: "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
2007-04-27 10:01:26 -04:00
|
|
|
static inline int rchp(struct chp_id chpid)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2007-04-27 10:01:26 -04:00
|
|
|
register struct chp_id reg1 asm ("1") = chpid;
|
2005-04-16 18:20:36 -04:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 10:56:43 -04:00
|
|
|
asm volatile(
|
|
|
|
" lr 1,%1\n"
|
|
|
|
" rchp\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
|
|
|
: "=d" (ccode) : "d" (reg1) : "cc");
|
2005-04-16 18:20:36 -04:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|