patch-2.4.8 linux/include/asm-s390/chandev.h

Next file: linux/include/asm-s390/checksum.h
Previous file: linux/include/asm-s390/cache.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.7/linux/include/asm-s390/chandev.h linux/include/asm-s390/chandev.h
@@ -6,49 +6,86 @@
  * 
  *  Generic channel device initialisation support. 
  */
+#ifndef __S390_CHANDEV_H
+#define __S390_CHANDEV_H
 #include <linux/version.h>
 #include <asm/types.h>
 #include <linux/netdevice.h>
 
+
+/* Setting this flag to true causes a device name to be built based on the read_devno of the device */
+/* this is exported so external code can look at this flags setting */
+extern int chandev_use_devno_names;
+
+
 /* chandev_type is a bitmask for registering & describing device types. */
 typedef enum
 {
-	none=0x0,
-	ctc=0x1,
-	escon=0x2,
-	lcs=0x4,
-	osad=0x8,
-	qeth=0x10,
-	claw=0x20,
+	chandev_type_none=0x0,
+	chandev_type_ctc=0x1,
+	chandev_type_escon=0x2,
+	chandev_type_lcs=0x4,
+	chandev_type_osad=0x8,
+	chandev_type_qeth=0x10,
+	chandev_type_claw=0x20,
 } chandev_type;
 
 typedef enum
 {
-	no_category,
-	network_device,
-	serial_device,
+	chandev_category_none,
+	chandev_category_network_device,
+	chandev_category_serial_device,
 } chandev_category;
 
+
+
+typedef struct
+{
+	int     irq;
+	u16     devno;
+	u16     cu_type;      /* control unit type */
+	u8      cu_model;     /* control unit model */
+	u16     dev_type;     /* device type */
+	u8      dev_model;    /* device model */
+	u8      pim;          /* path installed mask */
+	u8      chpid[8];     /* CHPID 0-7 (if available) */
+} chandev_subchannel_info;
+
+#define CLAW_NAMELEN 9
+/* CLAW specific parameters other drivers should ignore these fields */
+typedef struct
+{
+	
+	char	 host_name[CLAW_NAMELEN];    /* local host name */
+	char	 adapter_name[CLAW_NAMELEN]; /* workstation adapter name */
+	char	 api_type[CLAW_NAMELEN];     /* API type either TCPIP or API */
+} chandev_claw_info;
+
 /*
  * The chandev_probeinfo structure is passed to the device driver with configuration
  * info for which irq's & ports to use when attempting to probe the device.
  */
 typedef struct
 {
-        int     read_irq;
-	int     write_irq;
-	u16     read_devno;
-	u16     write_devno;
-        s16     port_protocol_no; /* -1 don't care */
+	chandev_subchannel_info read;
+	chandev_subchannel_info write;
+	chandev_subchannel_info data;
+	/* memory_usage_in_k is the suggested memory the driver should attempt to use for io */
+	/* buffers -1 means use the driver default the driver should set this field to the */
+	/* amount of memory it actually uses when returning this probeinfo to the channel */
+	/* device layer with chandev_initdevice */
+	s32     memory_usage_in_k;
+	chandev_claw_info       claw;
+	u8      data_exists; /* whether this device has a data channel */
+	u8      cu_dev_info_inconsistent; /* either ctc or we possibly had a bad sense_id */
+	u8      chpid_info_inconsistent;  /* either ctc or schib info bad */
+        s16     port_protocol_no; /* 0 by default, set specifically when forcing */
 	u8      hint_port_no;   /* lcs specific */
-	u8      max_port_no;    /* lcs specific */
+	u8      max_port_no;    /* lcs/qeth specific */
 	chandev_type chan_type;
 	u8      checksum_received_ip_pkts;
 	u8      use_hw_stats; /* where available e.g. lcs */
-	u16     cu_type;      /* control unit type */
-	u8      cu_model;     /* control unit model */
-	u16     dev_type;     /* device type */
-	u8      dev_model;    /* device model */
+	u8      device_forced; /* indicates the device hasn't been autodetected */
 	char    *parmstr;       /* driver specific parameters added by add_parms keyword */
 	/* newdevice used internally by chandev.c */
 	struct  chandev_activelist *newdevice; 
@@ -75,19 +112,21 @@
 
 typedef enum
 {
-	good=0,
-	not_oper,
-	first_msck=not_oper,
-	no_path,
-	revalidate,
-	gone,
-	last_msck,
+	chandev_status_good,
+	chandev_status_not_oper,
+	chandev_status_first_msck=chandev_status_not_oper,
+	chandev_status_no_path,
+	chandev_status_revalidate,
+	chandev_status_gone,
+	chandev_status_last_msck,
+	chandev_status_all_chans_good /* pseudo machine check to indicate all channels are healthy */
 } chandev_msck_status;
 
 typedef int (*chandev_probefunc)(chandev_probeinfo *probeinfo);
-typedef void (*chandev_shutdownfunc)(void *device);
+typedef int (*chandev_shutdownfunc)(void *device);
 typedef void (*chandev_unregfunc)(void *device);
-typedef void (*chandev_reoperfunc)(void *device,int msck_for_read_chan,chandev_msck_status prevstatus);
+typedef void (*chandev_msck_notification_func)(void *device,int msck_irq,
+chandev_msck_status prevstatus,chandev_msck_status newstatus);
 
 
 
@@ -103,7 +142,7 @@
  */
 int chandev_register_and_probe(chandev_probefunc probefunc,
 			       chandev_shutdownfunc shutdownfunc,
-			       chandev_reoperfunc reoperfunc,
+			       chandev_msck_notification_func msck_notfunc,
 			       chandev_type chan_type);
 
 /* The chandev_unregister function is typically called when a module is being removed 
@@ -117,6 +156,33 @@
 int chandev_initdevice(chandev_probeinfo *probeinfo,void *dev_ptr,u8 port_no,char *devname,
 chandev_category category,chandev_unregfunc unreg_dev);
 
+/* This function builds a device name & copies it into destnamebuff suitable for calling 
+   init_trdev or whatever & it honours the use_devno_names flag, it is used by chandev_initnetdevice 
+   setting the buildfullname flag to TRUE will cause it to always build a full unique name based 
+   on basename either honouring the chandev_use_devno_names flag if set or starting at index 
+   0 & checking the namespace of the channel device layer itself for a free index, this
+   may be useful when one doesn't have control of the name an upper layer may choose.
+   It returns NULL on error.
+*/
+char *chandev_build_device_name(chandev_probeinfo *probeinfo,char *destnamebuff,char *basename,int buildfullname);
+
+
+
+
+/* chandev_init_netdev registers with the normal network device layer */
+/* it doesn't update any of the chandev internal structures. */
+/* i.e. it is optional */
+/* it was part of chandev_initnetdevice but I separated it as */
+/* chandev_initnetdevice may make too many assumptions for some users */
+/* chandev_initnetdevice = chandev_initdevice followed by chandev_init_netdev */
+#if LINUX_VERSION_CODE>=KERNEL_VERSION(2,3,0)
+struct net_device *chandev_init_netdev(chandev_probeinfo *probeinfo,char *basename,
+struct net_device *dev, int sizeof_priv,struct net_device *(*init_netdevfunc)(struct net_device *dev, int sizeof_priv));
+#else
+struct device *chandev_init_netdev(chandev_probeinfo *probeinfo,char *basename,
+struct device *dev, int sizeof_priv,struct device *(*init_netdevfunc)(struct device *dev, int sizeof_priv));
+#endif
+
 /* chandev_initnetdevice registers a network device with the channel layer. 
  * It returns the device structure if successful,if dev=NULL it kmallocs it, 
  * On device initialisation failure it will kfree it under ALL curcumstances
@@ -148,8 +214,18 @@
 				     void (*unreg_netdevfunc)(struct device *dev));
 #endif
 
-
-
+/* chandev_add & delete model shouldn't normally be needed by drivers except if */
+/* someone is developing a driver which the channel device layer doesn't know about */
+void chandev_add_model(chandev_type chan_type,s32 cu_type,s16 cu_model,
+		       s32 dev_type,s16 dev_model,u8 max_port_no,int auto_msck_recovery,
+		        u8 default_checksum_received_ip_pkts,u8 default_use_hw_stats);
+void chandev_del_model(s32 cu_type,s16 cu_model,s32 dev_type,s16 dev_model);
+
+/* modules should use chandev_persist to see if they should stay loaded */
+/* this is useful for debugging purposes where you may wish to examine */
+/* /proc/s390dbf/ entries */
+int chandev_persist(chandev_type chan_type);
+#endif /* __S390_CHANDEV_H */
 
 
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)