Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
[pandora-kernel.git] / drivers / staging / wlags49_h2 / dhf.h
1
2 /*   vim:tw=110:ts=4: */
3 #ifndef DHF_H
4 #define DHF_H
5
6 /**************************************************************************************************************
7 *
8 * FILE   :      DHF.H
9 *
10 * DATE  :       $Date: 2004/07/19 08:16:14 $   $Revision: 1.2 $
11 * Original      :       2004/05/17 07:33:13    Revision: 1.25      Tag: hcf7_t20040602_01
12 * Original      :       2004/05/11 06:03:14    Revision: 1.24      Tag: hcf7_t7_20040513_01
13 * Original      :       2004/04/15 09:24:42    Revision: 1.22      Tag: hcf7_t7_20040415_01
14 * Original      :       2004/04/09 14:35:52    Revision: 1.21      Tag: t7_20040413_01
15 * Original      :       2004/04/01 15:32:55    Revision: 1.18      Tag: t7_20040401_01
16 * Original      :       2004/03/10 15:39:28    Revision: 1.15      Tag: t20040310_01
17 * Original      :       2004/03/04 11:03:38    Revision: 1.13      Tag: t20040304_01
18 * Original      :       2004/02/25 14:14:37    Revision: 1.11      Tag: t20040302_03
19 * Original      :       2004/02/24 13:00:28    Revision: 1.10      Tag: t20040224_01
20 * Original      :       2004/02/19 10:57:28    Revision: 1.8      Tag: t20040219_01
21 *
22 * AUTHOR :      John Meertens
23 *                       Nico Valster
24 *
25 * SPECIFICATION: .........
26 *
27 * DESC   :      structure definitions and function prototypes for unit DHF.
28 *
29 *                       Customizable via HCFCFG.H, which is included indirectly via HCF.H
30 *
31 ***************************************************************************************************************
32 *
33 *
34 * SOFTWARE LICENSE
35 *
36 * This software is provided subject to the following terms and conditions,
37 * which you should read carefully before using the software.  Using this
38 * software indicates your acceptance of these terms and conditions.  If you do
39 * not agree with these terms and conditions, do not use the software.
40 *
41 * COPYRIGHT (C) 1994 - 1995     by AT&T.                                All Rights Reserved
42 * COPYRIGHT (C) 1999 - 2000 by Lucent Technologies.     All Rights Reserved
43 * COPYRIGHT (C) 2001 - 2004     by Agere Systems Inc.   All Rights Reserved
44 * All rights reserved.
45 *
46 * Redistribution and use in source or binary forms, with or without
47 * modifications, are permitted provided that the following conditions are met:
48 *
49 * . Redistributions of source code must retain the above copyright notice, this
50 *    list of conditions and the following Disclaimer as comments in the code as
51 *    well as in the documentation and/or other materials provided with the
52 *    distribution.
53 *
54 * . Redistributions in binary form must reproduce the above copyright notice,
55 *    this list of conditions and the following Disclaimer in the documentation
56 *    and/or other materials provided with the distribution.
57 *
58 * . Neither the name of Agere Systems Inc. nor the names of the contributors
59 *    may be used to endorse or promote products derived from this software
60 *    without specific prior written permission.
61 *
62 * Disclaimer
63 *
64 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
65 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
66 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
67 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
68 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
69 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
70 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
71 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
72 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
73 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
74 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
75 * DAMAGE.
76 *
77 *
78 **************************************************************************************************************/
79
80
81 #ifdef _WIN32_WCE
82 #include <windef.h>
83 #endif
84
85 #include "hcf.h"                        /* includes HCFCFG.H too */
86
87 #ifdef DHF_UIL
88 #define GET_INFO(pp)  uil_get_info((LTVP)pp)
89 #define PUT_INFO(pp)  uil_put_info((LTVP)pp)
90 #else
91 #define GET_INFO(pp)  hcf_get_info(ifbp, (LTVP)pp)
92 #define PUT_INFO(pp)  hcf_put_info(ifbp, (LTVP)pp)
93 #endif
94
95
96 /*---- Defines --------------------------------------------------------------*/
97 #define CODEMASK                                0x0000FFFFL     /* Codemask for plug records */
98
99 /*---- Error numbers --------------------------------------------------------*/
100
101 #define DHF_ERR_INCOMP_FW               0x40    /* Image not compatible with NIC */
102
103 /*---- Type definitions -----------------------------------------------------*/
104 /* needed by dhf_wrap.c */
105
106 typedef struct {
107         LTVP    ltvp;
108         hcf_16  len;
109 } LTV_INFO_STRUCT , *LTV_INFO_STRUCT_PTR;
110
111
112 /*
113  * Type:        plugrecord
114  *
115  * Abstract: This structure represents a Plug Data Record.
116  *
117  * Description:
118  * This structure is used to overlay the plug records in the firmware memory image.
119  */
120
121 typedef struct {
122         hcf_32  code;           /* Code to plug */
123         hcf_32  addr;           /* Address within the memory image to plug it in */
124         hcf_32  len;            /* The # of bytes which are available to store it */
125 } plugrecord;
126
127 /*
128  * Type:        stringrecord
129  *
130  * Abstract: This structure represents a Firmware debug/assert string
131  *
132  * Description:
133  * This structure is used to get assert and debug outputs in the driver and/or utility to be
134  * able to get more visability of the FW.
135  */
136
137 #define MAX_DEBUGSTRINGS                1024
138 #define MAX_DEBUGSTRING_LEN       82
139
140 typedef struct {
141         hcf_32  id;
142         char    str[MAX_DEBUGSTRING_LEN];
143 } stringrecord;
144
145 /*
146  * Type:        exportrecord
147  *
148  * Abstract: This structure represents a Firmware export of a variable
149  *
150  * Description:
151  * This structure is used to get the address and name of a FW variable.
152  */
153
154 #define MAX_DEBUGEXPORTS                2048
155 #define MAX_DEBUGEXPORT_LEN       12
156
157 typedef struct {
158         hcf_32  id;
159         char    str[MAX_DEBUGEXPORT_LEN];
160 } exportrecord;
161
162 /* Offsets in memimage array p[] */
163 #define FWSTRINGS_FUNCTION              0
164 #define FWEXPORTS_FUNCTION              1
165
166 /*
167  * Type: memimage
168  *
169  * Abstract: The "root" description of a complete memory image
170  *
171  * Description:
172  * This type represents an entire memory image. The image is built up of several
173  * segments. These segments need not be contiguous areas in memory, in other words
174  * the image may contain 'holes'.
175  *
176  * The 'codep' field points to an array of segment_descriptor structures.
177  * The end of the array is indicated by a segment_descriptor of which all fields are zero.
178  * The 'execution' field is a 32-bit address representing the execution address
179  *      of the firmware within the memory image. This address is zero in case of non-volatile
180  *      memory download.
181  * The 'compat' field points to an array of TODO
182  *      The end of the array is indicated by a plug record of which all fields are zero.
183  * The 'identity' field points to an array of TODO
184  *      The end of the array is indicated by a plug record of which all fields are zero.
185  * The Hermes-I specific 'pdaplug' field points to an array of Production Data Plug record structures.
186  *      The end of the array is indicated by a plug record of which all fields are zero.
187  * The Hermes-I specific 'priplug' field points to an array of Primary Information Plug record structures.
188  *      The end of the array is indicated by a plug record of which all fields are zero.
189  */
190 typedef struct {
191         char                                    signature[14+1+1];      /* signature (see DHF.C) + C/LE-Bin/BE-Bin-flag + format version */
192         CFG_PROG_STRCT FAR *codep;                              /* */
193         hcf_32                          execution;              /* Execution address of the firmware */
194         void FAR *place_holder_1;
195         void FAR                        *place_holder_2;
196         CFG_RANGE20_STRCT FAR   *compat;                /* Pointer to the compatibility info records */
197         CFG_IDENTITY_STRCT FAR  *identity;              /* Pointer to the identity info records */
198         void FAR                                *p[2];                          /* (Up to 9) pointers for (future) expansion
199                                                                                                  * currently in use:
200                                                                                                  *  - F/W printf information
201                                                                                                  */
202 } memimage;
203
204
205
206 /*-----------------------------------------------------------------------------
207  *
208  * DHF function prototypes
209  *
210  *---------------------------------------------------------------------------*/
211
212 EXTERN_C int dhf_download_fw(void *ifbp, memimage *fw); /* ifbp, ignored when using the UIL */
213 EXTERN_C int dhf_download_binary(memimage *fw);
214
215
216 /*-----------------------------------------------------------------------------
217  *
218  * Functions to be provided by the user of the DHF module.
219  *
220  *---------------------------------------------------------------------------*/
221
222 /* defined in DHF.C; see there for comments */
223 EXTERN_C hcf_16 *find_record_in_pda(hcf_16 *pdap, hcf_16 code);
224
225 #endif  /* DHF_H */
226