Linux Audio

Check our new training course

Loading...
v4.10.11
 
  1/*
  2 * Copyright IBM Corp. 2007
  3 * Authors:	Peter Tiedemann (ptiedem@de.ibm.com)
  4 *
  5 * 	MPC additions:
  6 *		Belinda Thompson (belindat@us.ibm.com)
  7 *		Andy Richter (richtera@us.ibm.com)
  8 */
  9
 10#ifndef _CTC_MPC_H_
 11#define _CTC_MPC_H_
 12
 13#include <linux/interrupt.h>
 14#include <linux/skbuff.h>
 15#include "fsm.h"
 16
 17/*
 18 * MPC external interface
 19 * Note that ctc_mpc_xyz are called with a lock on ................
 20 */
 21
 22/*  port_number is the mpc device 0, 1, 2 etc mpc2 is port_number 2 */
 23
 24/*  passive open  Just wait for XID2 exchange */
 25extern int ctc_mpc_alloc_channel(int port,
 26		void (*callback)(int port_num, int max_write_size));
 27/* active open  Alloc then send XID2 */
 28extern void ctc_mpc_establish_connectivity(int port,
 29		void (*callback)(int port_num, int rc, int max_write_size));
 30
 31extern void ctc_mpc_dealloc_ch(int port);
 32extern void ctc_mpc_flow_control(int port, int flowc);
 33
 34/*
 35 * other MPC Group prototypes and structures
 36 */
 37
 38#define ETH_P_SNA_DIX	0x80D5
 39
 40/*
 41 * Declaration of an XID2
 42 *
 43 */
 44#define ALLZEROS 0x0000000000000000
 45
 46#define XID_FM2		0x20
 47#define XID2_0		0x00
 48#define XID2_7		0x07
 49#define XID2_WRITE_SIDE 0x04
 50#define XID2_READ_SIDE	0x05
 51
 52struct xid2 {
 53	__u8	xid2_type_id;
 54	__u8	xid2_len;
 55	__u32	xid2_adj_id;
 56	__u8	xid2_rlen;
 57	__u8	xid2_resv1;
 58	__u8	xid2_flag1;
 59	__u8	xid2_fmtt;
 60	__u8	xid2_flag4;
 61	__u16	xid2_resv2;
 62	__u8	xid2_tgnum;
 63	__u32	xid2_sender_id;
 64	__u8	xid2_flag2;
 65	__u8	xid2_option;
 66	char  xid2_resv3[8];
 67	__u16	xid2_resv4;
 68	__u8	xid2_dlc_type;
 69	__u16	xid2_resv5;
 70	__u8	xid2_mpc_flag;
 71	__u8	xid2_resv6;
 72	__u16	xid2_buf_len;
 73	char xid2_buffer[255 - (13 * sizeof(__u8) +
 74				2 * sizeof(__u32) +
 75				4 * sizeof(__u16) +
 76				8 * sizeof(char))];
 77} __attribute__ ((packed));
 78
 79#define XID2_LENGTH  (sizeof(struct xid2))
 80
 81struct th_header {
 82	__u8	th_seg;
 83	__u8	th_ch_flag;
 84#define TH_HAS_PDU	0xf0
 85#define TH_IS_XID	0x01
 86#define TH_SWEEP_REQ	0xfe
 87#define TH_SWEEP_RESP	0xff
 88	__u8	th_blk_flag;
 89#define TH_DATA_IS_XID	0x80
 90#define TH_RETRY	0x40
 91#define TH_DISCONTACT	0xc0
 92#define TH_SEG_BLK	0x20
 93#define TH_LAST_SEG	0x10
 94#define TH_PDU_PART	0x08
 95	__u8	th_is_xid;	/* is 0x01 if this is XID  */
 96	__u32	th_seq_num;
 97} __attribute__ ((packed));
 98
 99struct th_addon {
100	__u32	th_last_seq;
101	__u32	th_resvd;
102} __attribute__ ((packed));
103
104struct th_sweep {
105	struct th_header th;
106	struct th_addon sw;
107} __attribute__ ((packed));
108
109#define TH_HEADER_LENGTH (sizeof(struct th_header))
110#define TH_SWEEP_LENGTH (sizeof(struct th_sweep))
111
112#define PDU_LAST	0x80
113#define PDU_CNTL	0x40
114#define PDU_FIRST	0x20
115
116struct pdu {
117	__u32	pdu_offset;
118	__u8	pdu_flag;
119	__u8	pdu_proto;   /*  0x01 is APPN SNA  */
120	__u16	pdu_seq;
121} __attribute__ ((packed));
122
123#define PDU_HEADER_LENGTH  (sizeof(struct pdu))
124
125struct qllc {
126	__u8	qllc_address;
127#define QLLC_REQ	0xFF
128#define QLLC_RESP	0x00
129	__u8	qllc_commands;
130#define QLLC_DISCONNECT 0x53
131#define QLLC_UNSEQACK	0x73
132#define QLLC_SETMODE	0x93
133#define QLLC_EXCHID	0xBF
134} __attribute__ ((packed));
135
136
137/*
138 * Definition of one MPC group
139 */
140
141#define MAX_MPCGCHAN		10
142#define MPC_XID_TIMEOUT_VALUE	10000
143#define MPC_CHANNEL_ADD		0
144#define MPC_CHANNEL_REMOVE	1
145#define MPC_CHANNEL_ATTN	2
146#define XSIDE	1
147#define YSIDE	0
148
149struct mpcg_info {
150	struct sk_buff	*skb;
151	struct channel	*ch;
152	struct xid2	*xid;
153	struct th_sweep	*sweep;
154	struct th_header *th;
155};
156
157struct mpc_group {
158	struct tasklet_struct mpc_tasklet;
159	struct tasklet_struct mpc_tasklet2;
160	int	changed_side;
161	int	saved_state;
162	int	channels_terminating;
163	int	out_of_sequence;
164	int	flow_off_called;
165	int	port_num;
166	int	port_persist;
167	int	alloc_called;
168	__u32	xid2_adj_id;
169	__u8	xid2_tgnum;
170	__u32	xid2_sender_id;
171	int	num_channel_paths;
172	int	active_channels[2];
173	__u16	group_max_buflen;
174	int	outstanding_xid2;
175	int	outstanding_xid7;
176	int	outstanding_xid7_p2;
177	int	sweep_req_pend_num;
178	int	sweep_rsp_pend_num;
179	struct sk_buff	*xid_skb;
180	char		*xid_skb_data;
181	struct th_header *xid_th;
182	struct xid2	*xid;
183	char		*xid_id;
184	struct th_header *rcvd_xid_th;
185	struct sk_buff	*rcvd_xid_skb;
186	char		*rcvd_xid_data;
187	__u8		in_sweep;
188	__u8		roll;
189	struct xid2	*saved_xid2;
190	void 		(*allochanfunc)(int, int);
191	int		allocchan_callback_retries;
192	void 		(*estconnfunc)(int, int, int);
193	int		estconn_callback_retries;
194	int		estconn_called;
195	int		xidnogood;
196	int		send_qllc_disc;
197	fsm_timer	timer;
198	fsm_instance	*fsm; /* group xid fsm */
199};
200
201#ifdef DEBUGDATA
202void ctcmpc_dumpit(char *buf, int len);
203#else
204static inline void ctcmpc_dumpit(char *buf, int len)
205{
206}
207#endif
208
209#ifdef DEBUGDATA
210/*
211 * Dump header and first 16 bytes of an sk_buff for debugging purposes.
212 *
213 * skb	 The struct sk_buff to dump.
214 * offset Offset relative to skb-data, where to start the dump.
215 */
216void ctcmpc_dump_skb(struct sk_buff *skb, int offset);
217#else
218static inline void ctcmpc_dump_skb(struct sk_buff *skb, int offset)
219{}
220#endif
221
222static inline void ctcmpc_dump32(char *buf, int len)
223{
224	if (len < 32)
225		ctcmpc_dumpit(buf, len);
226	else
227		ctcmpc_dumpit(buf, 32);
228}
229
230int ctcmpc_open(struct net_device *);
231void ctcm_ccw_check_rc(struct channel *, int, char *);
232void mpc_group_ready(unsigned long adev);
233void mpc_channel_action(struct channel *ch, int direction, int action);
234void mpc_action_send_discontact(unsigned long thischan);
235void mpc_action_discontact(fsm_instance *fi, int event, void *arg);
236void ctcmpc_bh(unsigned long thischan);
237#endif
238/* --- This is the END my friend --- */
v6.2
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright IBM Corp. 2007
  4 * Authors:	Peter Tiedemann (ptiedem@de.ibm.com)
  5 *
  6 * 	MPC additions:
  7 *		Belinda Thompson (belindat@us.ibm.com)
  8 *		Andy Richter (richtera@us.ibm.com)
  9 */
 10
 11#ifndef _CTC_MPC_H_
 12#define _CTC_MPC_H_
 13
 14#include <linux/interrupt.h>
 15#include <linux/skbuff.h>
 16#include "fsm.h"
 17
 18/*
 19 * MPC external interface
 20 * Note that ctc_mpc_xyz are called with a lock on ................
 21 */
 22
 23/*  port_number is the mpc device 0, 1, 2 etc mpc2 is port_number 2 */
 24
 25/*  passive open  Just wait for XID2 exchange */
 26extern int ctc_mpc_alloc_channel(int port,
 27		void (*callback)(int port_num, int max_write_size));
 28/* active open  Alloc then send XID2 */
 29extern void ctc_mpc_establish_connectivity(int port,
 30		void (*callback)(int port_num, int rc, int max_write_size));
 31
 32extern void ctc_mpc_dealloc_ch(int port);
 33extern void ctc_mpc_flow_control(int port, int flowc);
 34
 35/*
 36 * other MPC Group prototypes and structures
 37 */
 38
 39#define ETH_P_SNA_DIX	0x80D5
 40
 41/*
 42 * Declaration of an XID2
 43 *
 44 */
 45#define ALLZEROS 0x0000000000000000
 46
 47#define XID_FM2		0x20
 48#define XID2_0		0x00
 49#define XID2_7		0x07
 50#define XID2_WRITE_SIDE 0x04
 51#define XID2_READ_SIDE	0x05
 52
 53struct xid2 {
 54	__u8	xid2_type_id;
 55	__u8	xid2_len;
 56	__u32	xid2_adj_id;
 57	__u8	xid2_rlen;
 58	__u8	xid2_resv1;
 59	__u8	xid2_flag1;
 60	__u8	xid2_fmtt;
 61	__u8	xid2_flag4;
 62	__u16	xid2_resv2;
 63	__u8	xid2_tgnum;
 64	__u32	xid2_sender_id;
 65	__u8	xid2_flag2;
 66	__u8	xid2_option;
 67	char  xid2_resv3[8];
 68	__u16	xid2_resv4;
 69	__u8	xid2_dlc_type;
 70	__u16	xid2_resv5;
 71	__u8	xid2_mpc_flag;
 72	__u8	xid2_resv6;
 73	__u16	xid2_buf_len;
 74	char xid2_buffer[255 - (13 * sizeof(__u8) +
 75				2 * sizeof(__u32) +
 76				4 * sizeof(__u16) +
 77				8 * sizeof(char))];
 78} __attribute__ ((packed));
 79
 80#define XID2_LENGTH  (sizeof(struct xid2))
 81
 82struct th_header {
 83	__u8	th_seg;
 84	__u8	th_ch_flag;
 85#define TH_HAS_PDU	0xf0
 86#define TH_IS_XID	0x01
 87#define TH_SWEEP_REQ	0xfe
 88#define TH_SWEEP_RESP	0xff
 89	__u8	th_blk_flag;
 90#define TH_DATA_IS_XID	0x80
 91#define TH_RETRY	0x40
 92#define TH_DISCONTACT	0xc0
 93#define TH_SEG_BLK	0x20
 94#define TH_LAST_SEG	0x10
 95#define TH_PDU_PART	0x08
 96	__u8	th_is_xid;	/* is 0x01 if this is XID  */
 97	__u32	th_seq_num;
 98} __attribute__ ((packed));
 99
100struct th_addon {
101	__u32	th_last_seq;
102	__u32	th_resvd;
103} __attribute__ ((packed));
104
105struct th_sweep {
106	struct th_header th;
107	struct th_addon sw;
108} __attribute__ ((packed));
109
110#define TH_HEADER_LENGTH (sizeof(struct th_header))
111#define TH_SWEEP_LENGTH (sizeof(struct th_sweep))
112
113#define PDU_LAST	0x80
114#define PDU_CNTL	0x40
115#define PDU_FIRST	0x20
116
117struct pdu {
118	__u32	pdu_offset;
119	__u8	pdu_flag;
120	__u8	pdu_proto;   /*  0x01 is APPN SNA  */
121	__u16	pdu_seq;
122} __attribute__ ((packed));
123
124#define PDU_HEADER_LENGTH  (sizeof(struct pdu))
125
126struct qllc {
127	__u8	qllc_address;
128#define QLLC_REQ	0xFF
129#define QLLC_RESP	0x00
130	__u8	qllc_commands;
131#define QLLC_DISCONNECT 0x53
132#define QLLC_UNSEQACK	0x73
133#define QLLC_SETMODE	0x93
134#define QLLC_EXCHID	0xBF
135} __attribute__ ((packed));
136
137
138/*
139 * Definition of one MPC group
140 */
141
142#define MAX_MPCGCHAN		10
143#define MPC_XID_TIMEOUT_VALUE	10000
144#define MPC_CHANNEL_ADD		0
145#define MPC_CHANNEL_REMOVE	1
146#define MPC_CHANNEL_ATTN	2
147#define XSIDE	1
148#define YSIDE	0
149
150struct mpcg_info {
151	struct sk_buff	*skb;
152	struct channel	*ch;
153	struct xid2	*xid;
154	struct th_sweep	*sweep;
155	struct th_header *th;
156};
157
158struct mpc_group {
159	struct tasklet_struct mpc_tasklet;
160	struct tasklet_struct mpc_tasklet2;
161	int	changed_side;
162	int	saved_state;
163	int	channels_terminating;
164	int	out_of_sequence;
165	int	flow_off_called;
166	int	port_num;
167	int	port_persist;
168	int	alloc_called;
169	__u32	xid2_adj_id;
170	__u8	xid2_tgnum;
171	__u32	xid2_sender_id;
172	int	num_channel_paths;
173	int	active_channels[2];
174	__u16	group_max_buflen;
175	int	outstanding_xid2;
176	int	outstanding_xid7;
177	int	outstanding_xid7_p2;
178	int	sweep_req_pend_num;
179	int	sweep_rsp_pend_num;
180	struct sk_buff	*xid_skb;
181	char		*xid_skb_data;
182	struct th_header *xid_th;
183	struct xid2	*xid;
184	char		*xid_id;
185	struct th_header *rcvd_xid_th;
186	struct sk_buff	*rcvd_xid_skb;
187	char		*rcvd_xid_data;
188	__u8		in_sweep;
189	__u8		roll;
190	struct xid2	*saved_xid2;
191	void 		(*allochanfunc)(int, int);
192	int		allocchan_callback_retries;
193	void 		(*estconnfunc)(int, int, int);
194	int		estconn_callback_retries;
195	int		estconn_called;
196	int		xidnogood;
197	int		send_qllc_disc;
198	fsm_timer	timer;
199	fsm_instance	*fsm; /* group xid fsm */
200};
201
202#ifdef DEBUGDATA
203void ctcmpc_dumpit(char *buf, int len);
204#else
205static inline void ctcmpc_dumpit(char *buf, int len)
206{
207}
208#endif
209
210#ifdef DEBUGDATA
211/*
212 * Dump header and first 16 bytes of an sk_buff for debugging purposes.
213 *
214 * skb	 The struct sk_buff to dump.
215 * offset Offset relative to skb-data, where to start the dump.
216 */
217void ctcmpc_dump_skb(struct sk_buff *skb, int offset);
218#else
219static inline void ctcmpc_dump_skb(struct sk_buff *skb, int offset)
220{}
221#endif
222
223static inline void ctcmpc_dump32(char *buf, int len)
224{
225	if (len < 32)
226		ctcmpc_dumpit(buf, len);
227	else
228		ctcmpc_dumpit(buf, 32);
229}
230
 
231void ctcm_ccw_check_rc(struct channel *, int, char *);
232void mpc_group_ready(unsigned long adev);
233void mpc_channel_action(struct channel *ch, int direction, int action);
234void mpc_action_send_discontact(unsigned long thischan);
235void mpc_action_discontact(fsm_instance *fi, int event, void *arg);
236void ctcmpc_bh(unsigned long thischan);
237#endif
238/* --- This is the END my friend --- */