2005-04-16 22:20:36 +00:00
|
|
|
#ifndef _CSS_H
|
|
|
|
#define _CSS_H
|
|
|
|
|
2006-03-24 11:15:14 +00:00
|
|
|
#include <linux/mutex.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/wait.h>
|
|
|
|
#include <linux/workqueue.h>
|
2007-04-27 14:01:28 +00:00
|
|
|
#include <linux/device.h>
|
2007-04-27 14:01:31 +00:00
|
|
|
#include <linux/types.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include <asm/cio.h>
|
2007-04-27 14:01:31 +00:00
|
|
|
#include <asm/chpid.h>
|
2008-07-14 07:59:05 +00:00
|
|
|
#include <asm/schid.h>
|
2006-01-06 08:19:21 +00:00
|
|
|
|
2009-12-07 11:51:18 +00:00
|
|
|
#include "cio.h"
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* path grouping stuff
|
|
|
|
*/
|
|
|
|
#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 0
|
|
|
|
#define SNID_STATE1_UNGROUPED 2
|
|
|
|
#define SNID_STATE1_GROUPED 3
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
struct path_state {
|
|
|
|
__u8 state1 : 2; /* path state value 1 */
|
|
|
|
__u8 state2 : 2; /* path state value 2 */
|
|
|
|
__u8 state3 : 1; /* path state value 3 */
|
|
|
|
__u8 resvd : 3; /* reserved */
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2006-01-06 08:19:23 +00:00
|
|
|
struct extended_cssid {
|
|
|
|
u8 version;
|
|
|
|
u8 cssid;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct pgid {
|
|
|
|
union {
|
|
|
|
__u8 fc; /* SPID function code */
|
|
|
|
struct path_state ps; /* SNID path state */
|
2006-06-04 09:51:28 +00:00
|
|
|
} __attribute__ ((packed)) inf;
|
2006-01-06 08:19:23 +00:00
|
|
|
union {
|
|
|
|
__u32 cpu_addr : 16; /* CPU address */
|
|
|
|
struct extended_cssid ext_cssid;
|
2006-06-04 09:51:28 +00:00
|
|
|
} __attribute__ ((packed)) pgid_high;
|
2005-04-16 22:20:36 +00:00
|
|
|
__u32 cpu_id : 24; /* CPU identification */
|
|
|
|
__u32 cpu_model : 16; /* CPU model */
|
|
|
|
__u32 tod_high; /* high word TOD clock */
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2006-01-11 09:56:22 +00:00
|
|
|
struct subchannel;
|
2008-07-14 07:59:02 +00:00
|
|
|
struct chp_link;
|
2008-07-14 07:58:45 +00:00
|
|
|
/**
|
|
|
|
* struct css_driver - device driver for subchannels
|
|
|
|
* @owner: owning module
|
|
|
|
* @subchannel_type: subchannel type supported by this driver
|
|
|
|
* @drv: embedded device driver structure
|
|
|
|
* @irq: called on interrupts
|
|
|
|
* @chp_event: called for events affecting a channel path
|
|
|
|
* @sch_event: called for events affecting the subchannel
|
|
|
|
* @probe: function called on probe
|
|
|
|
* @remove: function called on remove
|
|
|
|
* @shutdown: called at device shutdown
|
2009-06-16 08:30:22 +00:00
|
|
|
* @prepare: prepare for pm state transition
|
|
|
|
* @complete: undo work done in @prepare
|
|
|
|
* @freeze: callback for freezing during hibernation snapshotting
|
|
|
|
* @thaw: undo work done in @freeze
|
|
|
|
* @restore: callback for restoring after hibernation
|
2009-09-22 20:58:35 +00:00
|
|
|
* @settle: wait for asynchronous work to finish
|
2008-07-14 07:58:45 +00:00
|
|
|
* @name: name of the device driver
|
|
|
|
*/
|
2005-04-16 22:20:36 +00:00
|
|
|
struct css_driver {
|
2008-01-26 13:10:47 +00:00
|
|
|
struct module *owner;
|
2008-07-14 07:59:03 +00:00
|
|
|
struct css_device_id *subchannel_type;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct device_driver drv;
|
2008-01-26 13:10:39 +00:00
|
|
|
void (*irq)(struct subchannel *);
|
2008-07-14 07:59:02 +00:00
|
|
|
int (*chp_event)(struct subchannel *, struct chp_link *, int);
|
2008-07-14 07:58:45 +00:00
|
|
|
int (*sch_event)(struct subchannel *, int);
|
2006-01-11 09:56:22 +00:00
|
|
|
int (*probe)(struct subchannel *);
|
|
|
|
int (*remove)(struct subchannel *);
|
|
|
|
void (*shutdown)(struct subchannel *);
|
2009-06-16 08:30:22 +00:00
|
|
|
int (*prepare) (struct subchannel *);
|
|
|
|
void (*complete) (struct subchannel *);
|
|
|
|
int (*freeze)(struct subchannel *);
|
|
|
|
int (*thaw) (struct subchannel *);
|
|
|
|
int (*restore)(struct subchannel *);
|
2010-02-26 21:37:27 +00:00
|
|
|
int (*settle)(void);
|
2008-01-26 13:10:41 +00:00
|
|
|
const char *name;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2008-01-26 13:10:38 +00:00
|
|
|
#define to_cssdriver(n) container_of(n, struct css_driver, drv)
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* all css_drivers have the css_bus_type
|
|
|
|
*/
|
|
|
|
extern struct bus_type css_bus_type;
|
|
|
|
|
2008-01-26 13:10:41 +00:00
|
|
|
extern int css_driver_register(struct css_driver *);
|
|
|
|
extern void css_driver_unregister(struct css_driver *);
|
|
|
|
|
2006-07-12 14:39:50 +00:00
|
|
|
extern void css_sch_device_unregister(struct subchannel *);
|
2008-07-14 07:58:45 +00:00
|
|
|
extern int css_probe_device(struct subchannel_id);
|
|
|
|
extern struct subchannel *get_subchannel_by_schid(struct subchannel_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern int css_init_done;
|
2009-09-22 20:58:37 +00:00
|
|
|
extern int max_ssid;
|
2008-01-26 13:10:48 +00:00
|
|
|
int for_each_subchannel_staged(int (*fn_known)(struct subchannel *, void *),
|
|
|
|
int (*fn_unknown)(struct subchannel_id,
|
|
|
|
void *), void *data);
|
2006-01-06 08:19:22 +00:00
|
|
|
extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
|
2007-02-05 20:16:47 +00:00
|
|
|
extern void css_reiterate_subchannels(void);
|
2007-04-27 14:01:35 +00:00
|
|
|
void css_update_ssd_info(struct subchannel *sch);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-01-06 08:19:21 +00:00
|
|
|
#define __MAX_SUBCHANNEL 65535
|
2006-01-06 08:19:25 +00:00
|
|
|
#define __MAX_SSID 3
|
2006-01-06 08:19:23 +00:00
|
|
|
|
|
|
|
struct channel_subsystem {
|
|
|
|
u8 cssid;
|
|
|
|
int valid;
|
2006-01-14 21:21:03 +00:00
|
|
|
struct channel_path *chps[__MAX_CHPID + 1];
|
2006-01-06 08:19:23 +00:00
|
|
|
struct device device;
|
|
|
|
struct pgid global_pgid;
|
2006-03-24 11:15:14 +00:00
|
|
|
struct mutex mutex;
|
|
|
|
/* channel measurement related */
|
|
|
|
int cm_enabled;
|
|
|
|
void *cub_addr1;
|
|
|
|
void *cub_addr2;
|
2006-12-08 14:54:28 +00:00
|
|
|
/* for orphaned ccw devices */
|
|
|
|
struct subchannel *pseudo_subchannel;
|
2006-01-06 08:19:23 +00:00
|
|
|
};
|
|
|
|
#define to_css(dev) container_of(dev, struct channel_subsystem, device)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
extern struct bus_type css_bus_type;
|
2007-10-12 14:11:13 +00:00
|
|
|
extern struct channel_subsystem *channel_subsystems[];
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Helper functions to build lists for the slow path. */
|
2007-04-27 14:01:34 +00:00
|
|
|
void css_schedule_eval(struct subchannel_id schid);
|
|
|
|
void css_schedule_eval_all(void);
|
2010-02-26 21:37:29 +00:00
|
|
|
int css_complete_work(void);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-12-08 14:54:28 +00:00
|
|
|
int sch_is_pseudo_sch(struct subchannel *);
|
2008-01-26 13:10:45 +00:00
|
|
|
struct schib;
|
|
|
|
int css_sch_is_valid(struct schib *);
|
2006-12-08 14:54:28 +00:00
|
|
|
|
2010-02-26 21:37:24 +00:00
|
|
|
extern struct workqueue_struct *cio_work_q;
|
2008-04-17 05:45:59 +00:00
|
|
|
void css_wait_for_slow_path(void);
|
2009-12-07 11:51:18 +00:00
|
|
|
void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo);
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|