blob: 01deced18ab83634aa761e748b02ee31cab9482a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2/*
3 *
Joe Perches475be4d2012-02-19 19:52:38 -08004 Copyright (c) Eicon Networks, 2002.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Joe Perches475be4d2012-02-19 19:52:38 -08006 This source file is supplied for the use with
7 Eicon Networks range of DIVA Server Adapters.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
Joe Perches475be4d2012-02-19 19:52:38 -08009 Eicon File Revision : 2.1
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 *
Joe Perches475be4d2012-02-19 19:52:38 -080011 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
14 any later version.
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 *
Joe Perches475be4d2012-02-19 19:52:38 -080016 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
18 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 *
Joe Perches475be4d2012-02-19 19:52:38 -080021 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 *
25 */
26#ifndef __DIVA_XDI_COMMON_IO_H_INC__ /* { */
27#define __DIVA_XDI_COMMON_IO_H_INC__
28/*
Joe Perches475be4d2012-02-19 19:52:38 -080029 maximum = 16 adapters
30*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#define DI_MAX_LINKS MAX_ADAPTER
32#define ISDN_MAX_NUM_LEN 60
33/* --------------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -080034 structure for quadro card management (obsolete for
35 systems that do provide per card load event)
36 -------------------------------------------------------------------------- */
Linus Torvalds1da177e2005-04-16 15:20:36 -070037typedef struct {
Joe Perches475be4d2012-02-19 19:52:38 -080038 dword Num;
39 DEVICE_NAME DeviceName[4];
40 PISDN_ADAPTER QuadroAdapter[4];
41} ADAPTER_LIST_ENTRY, *PADAPTER_LIST_ENTRY;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042/* --------------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -080043 Special OS memory support structures
44 -------------------------------------------------------------------------- */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#define MAX_MAPPED_ENTRIES 8
46typedef struct {
Joe Perches475be4d2012-02-19 19:52:38 -080047 void *Address;
48 dword Length;
49} ADAPTER_MEMORY;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050/* --------------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -080051 Configuration of XDI clients carried by XDI
52 -------------------------------------------------------------------------- */
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#define DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON 0x01
54#define DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON 0x02
55typedef struct _diva_xdi_capi_cfg {
Joe Perches475be4d2012-02-19 19:52:38 -080056 byte cfg_1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070057} diva_xdi_capi_cfg_t;
58/* --------------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -080059 Main data structure kept per adapter
60 -------------------------------------------------------------------------- */
Linus Torvalds1da177e2005-04-16 15:20:36 -070061struct _ISDN_ADAPTER {
Joe Perches475be4d2012-02-19 19:52:38 -080062 void (*DIRequest)(PISDN_ADAPTER, ENTITY *);
63 int State; /* from NT4 1.srv, a good idea, but a poor achievement */
64 int Initialized;
65 int RegisteredWithDidd;
66 int Unavailable; /* callback function possible? */
67 int ResourcesClaimed;
68 int PnpBiosConfigUsed;
69 dword Logging;
70 dword features;
71 char ProtocolIdString[80];
72 /*
73 remember mapped memory areas
74 */
75 ADAPTER_MEMORY MappedMemory[MAX_MAPPED_ENTRIES];
76 CARD_PROPERTIES Properties;
77 dword cardType;
78 dword protocol_id; /* configured protocol identifier */
79 char protocol_name[8]; /* readable name of protocol */
80 dword BusType;
81 dword BusNumber;
82 dword slotNumber;
83 dword slotId;
84 dword ControllerNumber; /* for QUADRO cards only */
85 PISDN_ADAPTER MultiMaster; /* for 4-BRI card only - use MultiMaster or QuadroList */
86 PADAPTER_LIST_ENTRY QuadroList; /* for QUADRO card only */
87 PDEVICE_OBJECT DeviceObject;
88 dword DeviceId;
89 diva_os_adapter_irq_info_t irq_info;
90 dword volatile IrqCount;
91 int trapped;
92 dword DspCodeBaseAddr;
93 dword MaxDspCodeSize;
94 dword downloadAddr;
95 dword DspCodeBaseAddrTable[4]; /* add. for MultiMaster */
96 dword MaxDspCodeSizeTable[4]; /* add. for MultiMaster */
97 dword downloadAddrTable[4]; /* add. for MultiMaster */
98 dword MemoryBase;
99 dword MemorySize;
100 byte __iomem *Address;
101 byte __iomem *Config;
102 byte __iomem *Control;
103 byte __iomem *reset;
104 byte __iomem *port;
105 byte __iomem *ram;
106 byte __iomem *cfg;
107 byte __iomem *prom;
108 byte __iomem *ctlReg;
109 struct pc_maint *pcm;
110 diva_os_dependent_devica_name_t os_name;
111 byte Name[32];
112 dword serialNo;
113 dword ANum;
114 dword ArchiveType; /* ARCHIVE_TYPE_NONE ..._SINGLE ..._USGEN ..._MULTI */
115 char *ProtocolSuffix; /* internal protocolfile table */
116 char Archive[32];
117 char Protocol[32];
118 char AddDownload[32]; /* Dsp- or other additional download files */
119 char Oad1[ISDN_MAX_NUM_LEN];
120 char Osa1[ISDN_MAX_NUM_LEN];
121 char Oad2[ISDN_MAX_NUM_LEN];
122 char Osa2[ISDN_MAX_NUM_LEN];
123 char Spid1[ISDN_MAX_NUM_LEN];
124 char Spid2[ISDN_MAX_NUM_LEN];
125 byte nosig;
126 byte BriLayer2LinkCount; /* amount of TEI's that adapter will support in P2MP mode */
127 dword Channels;
128 dword tei;
129 dword nt2;
130 dword TerminalCount;
131 dword WatchDog;
132 dword Permanent;
133 dword BChMask; /* B channel mask for unchannelized modes */
134 dword StableL2;
135 dword DidLen;
136 dword NoOrderCheck;
137 dword ForceLaw; /* VoiceCoding - default:0, a-law: 1, my-law: 2 */
138 dword SigFlags;
139 dword LowChannel;
140 dword NoHscx30;
141 dword ProtVersion;
142 dword crc4;
143 dword L1TristateOrQsig; /* enable Layer 1 Tristate (bit 2)Or Qsig params (bit 0,1)*/
144 dword InitialDspInfo;
145 dword ModemGuardTone;
146 dword ModemMinSpeed;
147 dword ModemMaxSpeed;
148 dword ModemOptions;
149 dword ModemOptions2;
150 dword ModemNegotiationMode;
151 dword ModemModulationsMask;
152 dword ModemTransmitLevel;
153 dword FaxOptions;
154 dword FaxMaxSpeed;
155 dword Part68LevelLimiter;
156 dword UsEktsNumCallApp;
157 byte UsEktsFeatAddConf;
158 byte UsEktsFeatRemoveConf;
159 byte UsEktsFeatCallTransfer;
160 byte UsEktsFeatMsgWaiting;
161 byte QsigDialect;
162 byte ForceVoiceMailAlert;
163 byte DisableAutoSpid;
164 byte ModemCarrierWaitTimeSec;
165 byte ModemCarrierLossWaitTimeTenthSec;
166 byte PiafsLinkTurnaroundInFrames;
167 byte DiscAfterProgress;
168 byte AniDniLimiter[3];
169 byte TxAttenuation; /* PRI/E1 only: attenuate TX signal */
170 word QsigFeatures;
171 dword GenerateRingtone;
172 dword SupplementaryServicesFeatures;
173 dword R2Dialect;
174 dword R2CasOptions;
175 dword FaxV34Options;
176 dword DisabledDspMask;
177 dword AdapterTestMask;
178 dword DspImageLength;
179 word AlertToIn20mSecTicks;
180 word ModemEyeSetup;
181 byte R2CtryLength;
182 byte CCBSRelTimer;
183 byte *PcCfgBufferFile;/* flexible parameter via file */
184 byte *PcCfgBuffer; /* flexible parameter via multistring */
185 diva_os_dump_file_t dump_file; /* dump memory to file at lowest irq level */
186 diva_os_board_trace_t board_trace; /* traces from the board */
187 diva_os_spin_lock_t isr_spin_lock;
188 diva_os_spin_lock_t data_spin_lock;
189 diva_os_soft_isr_t req_soft_isr;
190 diva_os_soft_isr_t isr_soft_isr;
191 diva_os_atomic_t in_dpc;
192 PBUFFER RBuffer; /* Copy of receive lookahead buffer */
193 word e_max;
194 word e_count;
195 E_INFO *e_tbl;
196 word assign; /* list of pending ASSIGNs */
197 word head; /* head of request queue */
198 word tail; /* tail of request queue */
199 ADAPTER a; /* not a separate structure */
200 void (*out)(ADAPTER *a);
201 byte (*dpc)(ADAPTER *a);
202 byte (*tst_irq)(ADAPTER *a);
203 void (*clr_irq)(ADAPTER *a);
204 int (*load)(PISDN_ADAPTER);
205 int (*mapmem)(PISDN_ADAPTER);
206 int (*chkIrq)(PISDN_ADAPTER);
207 void (*disIrq)(PISDN_ADAPTER);
208 void (*start)(PISDN_ADAPTER);
209 void (*stop)(PISDN_ADAPTER);
210 void (*rstFnc)(PISDN_ADAPTER);
211 void (*trapFnc)(PISDN_ADAPTER);
212 dword (*DetectDsps)(PISDN_ADAPTER);
213 void (*os_trap_nfy_Fnc)(PISDN_ADAPTER, dword);
214 diva_os_isr_callback_t diva_isr_handler;
215 dword sdram_bar; /* must be 32 bit */
216 dword fpga_features;
217 volatile int pcm_pending;
218 volatile void *pcm_data;
219 diva_xdi_capi_cfg_t capi_cfg;
220 dword tasks;
221 void *dma_map;
222 int (*DivaAdapterTestProc)(PISDN_ADAPTER);
223 void *AdapterTestMemoryStart;
224 dword AdapterTestMemoryLength;
225 const byte *cfg_lib_memory_init;
226 dword cfg_lib_memory_init_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227};
228/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800229 Entity table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 --------------------------------------------------------------------- */
231struct e_info_s {
Joe Perches475be4d2012-02-19 19:52:38 -0800232 ENTITY *e;
233 byte next; /* chaining index */
234 word assign_ref; /* assign reference */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235};
236/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800237 S-cards shared ram structure for loading
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 --------------------------------------------------------------------- */
239struct s_load {
Joe Perches475be4d2012-02-19 19:52:38 -0800240 byte ctrl;
241 byte card;
242 byte msize;
243 byte fill0;
244 word ebit;
245 word elocl;
246 word eloch;
247 byte reserved[20];
248 word signature;
249 byte fill[224];
250 byte b[256];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251};
252#define PR_RAM ((struct pr_ram *)0)
253#define RAM ((struct dual *)0)
254/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800255 platform specific conversions
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 --------------------------------------------------------------------- */
Joe Perches475be4d2012-02-19 19:52:38 -0800257extern void *PTR_P(ADAPTER *a, ENTITY *e, void *P);
258extern void *PTR_X(ADAPTER *a, ENTITY *e);
259extern void *PTR_R(ADAPTER *a, ENTITY *e);
260extern void CALLBACK(ADAPTER *a, ENTITY *e);
261extern void set_ram(void **adr_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800263 ram access functions for io mapped cards
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 --------------------------------------------------------------------- */
Joe Perches475be4d2012-02-19 19:52:38 -0800265byte io_in(ADAPTER *a, void *adr);
266word io_inw(ADAPTER *a, void *adr);
267void io_in_buffer(ADAPTER *a, void *adr, void *P, word length);
268void io_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
269void io_out(ADAPTER *a, void *adr, byte data);
270void io_outw(ADAPTER *a, void *adr, word data);
271void io_out_buffer(ADAPTER *a, void *adr, void *P, word length);
272void io_inc(ADAPTER *a, void *adr);
273void bri_in_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
274 void *Buf, dword Len);
275int bri_out_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
276 void *Buf, dword Len, int Verify);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800278 ram access functions for memory mapped cards
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 --------------------------------------------------------------------- */
Joe Perches475be4d2012-02-19 19:52:38 -0800280byte mem_in(ADAPTER *a, void *adr);
281word mem_inw(ADAPTER *a, void *adr);
282void mem_in_buffer(ADAPTER *a, void *adr, void *P, word length);
283void mem_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
284void mem_out(ADAPTER *a, void *adr, byte data);
285void mem_outw(ADAPTER *a, void *adr, word data);
286void mem_out_buffer(ADAPTER *a, void *adr, void *P, word length);
287void mem_inc(ADAPTER *a, void *adr);
288void mem_in_dw(ADAPTER *a, void *addr, dword *data, int dwords);
289void mem_out_dw(ADAPTER *a, void *addr, const dword *data, int dwords);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800291 functions exported by io.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 --------------------------------------------------------------------- */
Joe Perches475be4d2012-02-19 19:52:38 -0800293extern IDI_CALL Requests[MAX_ADAPTER];
294extern void DIDpcRoutine(struct _diva_os_soft_isr *psoft_isr,
295 void *context);
296extern void request(PISDN_ADAPTER, ENTITY *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297/* ---------------------------------------------------------------------
Joe Perches475be4d2012-02-19 19:52:38 -0800298 trapFn helpers, used to recover debug trace from dead card
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 --------------------------------------------------------------------- */
300typedef struct {
Joe Perches475be4d2012-02-19 19:52:38 -0800301 word *buf;
302 word cnt;
303 word out;
304} Xdesc;
305extern void dump_trap_frame(PISDN_ADAPTER IoAdapter, byte __iomem *exception);
306extern void dump_xlog_buffer(PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307/* --------------------------------------------------------------------- */
308#endif /* } __DIVA_XDI_COMMON_IO_H_INC__ */