2005-04-16 22:20:36 +00:00
|
|
|
#ifndef S390_CIO_H
|
|
|
|
#define S390_CIO_H
|
|
|
|
|
2006-07-12 14:39:50 +00:00
|
|
|
#include <linux/mutex.h>
|
2007-04-27 14:01:31 +00:00
|
|
|
#include <linux/device.h>
|
2008-07-14 07:58:44 +00:00
|
|
|
#include <linux/mod_devicetable.h>
|
2007-04-27 14:01:35 +00:00
|
|
|
#include <asm/chpid.h>
|
2008-07-14 07:58:51 +00:00
|
|
|
#include <asm/cio.h>
|
|
|
|
#include <asm/fcx.h>
|
2008-07-14 07:59:05 +00:00
|
|
|
#include <asm/schid.h>
|
2007-04-27 14:01:35 +00:00
|
|
|
#include "chsc.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* path management control word
|
|
|
|
*/
|
|
|
|
struct pmcw {
|
2008-01-26 13:10:43 +00:00
|
|
|
u32 intparm; /* interruption parameter */
|
|
|
|
u32 qf : 1; /* qdio facility */
|
2008-07-14 07:58:48 +00:00
|
|
|
u32 w : 1;
|
2008-01-26 13:10:43 +00:00
|
|
|
u32 isc : 3; /* interruption sublass */
|
|
|
|
u32 res5 : 3; /* reserved zeros */
|
|
|
|
u32 ena : 1; /* enabled */
|
|
|
|
u32 lm : 2; /* limit mode */
|
|
|
|
u32 mme : 2; /* measurement-mode enable */
|
|
|
|
u32 mp : 1; /* multipath mode */
|
|
|
|
u32 tf : 1; /* timing facility */
|
|
|
|
u32 dnv : 1; /* device number valid */
|
|
|
|
u32 dev : 16; /* device number */
|
|
|
|
u8 lpm; /* logical path mask */
|
|
|
|
u8 pnom; /* path not operational mask */
|
|
|
|
u8 lpum; /* last path used mask */
|
|
|
|
u8 pim; /* path installed mask */
|
|
|
|
u16 mbi; /* measurement-block index */
|
|
|
|
u8 pom; /* path operational mask */
|
|
|
|
u8 pam; /* path available mask */
|
|
|
|
u8 chpid[8]; /* CHPID 0-7 (if available) */
|
|
|
|
u32 unused1 : 8; /* reserved zeros */
|
|
|
|
u32 st : 3; /* subchannel type */
|
|
|
|
u32 unused2 : 18; /* reserved zeros */
|
|
|
|
u32 mbfc : 1; /* measurement block format control */
|
|
|
|
u32 xmwme : 1; /* extended measurement word mode enable */
|
|
|
|
u32 csense : 1; /* concurrent sense; can be enabled ...*/
|
2005-04-16 22:20:36 +00:00
|
|
|
/* ... per MSCH, however, if facility */
|
|
|
|
/* ... is not installed, this results */
|
|
|
|
/* ... in an operand exception. */
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2008-12-25 12:39:13 +00:00
|
|
|
/* Target SCHIB configuration. */
|
|
|
|
struct schib_config {
|
|
|
|
u64 mba;
|
|
|
|
u32 intparm;
|
|
|
|
u16 mbi;
|
|
|
|
u32 isc:3;
|
|
|
|
u32 ena:1;
|
|
|
|
u32 mme:2;
|
|
|
|
u32 mp:1;
|
|
|
|
u32 csense:1;
|
|
|
|
u32 mbfc:1;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* subchannel information block
|
|
|
|
*/
|
|
|
|
struct schib {
|
|
|
|
struct pmcw pmcw; /* path management control word */
|
2008-07-14 07:58:50 +00:00
|
|
|
union scsw scsw; /* subchannel status word */
|
2005-04-16 22:20:36 +00:00
|
|
|
__u64 mba; /* measurement block address */
|
|
|
|
__u8 mda[4]; /* model dependent area */
|
|
|
|
} __attribute__ ((packed,aligned(4)));
|
|
|
|
|
2009-12-07 11:51:18 +00:00
|
|
|
enum sch_todo {
|
|
|
|
SCH_TODO_NOTHING,
|
|
|
|
SCH_TODO_UNREG,
|
|
|
|
};
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* subchannel data structure used by I/O subroutines */
|
|
|
|
struct subchannel {
|
2006-01-06 08:19:21 +00:00
|
|
|
struct subchannel_id schid;
|
2006-12-08 14:54:26 +00:00
|
|
|
spinlock_t *lock; /* subchannel lock */
|
2006-07-12 14:39:50 +00:00
|
|
|
struct mutex reg_mutex;
|
2005-04-16 22:20:36 +00:00
|
|
|
enum {
|
|
|
|
SUBCHANNEL_TYPE_IO = 0,
|
|
|
|
SUBCHANNEL_TYPE_CHSC = 1,
|
2008-01-26 13:10:45 +00:00
|
|
|
SUBCHANNEL_TYPE_MSG = 2,
|
2005-04-16 22:20:36 +00:00
|
|
|
SUBCHANNEL_TYPE_ADM = 3,
|
|
|
|
} st; /* subchannel type */
|
|
|
|
|
|
|
|
struct {
|
|
|
|
unsigned int suspend:1; /* allow suspend */
|
|
|
|
unsigned int prefetch:1;/* deny prefetch */
|
|
|
|
unsigned int inter:1; /* suppress intermediate interrupts */
|
|
|
|
} __attribute__ ((packed)) options;
|
|
|
|
|
|
|
|
__u8 vpm; /* verified path mask */
|
|
|
|
__u8 lpm; /* logical path mask */
|
|
|
|
__u8 opm; /* operational path mask */
|
|
|
|
struct schib schib; /* subchannel information block */
|
2008-04-30 11:38:39 +00:00
|
|
|
int isc; /* desired interruption subclass */
|
2007-04-27 14:01:35 +00:00
|
|
|
struct chsc_ssd_info ssd_info; /* subchannel description */
|
2005-04-16 22:20:36 +00:00
|
|
|
struct device dev; /* entry in device tree */
|
|
|
|
struct css_driver *driver;
|
2008-01-26 13:10:43 +00:00
|
|
|
void *private; /* private per subchannel type data */
|
2009-12-07 11:51:18 +00:00
|
|
|
enum sch_todo todo;
|
|
|
|
struct work_struct todo_work;
|
2008-12-25 12:39:13 +00:00
|
|
|
struct schib_config config;
|
2005-04-16 22:20:36 +00:00
|
|
|
} __attribute__ ((aligned(8)));
|
|
|
|
|
|
|
|
#define IO_INTERRUPT_TYPE 0 /* I/O interrupt type */
|
|
|
|
|
|
|
|
#define to_subchannel(n) container_of(n, struct subchannel, dev)
|
|
|
|
|
2006-01-06 08:19:21 +00:00
|
|
|
extern int cio_validate_subchannel (struct subchannel *, struct subchannel_id);
|
2008-04-30 11:38:39 +00:00
|
|
|
extern int cio_enable_subchannel(struct subchannel *, u32);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern int cio_disable_subchannel (struct subchannel *);
|
|
|
|
extern int cio_cancel (struct subchannel *);
|
|
|
|
extern int cio_clear (struct subchannel *);
|
|
|
|
extern int cio_resume (struct subchannel *);
|
|
|
|
extern int cio_halt (struct subchannel *);
|
|
|
|
extern int cio_start (struct subchannel *, struct ccw1 *, __u8);
|
|
|
|
extern int cio_start_key (struct subchannel *, struct ccw1 *, __u8, __u8);
|
|
|
|
extern int cio_cancel (struct subchannel *);
|
|
|
|
extern int cio_set_options (struct subchannel *, int);
|
|
|
|
extern int cio_get_options (struct subchannel *);
|
2008-12-25 12:39:12 +00:00
|
|
|
extern int cio_update_schib(struct subchannel *sch);
|
2008-12-25 12:39:13 +00:00
|
|
|
extern int cio_commit_config(struct subchannel *sch);
|
2006-01-06 08:19:21 +00:00
|
|
|
|
2008-07-14 07:58:51 +00:00
|
|
|
int cio_tm_start_key(struct subchannel *sch, struct tcw *tcw, u8 lpm, u8 key);
|
|
|
|
int cio_tm_intrg(struct subchannel *sch);
|
|
|
|
|
2006-12-08 14:54:28 +00:00
|
|
|
int cio_create_sch_lock(struct subchannel *);
|
2008-07-14 07:58:59 +00:00
|
|
|
void do_adapter_IO(u8 isc);
|
2008-04-17 05:46:26 +00:00
|
|
|
void do_IRQ(struct pt_regs *);
|
2006-12-08 14:54:28 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Use with care. */
|
|
|
|
#ifdef CONFIG_CCW_CONSOLE
|
|
|
|
extern struct subchannel *cio_probe_console(void);
|
|
|
|
extern void cio_release_console(void);
|
2006-01-06 08:19:21 +00:00
|
|
|
extern int cio_is_console(struct subchannel_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern struct subchannel *cio_get_console_subchannel(void);
|
2006-12-08 14:54:26 +00:00
|
|
|
extern spinlock_t * cio_get_console_lock(void);
|
2008-01-26 13:10:43 +00:00
|
|
|
extern void *cio_get_console_priv(void);
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
2006-01-06 08:19:21 +00:00
|
|
|
#define cio_is_console(schid) 0
|
2005-04-16 22:20:36 +00:00
|
|
|
#define cio_get_console_subchannel() NULL
|
2008-01-26 13:10:43 +00:00
|
|
|
#define cio_get_console_lock() NULL
|
|
|
|
#define cio_get_console_priv() NULL
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|