2005-04-16 15:20:36 -07:00
|
|
|
#ifndef S390_CIO_IOASM_H
|
|
|
|
#define S390_CIO_IOASM_H
|
|
|
|
|
2007-04-27 07:01:31 -07:00
|
|
|
#include <asm/chpid.h>
|
2008-07-14 00:59:05 -07:00
|
|
|
#include <asm/schid.h>
|
2006-01-06 01:19:21 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
* TPI info structure
|
|
|
|
*/
|
|
|
|
struct tpi_info {
|
2006-01-06 01:19:21 -07:00
|
|
|
struct subchannel_id schid;
|
2005-04-16 15:20:36 -07: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
|
|
|
|
*/
|
|
|
|
|
2008-10-10 12:33:15 -07:00
|
|
|
static inline int stsch(struct subchannel_id schid, struct schib *addr)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
2005-04-16 15:20:36 -07:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
2008-10-10 12:33:15 -07:00
|
|
|
" stsch 0(%3)\n"
|
2006-09-28 07:56:43 -07:00
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
2008-10-10 12:33:15 -07:00
|
|
|
: "=d" (ccode), "=m" (*addr)
|
|
|
|
: "d" (reg1), "a" (addr)
|
|
|
|
: "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2008-10-10 12:33:15 -07:00
|
|
|
static inline int stsch_err(struct subchannel_id schid, struct schib *addr)
|
2006-01-06 01:19:25 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
|
|
|
int ccode = -EIO;
|
2006-01-06 01:19:25 -07:00
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
2008-10-10 12:33:15 -07:00
|
|
|
" stsch 0(%3)\n"
|
2006-09-28 07:56:43 -07:00
|
|
|
"0: ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2006-01-06 01:19:25 -07:00
|
|
|
"1:\n"
|
2006-09-28 07:56:43 -07:00
|
|
|
EX_TABLE(0b,1b)
|
2008-10-10 12:33:15 -07:00
|
|
|
: "+d" (ccode), "=m" (*addr)
|
|
|
|
: "d" (reg1), "a" (addr)
|
|
|
|
: "cc");
|
2006-01-06 01:19:25 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2008-10-10 12:33:15 -07:00
|
|
|
static inline int msch(struct subchannel_id schid, struct schib *addr)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
2005-04-16 15:20:36 -07:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
|
|
|
" msch 0(%2)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
2008-10-10 12:33:15 -07:00
|
|
|
: "=d" (ccode)
|
|
|
|
: "d" (reg1), "a" (addr), "m" (*addr)
|
|
|
|
: "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2008-10-10 12:33:15 -07:00
|
|
|
static inline int msch_err(struct subchannel_id schid, struct schib *addr)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
|
|
|
int ccode = -EIO;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
|
|
|
" msch 0(%2)\n"
|
|
|
|
"0: ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2005-04-16 15:20:36 -07:00
|
|
|
"1:\n"
|
2006-09-28 07:56:43 -07:00
|
|
|
EX_TABLE(0b,1b)
|
2008-10-10 12:33:15 -07:00
|
|
|
: "+d" (ccode)
|
|
|
|
: "d" (reg1), "a" (addr), "m" (*addr)
|
|
|
|
: "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2008-10-10 12:33:15 -07:00
|
|
|
static inline int tsch(struct subchannel_id schid, struct irb *addr)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register struct subchannel_id reg1 asm ("1") = schid;
|
2005-04-16 15:20:36 -07:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
2008-10-10 12:33:15 -07:00
|
|
|
" tsch 0(%3)\n"
|
2006-09-28 07:56:43 -07:00
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
2008-10-10 12:33:15 -07:00
|
|
|
: "=d" (ccode), "=m" (*addr)
|
|
|
|
: "d" (reg1), "a" (addr)
|
|
|
|
: "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2008-10-10 12:33:15 -07:00
|
|
|
static inline int tpi(struct tpi_info *addr)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
2008-10-10 12:33:15 -07:00
|
|
|
" tpi 0(%2)\n"
|
2006-09-28 07:56:43 -07:00
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
2008-10-10 12:33:15 -07:00
|
|
|
: "=d" (ccode), "=m" (*addr)
|
|
|
|
: "a" (addr)
|
|
|
|
: "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
2005-09-03 15:58:01 -07:00
|
|
|
static inline int chsc(void *chsc_area)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-01-06 01:19:21 -07:00
|
|
|
typedef struct { char _[4096]; } addr_type;
|
2005-04-16 15:20:36 -07:00
|
|
|
int cc;
|
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
|
|
|
" .insn rre,0xb25f0000,%2,0\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2006-01-06 01:19:21 -07:00
|
|
|
: "=d" (cc), "=m" (*(addr_type *) chsc_area)
|
|
|
|
: "d" (chsc_area), "m" (*(addr_type *) chsc_area)
|
2006-09-28 07:56:43 -07:00
|
|
|
: "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
2007-04-27 07:01:26 -07:00
|
|
|
static inline int rchp(struct chp_id chpid)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2007-04-27 07:01:26 -07:00
|
|
|
register struct chp_id reg1 asm ("1") = chpid;
|
2005-04-16 15:20:36 -07:00
|
|
|
int ccode;
|
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
|
|
|
" lr 1,%1\n"
|
|
|
|
" rchp\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28"
|
|
|
|
: "=d" (ccode) : "d" (reg1) : "cc");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|