summaryrefslogtreecommitdiffstats
path: root/include/asm-s390/irq.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-03-09 20:33:35 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-03-09 20:33:35 +0000
commit116674acc97ba75a720329996877077d988443a2 (patch)
tree6a3f2ff0b612ae2ee8a3f3509370c9e6333a53b3 /include/asm-s390/irq.h
parent71118c319fcae4a138f16e35b4f7e0a6d53ce2ca (diff)
Merge with Linux 2.4.2.
Diffstat (limited to 'include/asm-s390/irq.h')
-rw-r--r--include/asm-s390/irq.h290
1 files changed, 232 insertions, 58 deletions
diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h
index 5efcdd40b..9849d6fdc 100644
--- a/include/asm-s390/irq.h
+++ b/include/asm-s390/irq.h
@@ -1,15 +1,8 @@
-/*
- * arch/s390/kernel/s390io.h
- *
- * S390 version
- * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Ingo Adlung (adlung@de.ibm.com)
- */
-
#ifndef __irq_h
#define __irq_h
#include <linux/config.h>
+#ifdef __KERNEL__
#include <asm/hardirq.h>
/*
@@ -18,6 +11,8 @@
#define __MAX_SUBCHANNELS 65536
#define NR_IRQS __MAX_SUBCHANNELS
+#define LPM_ANYPATH 0xff /* doesn't really belong here, Ingo? */
+
#define INVALID_STORAGE_AREA ((void *)(-1 - 0x3FFF ))
extern int disable_irq(unsigned int);
@@ -50,7 +45,8 @@ struct hw_interrupt_type {
*/
typedef struct {
__u32 intparm; /* interruption parameter */
- __u32 res0 : 2; /* reserved zeros */
+ __u32 qf : 1; /* qdio facility */
+ __u32 res0 : 1; /* reserved zeros */
__u32 isc : 3; /* interruption sublass */
__u32 res5 : 3; /* reserved zeros */
__u32 ena : 1; /* enabled */
@@ -77,6 +73,7 @@ typedef struct {
/* ... in an operand exception. */
} __attribute__ ((packed)) pmcw_t;
+#endif /* __KERNEL__ */
/*
* subchannel status word
*/
@@ -89,7 +86,7 @@ typedef struct {
__u32 pfch : 1; /* prefetch */
__u32 isic : 1; /* initial-status interruption control */
__u32 alcc : 1; /* address-limit checking control */
- __u32 ssi : 1; /* supress-suspended interruption */
+ __u32 ssi : 1; /* suppress-suspended interruption */
__u32 zcc : 1; /* zero condition code */
__u32 ectl : 1; /* extended control */
__u32 pno : 1; /* path not operational */
@@ -140,6 +137,44 @@ typedef struct {
#define SCHN_STAT_CHAIN_CHECK 0x01
/*
+ * architectured values for first sense byte
+ */
+#define SNS0_CMD_REJECT 0x80
+#define SNS_CMD_REJECT SNS0_CMD_REJECT
+#define SNS0_INTERVENTION_REQ 0x40
+#define SNS0_BUS_OUT_CHECK 0x20
+#define SNS0_EQUIPMENT_CHECK 0x10
+#define SNS0_DATA_CHECK 0x08
+#define SNS0_OVERRUN 0x04
+/* 0x02 reserved */
+#define SNS0_INCOMPL_DOMAIN 0x01
+
+/*
+ * architectured values for second sense byte
+ */
+#define SNS1_PERM_ERR 0x80
+#define SNS1_INV_TRACK_FORMAT 0x40
+#define SNS1_EOC 0x20
+#define SNS1_MESSAGE_TO_OPER 0x10
+#define SNS1_NO_REC_FOUND 0x08
+#define SNS1_FILE_PROTECTED 0x04
+#define SNS1_WRITE_INHIBITED 0x02
+#define SNS1_INPRECISE_END 0x01
+
+/*
+ * architectured values for third sense byte
+ */
+#define SNS2_REQ_INH_WRITE 0x80
+#define SNS2_CORRECTABLE 0x40
+#define SNS2_FIRST_LOG_ERR 0x20
+#define SNS2_ENV_DATA_PRESENT 0x10
+/* 0x08 reserved */
+#define SNS2_INPRECISE_END 0x04
+/* 0x02 reserved */
+/* 0x01 reserved */
+
+#ifdef __KERNEL__
+/*
* subchannel information block
*/
typedef struct {
@@ -147,13 +182,14 @@ typedef struct {
scsw_t scsw; /* subchannel status word */
__u8 mda[12]; /* model dependent area */
} __attribute__ ((packed,aligned(4))) schib_t;
+#endif /* __KERNEL__ */
typedef struct {
__u8 cmd_code;/* command code */
- __u8 flags; /* flags, like IDA adressing, etc. */
+ __u8 flags; /* flags, like IDA addressing, etc. */
__u16 count; /* byte count */
__u32 cda; /* data address */
- } ccw1_t __attribute__ ((packed,aligned(8)));
+ } __attribute__ ((packed,aligned(8))) ccw1_t;
#define CCW_FLAG_DC 0x80
#define CCW_FLAG_CC 0x40
@@ -168,10 +204,13 @@ typedef struct {
#define CCW_CMD_BASIC_SENSE 0x04
#define CCW_CMD_TIC 0x08
#define CCW_CMD_SENSE_PGID 0x34
+#define CCW_CMD_SUSPEND_RECONN 0x5B
#define CCW_CMD_RDC 0x64
#define CCW_CMD_SET_PGID 0xAF
#define CCW_CMD_SENSE_ID 0xE4
+#define CCW_CMD_DCTL 0xF3
+#ifdef __KERNEL__
#define SENSE_MAX_COUNT 0x20
/*
@@ -192,19 +231,25 @@ typedef struct {
__u32 intparm; /* interruption parameter */
__u32 key : 4; /* flags, like key, suspend control, etc. */
__u32 spnd : 1; /* suspend control */
- __u32 res1 : 3; /* reserved */
+ __u32 res1 : 1; /* reserved */
+ __u32 mod : 1; /* modification control */
+ __u32 sync : 1; /* synchronize control */
__u32 fmt : 1; /* format control */
__u32 pfch : 1; /* prefetch control */
__u32 isic : 1; /* initial-status-interruption control */
__u32 alcc : 1; /* address-limit-checking control */
__u32 ssic : 1; /* suppress-suspended-interr. control */
- __u32 res2 : 3; /* reserved */
+ __u32 res2 : 1; /* reserved */
+ __u32 c64 : 1; /* IDAW/QDIO 64 bit control */
+ __u32 i2k : 1; /* IDAW 2/4kB block size control */
__u32 lpm : 8; /* logical path mask */
__u32 ils : 1; /* incorrect length */
- __u32 zero : 7; /* reserved zeros */
+ __u32 zero : 6; /* reserved zeros */
+ __u32 orbx : 1; /* ORB extension control */
__u32 cpa; /* channel program address */
} __attribute__ ((packed,aligned(4))) orb_t;
+#endif /* __KERNEL__ */
typedef struct {
__u32 res0 : 4; /* reserved */
__u32 pvrf : 1; /* path-verification-required flag */
@@ -249,7 +294,7 @@ typedef struct {
typedef struct {
__u8 zero0; /* reserved zeros */
__u8 lpum; /* last path used mask */
- __u8 zero16; /* reserved zeros */
+ __u16 zero16; /* reserved zeros */
erw_t erw; /* extended report word */
__u32 zeros[3]; /* 2 fullwords of zeros */
} __attribute__ ((packed)) esw1_t;
@@ -291,30 +336,24 @@ typedef struct {
esw_t esw; /* extended status word */
__u8 ecw[32]; /* extended control word */
} irb_t __attribute__ ((packed,aligned(4)));
+#ifdef __KERNEL__
/*
* TPI info structure
*/
typedef struct {
- __u32 res : 16; /* reserved 0x00000001 */
- __u32 irq : 16; /* aka. subchannel number */
- __u32 intparm; /* interruption parameter */
+ __u32 reserved1 : 16; /* reserved 0x00000001 */
+ __u32 irq : 16; /* aka. subchannel number */
+ __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)) tpi_info_t;
-/*
- * This is the "IRQ descriptor", which contains various information
- * about the irq, including what kind of hardware handling it has,
- * whether it is disabled etc etc.
- *
- * Pad this out to 32 bytes for cache and indexing reasons.
- */
-typedef struct {
- __u32 status; /* IRQ status - IRQ_INPROGRESS, IRQ_DISABLED */
- struct hw_interrupt_type *handler; /* handle/enable/disable functions */
- struct irqaction *action; /* IRQ action list */
- } irq_desc_t;
-
//
// command information word (CIW) layout
//
@@ -330,6 +369,7 @@ typedef struct _ciw {
#define CIW_TYPE_SII 0x1 // set interface identifier
#define CIW_TYPE_RNI 0x2 // read node identifier
+#define MAX_CIWS 8
//
// sense-id response buffer layout
//
@@ -342,9 +382,10 @@ typedef struct {
__u8 dev_model; /* device model */
__u8 unused; /* padding byte */
/* extended part */
- ciw_t ciw[62]; /* variable # of CIWs */
+ ciw_t ciw[MAX_CIWS]; /* variable # of CIWs */
} __attribute__ ((packed,aligned(4))) senseid_t;
+#endif /* __KERNEL__ */
/*
* sense data
*/
@@ -363,7 +404,7 @@ typedef struct {
*/
typedef struct {
__u16 devno; /* device number, aka. "cuu" from irb */
- unsigned int intparm; /* interrupt parameter */
+ unsigned long intparm; /* interrupt parameter */
__u8 cstat; /* channel status - accumulated */
__u8 dstat; /* device status - accumulated */
__u8 lpum; /* last path used mask from irb */
@@ -387,9 +428,53 @@ typedef struct {
#define DEVSTAT_DEVICE_GONE 0x00000040
#define DEVSTAT_DEVICE_OWNED 0x00000080
#define DEVSTAT_CLEAR_FUNCTION 0x00000100
+#define DEVSTAT_PCI 0x00000200
+#define DEVSTAT_SUSPENDED 0x00000400
+#define DEVSTAT_UNKNOWN_DEV 0x00000800
#define DEVSTAT_FINAL_STATUS 0x80000000
+#define DEVINFO_NOT_OPER DEVSTAT_NOT_OPER
+#define DEVINFO_UNKNOWN_DEV DEVSTAT_UNKNOWN_DEV
+#define DEVINFO_DEVICE_OWNED DEVSTAT_DEVICE_OWNED
+#define DEVINFO_QDIO_CAPABLE 0x40000000
+
#define INTPARM_STATUS_PENDING 0xFFFFFFFF
+#ifdef __KERNEL__
+
+#define IO_INTERRUPT_TYPE 0 /* I/O interrupt type */
+
+typedef void (* io_handler_func1_t) ( int irq,
+ devstat_t *devstat,
+ struct pt_regs *rgs);
+
+typedef void (* io_handler_func_t) ( int irq,
+ void *devstat,
+ struct pt_regs *rgs);
+
+typedef void ( * not_oper_handler_func_t)( int irq,
+ int status );
+
+typedef int (* adapter_int_handler_t)( __u32 intparm );
+
+struct s390_irqaction {
+ io_handler_func_t handler;
+ unsigned long flags;
+ const char *name;
+ devstat_t *dev_id;
+};
+
+/*
+ * This is the "IRQ descriptor", which contains various information
+ * about the irq, including what kind of hardware handling it has,
+ * whether it is disabled etc etc.
+ *
+ * Pad this out to 32 bytes for cache and indexing reasons.
+ */
+typedef struct {
+ unsigned int status; /* IRQ status - IRQ_INPROGRESS, IRQ_DISABLED */
+ struct hw_interrupt_type *handler; /* handle/enable/disable functions */
+ struct s390_irqaction *action; /* IRQ action list */
+ } irq_desc_t;
typedef struct {
__u8 state1 : 2; /* path state value 1 */
@@ -409,36 +494,39 @@ typedef struct {
__u32 tod_high; /* high word TOD clock */
} __attribute__ ((packed)) pgid_t;
+#define SPID_FUNC_SINGLE_PATH 0x00
#define SPID_FUNC_MULTI_PATH 0x80
#define SPID_FUNC_ESTABLISH 0x00
#define SPID_FUNC_RESIGN 0x40
#define SPID_FUNC_DISBAND 0x20
-#define SNID_STATE1_RESET 0x0
-#define SNID_STATE1_UNGROUPED 0x8
-#define SNID_STATE1_GROUPED 0xC
+#define SNID_STATE1_RESET 0
+#define SNID_STATE1_UNGROUPED 2
+#define SNID_STATE1_GROUPED 3
-#define SNID_STATE2_NOT_RESVD 0x0
-#define SNID_STATE2_RESVD_ELSE 0x8
-#define SNID_STATE2_RESVD_SELF 0xC
+#define SNID_STATE2_NOT_RESVD 0
+#define SNID_STATE2_RESVD_ELSE 2
+#define SNID_STATE2_RESVD_SELF 3
#define SNID_STATE3_MULTI_PATH 1
+#define SNID_STATE3_SINGLE_PATH 0
/*
* Flags used as input parameters for do_IO()
*/
-#define DOIO_EARLY_NOTIFICATION 0x01 /* allow for I/O completion ... */
+#define DOIO_EARLY_NOTIFICATION 0x0001 /* allow for I/O completion ... */
/* ... notification after ... */
/* ... primary interrupt status */
-#define DOIO_RETURN_CHAN_END DOIO_EARLY_NOTIFICATION
-#define DOIO_VALID_LPM 0x02 /* LPM input parameter is valid */
-#define DOIO_WAIT_FOR_INTERRUPT 0x04 /* wait synchronously for interrupt */
-#define DOIO_REPORT_ALL 0x08 /* report all interrupt conditions */
-#define DOIO_ALLOW_SUSPEND 0x10 /* allow for channel prog. suspend */
-#define DOIO_DENY_PREFETCH 0x20 /* don't allow for CCW prefetch */
-#define DOIO_SUPPRESS_INTER 0x40 /* suppress intermediate inter. */
+#define DOIO_RETURN_CHAN_END DOIO_EARLY_NOTIFICATION
+#define DOIO_VALID_LPM 0x0002 /* LPM input parameter is valid */
+#define DOIO_WAIT_FOR_INTERRUPT 0x0004 /* wait synchronously for interrupt */
+#define DOIO_REPORT_ALL 0x0008 /* report all interrupt conditions */
+#define DOIO_ALLOW_SUSPEND 0x0010 /* allow for channel prog. suspend */
+#define DOIO_DENY_PREFETCH 0x0020 /* don't allow for CCW prefetch */
+#define DOIO_SUPPRESS_INTER 0x0040 /* suppress intermediate inter. */
/* ... for suspended CCWs */
-#define DOIO_TIMEOUT 0x80 /* 3 secs. timeout for sync. I/O */
+#define DOIO_TIMEOUT 0x0080 /* 3 secs. timeout for sync. I/O */
+#define DOIO_DONT_CALL_INTHDLR 0x0100 /* don't call interrupt handler */
/*
* do_IO()
@@ -464,7 +552,7 @@ int do_IO( int irq, /* IRQ aka. subchannel number */
int start_IO( int irq, /* IRQ aka. subchannel number */
ccw1_t *cpa, /* logical channel program address */
- unsigned int intparm, /* interruption parameter */
+ unsigned long intparm, /* interruption parameter */
__u8 lpm, /* logical path mask */
unsigned int flag); /* flags : see above */
@@ -493,12 +581,12 @@ typedef struct {
__u16 devno; /* device number */
unsigned int status; /* device status */
senseid_t sid_data; /* senseID data */
- } dev_info_t;
+ } s390_dev_info_t;
-int get_dev_info( int irq, dev_info_t *); /* to be eliminated - don't use */
+int get_dev_info( int irq, s390_dev_info_t *); /* to be eliminated - don't use */
-int get_dev_info_by_irq ( int irq, dev_info_t *pdi);
-int get_dev_info_by_devno( __u16 devno, dev_info_t *pdi);
+int get_dev_info_by_irq ( int irq, s390_dev_info_t *pdi);
+int get_dev_info_by_devno( __u16 devno, s390_dev_info_t *pdi);
int get_irq_by_devno( __u16 devno );
unsigned int get_devno_by_irq( int irq );
@@ -507,7 +595,16 @@ int get_irq_first( void );
int get_irq_next ( int irq );
int read_dev_chars( int irq, void **buffer, int length );
-int read_conf_data( int irq, void **buffer, int *length );
+int read_conf_data( int irq, void **buffer, int *length, __u8 lpm );
+
+int s390_DevicePathVerification( int irq, __u8 domask );
+
+int s390_request_irq_special( int irq,
+ io_handler_func_t io_handler,
+ not_oper_handler_func_t not_oper_handler,
+ unsigned long irqflags,
+ const char *devname,
+ void *dev_id);
extern int handle_IRQ_event( unsigned int irq, int cpu, struct pt_regs *);
@@ -524,7 +621,11 @@ extern __inline__ int stsch(int irq, volatile schib_t *addr)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"STSCH 0(%2)\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -538,7 +639,11 @@ extern __inline__ int msch(int irq, volatile schib_t *addr)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"MSCH 0(%2)\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -552,6 +657,21 @@ extern __inline__ int msch_err(int irq, volatile schib_t *addr)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ " lgr 1,%1\n"
+ " msch 0(%2)\n"
+ "0: ipm %0\n"
+ " srl %0,28\n"
+ "1:\n"
+ ".section .fixup,\"ax\"\n"
+ "2: l %0,%3\n"
+ " jg 1b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 8\n"
+ " .quad 0b,2b\n"
+ ".previous"
+#else
" lr 1,%1\n"
" msch 0(%2)\n"
"0: ipm %0\n"
@@ -568,6 +688,7 @@ extern __inline__ int msch_err(int irq, volatile schib_t *addr)
" .align 4\n"
" .long 0b,2b\n"
".previous"
+#endif
: "=d" (ccode)
: "r" (irq | 0x10000L), "a" (addr), "i" (__LC_PGM_ILC)
: "cc", "1" );
@@ -579,7 +700,11 @@ extern __inline__ int tsch(int irq, volatile irb_t *addr)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"TSCH 0(%2)\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -606,7 +731,11 @@ extern __inline__ int ssch(int irq, volatile orb_t *addr)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"SSCH 0(%2)\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -620,7 +749,11 @@ extern __inline__ int rsch(int irq)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"RSCH\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -634,7 +767,11 @@ extern __inline__ int csch(int irq)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"CSCH\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -648,7 +785,11 @@ extern __inline__ int hsch(int irq)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
"LR 1,%1\n\t"
+#endif
"HSCH\n\t"
"IPM %0\n\t"
"SRL %0,28\n\t"
@@ -669,6 +810,24 @@ extern __inline__ int iac( void)
return ccode;
}
+extern __inline__ int rchp(int chpid)
+{
+ int ccode;
+
+ __asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "LGR 1,%1\n\t"
+#else
+ "LR 1,%1\n\t"
+#endif
+ "RCHP\n\t"
+ "IPM %0\n\t"
+ "SRL %0,28\n\t"
+ : "=d" (ccode) : "r" (chpid)
+ : "cc", "1" );
+ return ccode;
+}
+
typedef struct {
__u16 vrdcdvno : 16; /* device number (input) */
__u16 vrdclen : 16; /* data block length (input) */
@@ -690,12 +849,18 @@ extern __inline__ int diag210( diag210_t * addr)
int ccode;
__asm__ __volatile__(
+#ifdef CONFIG_ARCH_S390X
+ "SAM31\n\t"
+ "DIAG %1,0,0x210\n\t"
+ "SAM64\n\t"
+#else
"LR 1,%1\n\t"
".long 0x83110210\n\t"
+#endif
"IPM %0\n\t"
"SRL %0,28\n\t"
: "=d" (ccode) : "a" (addr)
- : "cc", "1" );
+ : "cc" );
return ccode;
}
@@ -720,9 +885,15 @@ extern spinlock_t irq_controller_lock;
static inline void irq_enter(int cpu, unsigned int irq)
{
hardirq_enter(cpu);
+#ifdef CONFIG_ARCH_S390X
+ while (atomic_read(&global_irq_lock) != 0) {
+ eieio();
+ }
+#else
while (test_bit(0,&global_irq_lock)) {
eieio();
}
+#endif
}
static inline void irq_exit(int cpu, unsigned int irq)
@@ -754,10 +925,13 @@ static inline void irq_exit(int cpu, unsigned int irq)
* x86 profiling function, SMP safe. We might want to do this in
* assembly totally?
*/
+extern char _stext;
static inline void s390_do_profile (unsigned long addr)
{
-#if 0
if (prof_buffer && current->pid) {
+#ifndef CONFIG_ARCH_S390X
+ addr &= 0x7fffffff;
+#endif
addr -= (unsigned long) &_stext;
addr >>= prof_shift;
/*
@@ -769,7 +943,6 @@ static inline void s390_do_profile (unsigned long addr)
addr = prof_len-1;
atomic_inc((atomic_t *)&prof_buffer[addr]);
}
-#endif
}
#include <asm/s390io.h>
@@ -784,5 +957,6 @@ static inline void s390_do_profile (unsigned long addr)
spin_lock_irqsave(&(ioinfo[irq]->irq_lock), flags)
#define s390irq_spin_unlock_irqrestore(irq,flags) \
spin_unlock_irqrestore(&(ioinfo[irq]->irq_lock), flags)
+#endif /* __KERNEL__ */
#endif