xref: /wlan-driver/fw-api/hw/qcn9000/HALhwio.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2019, The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for any
5*5113495bSYour Name  * purpose with or without fee is hereby granted, provided that the above
6*5113495bSYour Name  * copyright notice and this permission notice appear in all copies.
7*5113495bSYour Name  *
8*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*5113495bSYour Name  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*5113495bSYour Name  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*5113495bSYour Name  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*5113495bSYour Name  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*5113495bSYour Name  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*5113495bSYour Name  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*5113495bSYour Name  */
16*5113495bSYour Name 
17*5113495bSYour Name #ifndef HAL_HWIO_H
18*5113495bSYour Name #define HAL_HWIO_H
19*5113495bSYour Name 
20*5113495bSYour Name /*===========================================================================
21*5113495bSYour Name  *
22*5113495bSYour Name  * HWIO REGISTER INPUT/OUTPUT HEADER FILE
23*5113495bSYour Name  *
24*5113495bSYour Name  * DESCRIPTION
25*5113495bSYour Name  * This interface is a replacement for that represented by
26*5113495bSYour Name  * msm<ASIC>reg.h, msm<ASIC>io.h and msm<ASIC>redefs.h. For further background
27*5113495bSYour Name  * and documentation on this interface, please see word docs and ppt docs at
28*5113495bSYour Name  *
29*5113495bSYour Name  * This file, together with msmhwioreg.h, provides a portable interface
30*5113495bSYour Name  * from the perspective of chip address file coupling to DMSS register
31*5113495bSYour Name  * I/O software. The interface defined by msmhwio.h and msmhwioreg.h
32*5113495bSYour Name  * encapsulates register name, size, type and access method.
33*5113495bSYour Name  *
34*5113495bSYour Name  * msmhwioreg.h is an auto-generated file that may be subsequently edited
35*5113495bSYour Name  * by hand to handle arbitrary register and bit field name changes, and
36*5113495bSYour Name  * register type and size changes. When hand editing, one does not directly
37*5113495bSYour Name  * hand edit msmhwioreg.h or msm<ASIC>reg.h except to cut/paste registers
38*5113495bSYour Name  * or bitmasks from msm<ASIC>reg.h to msm<ASIC>reg_port.h or from msmhwioreg.h
39*5113495bSYour Name  * to msmhwioreg_port.h. One edits an msmreg.pl input file, possibly named
40*5113495bSYour Name  * something like msmreg_port.dat, to add patterns which msmreg.pl matches
41*5113495bSYour Name  * during chip address file parsing. If a pattern from input the port.dat input
42*5113495bSYour Name  * file is matched, that register or bitmask is not ouput to the register
43*5113495bSYour Name  * header files, but is output to the *_port.h versions of the register header
44*5113495bSYour Name  * files. This mechanism allows hand edit of register header file without loss
45*5113495bSYour Name  * of hand edits on each successive re-parse of chip address file. See msmreg.pl
46*5113495bSYour Name  * header comments for more information.
47*5113495bSYour Name  *
48*5113495bSYour Name  * msmhwioreg.h also handles register access method changes by allowing users
49*5113495bSYour Name  * to change a registers I/O functions on a per register basis. By default,
50*5113495bSYour Name  * when auto-generated, all register I/O functions are selected from the
51*5113495bSYour Name  * inline functions listed below.
52*5113495bSYour Name  *
53*5113495bSYour Name  * (Note that currently inline functions are not used. This is because
54*5113495bSYour Name  * rex_int_lock/rex_int_free are not inline and there the masked IO functions
55*5113495bSYour Name  * would not inline since the compiler will not inline a function that calls
56*5113495bSYour Name  * a function. The task of figuring out how to inline rex_int_lock has been
57*5113495bSYour Name  * deferred. So, for the time being, the functions described below are
58*5113495bSYour Name  * implemented as #define marcos.)
59*5113495bSYour Name  *
60*5113495bSYour Name  * To customize register I/O for a single register, one follows the porting
61*5113495bSYour Name  * mechanism mentioned above and changes the input/output function for the
62*5113495bSYour Name  * desired register.
63*5113495bSYour Name  *
64*5113495bSYour Name  * Direct, un-encapsulated, use of register addresses or register header file
65*5113495bSYour Name  * components is discouraged. To that end, the interface described here fully
66*5113495bSYour Name  * encapsulates all the CAF components including register address, bit field mask,
67*5113495bSYour Name  * and bit field shift values in addition to register input and output.
68*5113495bSYour Name  *
69*5113495bSYour Name  * INLINE byte in_byte(dword addr)
70*5113495bSYour Name  * INLINE byte in_byte_masked(dword addr, dword mask)
71*5113495bSYour Name  * INLINE void out_byte(dword addr, byte val)
72*5113495bSYour Name  * INLINE void out_byte_masked(dword io, dword mask, byte val)
73*5113495bSYour Name  *
74*5113495bSYour Name  * INLINE word in_word(dword addr)
75*5113495bSYour Name  * INLINE word in_word_masked(dword addr, dword mask)
76*5113495bSYour Name  * INLINE void out_word(dword addr, word val)
77*5113495bSYour Name  * INLINE void out_word_masked(dword io, dword mask, word val)
78*5113495bSYour Name  *
79*5113495bSYour Name  * INLINE dword in_dword(dword addr)
80*5113495bSYour Name  * INLINE dword in_dword_masked(dword addr, dword mask)
81*5113495bSYour Name  * INLINE void out_dword(dword addr, dword val)
82*5113495bSYour Name  * INLINE void out_dword_masked(dword io, dword mask, dword val)
83*5113495bSYour Name  *
84*5113495bSYour Name  * Initially, then there is a one-to-one correspondance between the inline
85*5113495bSYour Name  * functions above and the macro interface below with the inline functions
86*5113495bSYour Name  * intended as implementation detail of the macro interface. Register access
87*5113495bSYour Name  * method changes of arbitrary complexity are handled by writing the
88*5113495bSYour Name  * appropriate new I/O function and replacing the existing one for the
89*5113495bSYour Name  * register under consideration.
90*5113495bSYour Name  *
91*5113495bSYour Name  * The interface described below takes chip address file (CAF) symbols as input.
92*5113495bSYour Name  * Wherever hwiosym, hsio_regsym, or hwio_fldsym appears below, that is
93*5113495bSYour Name  * a CAF register or bit field name.
94*5113495bSYour Name  *
95*5113495bSYour Name  *
96*5113495bSYour Name  * #define HWIO_IN(hwiosym)
97*5113495bSYour Name  *    Perform input on register hwiosym. Replaces MSM_IN, MSM_INH and MSM_INW.
98*5113495bSYour Name  *
99*5113495bSYour Name  * #define HWIO_INM(hwiosym, m)
100*5113495bSYour Name  *    Perform masked input on register hwiosym applying mask m.
101*5113495bSYour Name  *    Replaces MSM_INM, MSM_INHM, and MSM_INWM.
102*5113495bSYour Name  *
103*5113495bSYour Name  * #define HWIO_INF(hwio_regsym, hwio_fldsym)
104*5113495bSYour Name  *    Read the value from the given field in the given register.
105*5113495bSYour Name  *
106*5113495bSYour Name  * #define HWIO_OUT(hwiosym, val)
107*5113495bSYour Name  *    Write input val on register hwiosym. Replaces MSM_OUT, MSM_OUTH, and
108*5113495bSYour Name  *    MSM_OUTW.
109*5113495bSYour Name  *
110*5113495bSYour Name  * #define HWIO_OUTM(hwiosym, mask, val)
111*5113495bSYour Name  *    Write input val on register hwiosym. Input mask is applied to shadow
112*5113495bSYour Name  *    memory and val such that only bits in mask are updated on register hwiosym
113*5113495bSYour Name  *    and shadow memory. Replaces MSM_OUTM, MSM_OUTHM, and MSM_OUTWM.
114*5113495bSYour Name  *
115*5113495bSYour Name  * #define HWIO_OUTF(hwio_regsym, hwio_fldsym, val)
116*5113495bSYour Name  *    Set the given field in the given register to the given value.
117*5113495bSYour Name  *
118*5113495bSYour Name  * #define HWIO_ADDR(hwiosym)
119*5113495bSYour Name  *    Get the register address of hwiosym. Replaces the unencapulsated use of
120*5113495bSYour Name  *    of numeric literal HEX constants for register address.
121*5113495bSYour Name  *
122*5113495bSYour Name  * #define HWIO_RMSK(hwiosym)
123*5113495bSYour Name  *    Get the mask describing valid bits in register hwiosym. Replaces direct,
124*5113495bSYour Name  *    unencapsulated use of mask symbol from register header file.
125*5113495bSYour Name  *
126*5113495bSYour Name  * #define HWIO_RSHFT(hwiosym)
127*5113495bSYour Name  *    Get the shift value of the least significant bit in register hwiosym.a
128*5113495bSYour Name  *    Replaces SHIFT_FROM_MASK.
129*5113495bSYour Name  *
130*5113495bSYour Name  * #define HWIO_FMSK(hwio_regsym, hwio_fldsym)
131*5113495bSYour Name  *    Get the bit field mask for bit field hwio_fldsym in register hwio_regsym.
132*5113495bSYour Name  *    Replaces the direct, unencapsulated use of bit field masks from register
133*5113495bSYour Name  *    header file.
134*5113495bSYour Name  *
135*5113495bSYour Name  * #define HWIO_SHFT(hwio_regsym, hwio_fldsym)
136*5113495bSYour Name  *    Get the shift value of the least significant bit of bit field hwio_fldsym
137*5113495bSYour Name  *    in register hwio_regsym. Replaces SHIFT_FROM_MASK.
138*5113495bSYour Name  *
139*5113495bSYour Name  *===========================================================================*/
140*5113495bSYour Name 
141*5113495bSYour Name /*===========================================================================
142*5113495bSYour Name  *
143*5113495bSYour Name  * EDIT HISTORY FOR FILE
144*5113495bSYour Name  *
145*5113495bSYour Name  * This section contains comments describing changes made to this file.
146*5113495bSYour Name  * Notice that changes are listed in reverse chronological order.
147*5113495bSYour Name  *
148*5113495bSYour Name  * when       who     what, where, why
149*5113495bSYour Name  * --------   ---     ----------------------------------------------------------
150*5113495bSYour Name  * 02/01/08   gfr     Wrap passed in mask with parenthesis.
151*5113495bSYour Name  * 12/06/07   gfr     More depreciated MSM macros.
152*5113495bSYour Name  * 11/19/07   gfr     Added MSM_R macro.
153*5113495bSYour Name  * 11/19/07   gfr     Removed obselete hwio_interrupts_locked_by_user.
154*5113495bSYour Name  * 10/26/07   gfr     Fix MSM_SET macro.
155*5113495bSYour Name  * 10/10/07   gfr     Added mappings for MSM_R_MASKED and some others.
156*5113495bSYour Name  * 09/21/07   gfr     Added mapping for MSM_W_MASKED_i.
157*5113495bSYour Name  * 09/21/07   gfr     Merged in changes for WinCE and 7k.
158*5113495bSYour Name  * 04/24/07   gfr     Support for HWIO_INTLOCK/INTFREE to remove lint warnings.
159*5113495bSYour Name  * 04/09/07   gfr     Cleanup, compile support for HWIO_INTLOCK/HWIO_INTFREE.
160*5113495bSYour Name  * 09/19/06   eav     Added HWIO_PHYS, HWIO_PHYSI, HWIO_PHYSI2
161*5113495bSYour Name  * 08/28/06   gfr     Added HWIO_RMSKI, HWIO_SHDW, HWIO_SHDWI
162*5113495bSYour Name  * 06/23/06   gfr     Added HWIO_INF, HWIO_INFI, HWIO_OUTF and HWIO_OUTFI
163*5113495bSYour Name  * 06/16/05   eav     Changed  __msmhwio_addri to call HWIO_##hwiosym##_ADDRI
164*5113495bSYour Name  * 10/10/02   aks     Map MSM_OUTSH() used by the MSM6200, to the equivalent
165*5113495bSYour Name  *                    macro in the MSM6300.
166*5113495bSYour Name  * 4/29/02    cr      initial revision
167*5113495bSYour Name  *===========================================================================*/
168*5113495bSYour Name 
169*5113495bSYour Name 
170*5113495bSYour Name /*===========================================================================
171*5113495bSYour Name  *
172*5113495bSYour Name  *                         INCLUDE FILES
173*5113495bSYour Name  *
174*5113495bSYour Name  *===========================================================================*/
175*5113495bSYour Name 
176*5113495bSYour Name #ifdef FEATURE_WINCE_OAL
177*5113495bSYour Name #include <windows.h>
178*5113495bSYour Name #include <nkintr.h>
179*5113495bSYour Name #endif
180*5113495bSYour Name 
181*5113495bSYour Name #ifndef _ARM_ASM_
182*5113495bSYour Name #include "HALcomdef.h"
183*5113495bSYour Name #endif
184*5113495bSYour Name 
185*5113495bSYour Name 
186*5113495bSYour Name 
187*5113495bSYour Name /*===========================================================================
188*5113495bSYour Name  *
189*5113495bSYour Name  *                         EXTERNAL DECLARATIONS
190*5113495bSYour Name  *
191*5113495bSYour Name  *===========================================================================*/
192*5113495bSYour Name #ifdef __cplusplus
193*5113495bSYour Name extern "C" {
194*5113495bSYour Name #endif
195*5113495bSYour Name 
196*5113495bSYour Name #ifndef _ARM_ASM_
197*5113495bSYour Name extern uint32 rex_int_lock(void);
198*5113495bSYour Name extern uint32 rex_int_free(void);
199*5113495bSYour Name 
200*5113495bSYour Name uint32 pti_inpdw(uint32 * port);
201*5113495bSYour Name void pti_outpdw(uint32 * port, uint32 val);
202*5113495bSYour Name #endif
203*5113495bSYour Name 
204*5113495bSYour Name #ifdef __cplusplus
205*5113495bSYour Name }
206*5113495bSYour Name #endif
207*5113495bSYour Name 
208*5113495bSYour Name 
209*5113495bSYour Name /* -----------------------------------------------------------------------
210*5113495bSYour Name ** Macros
211*5113495bSYour Name ** ----------------------------------------------------------------------- */
212*5113495bSYour Name 
213*5113495bSYour Name /**
214*5113495bSYour Name   @addtogroup macros
215*5113495bSYour Name   @{
216*5113495bSYour Name */
217*5113495bSYour Name 
218*5113495bSYour Name /**
219*5113495bSYour Name  * Map a base name to the pointer to access the base.
220*5113495bSYour Name  *
221*5113495bSYour Name  * This macro maps a base name to the pointer to access the base.
222*5113495bSYour Name  * This is generally just used internally.
223*5113495bSYour Name  *
224*5113495bSYour Name  */
225*5113495bSYour Name #define HWIO_BASE_PTR(base) base##_BASE_PTR
226*5113495bSYour Name 
227*5113495bSYour Name 
228*5113495bSYour Name /**
229*5113495bSYour Name  * Declare a HWIO base pointer.
230*5113495bSYour Name  *
231*5113495bSYour Name  * This macro will declare a HWIO base pointer data structure.  The pointer
232*5113495bSYour Name  * will always be declared as a weak symbol so multiple declarations will
233*5113495bSYour Name  * resolve correctly to the same data at link-time.
234*5113495bSYour Name  */
235*5113495bSYour Name #ifdef __ARMCC_VERSION
236*5113495bSYour Name   #define DECLARE_HWIO_BASE_PTR(base) __weak uint8 *HWIO_BASE_PTR(base)
237*5113495bSYour Name #else
238*5113495bSYour Name   #define DECLARE_HWIO_BASE_PTR(base) uint8 *HWIO_BASE_PTR(base)
239*5113495bSYour Name #endif
240*5113495bSYour Name 
241*5113495bSYour Name /**
242*5113495bSYour Name   @}
243*5113495bSYour Name */
244*5113495bSYour Name 
245*5113495bSYour Name 
246*5113495bSYour Name /**
247*5113495bSYour Name   @addtogroup hwio_macros
248*5113495bSYour Name   @{
249*5113495bSYour Name */
250*5113495bSYour Name 
251*5113495bSYour Name /**
252*5113495bSYour Name  * @name Address Macros
253*5113495bSYour Name  *
254*5113495bSYour Name  * Macros for getting register addresses.
255*5113495bSYour Name  * These macros are used for retrieving the address of a register.
256*5113495bSYour Name  * HWIO_ADDR* will return the directly accessible address (virtual or physical based
257*5113495bSYour Name  * on environment), HWIO_PHYS* will always return the physical address.
258*5113495bSYour Name  * The offset from the base region can be retrieved using HWIO_OFFS*.
259*5113495bSYour Name  * The "X" extension is used for explicit addressing where the base address of
260*5113495bSYour Name  * the module in question is provided as an argument to the macro.
261*5113495bSYour Name  *
262*5113495bSYour Name  * @{
263*5113495bSYour Name  */
264*5113495bSYour Name #define HWIO_ADDR(hwiosym)                               __msmhwio_addr(hwiosym)
265*5113495bSYour Name #define HWIO_ADDRI(hwiosym, index)                       __msmhwio_addri(hwiosym, index)
266*5113495bSYour Name #define HWIO_ADDRI2(hwiosym, index1, index2)             __msmhwio_addri2(hwiosym, index1, index2)
267*5113495bSYour Name #define HWIO_ADDRI3(hwiosym, index1, index2, index3)     __msmhwio_addri3(hwiosym, index1, index2, index3)
268*5113495bSYour Name 
269*5113495bSYour Name #define HWIO_ADDRX(base, hwiosym)                           __msmhwio_addrx(base, hwiosym)
270*5113495bSYour Name #define HWIO_ADDRXI(base, hwiosym, index)                   __msmhwio_addrxi(base, hwiosym, index)
271*5113495bSYour Name #define HWIO_ADDRXI2(base, hwiosym, index1, index2)         __msmhwio_addrxi2(base, hwiosym, index1, index2)
272*5113495bSYour Name #define HWIO_ADDRXI3(base, hwiosym, index1, index2, index3) __msmhwio_addrxi3(base, hwiosym, index1, index2, index3)
273*5113495bSYour Name 
274*5113495bSYour Name 
275*5113495bSYour Name #define HWIO_PHYS(hwiosym)                               __msmhwio_phys(hwiosym)
276*5113495bSYour Name #define HWIO_PHYSI(hwiosym, index)                       __msmhwio_physi(hwiosym, index)
277*5113495bSYour Name #define HWIO_PHYSI2(hwiosym, index1, index2)             __msmhwio_physi2(hwiosym, index1, index2)
278*5113495bSYour Name #define HWIO_PHYSI3(hwiosym, index1, index2, index3)     __msmhwio_physi3(hwiosym, index1, index2, index3)
279*5113495bSYour Name 
280*5113495bSYour Name #define HWIO_PHYSX(base, hwiosym)                           __msmhwio_physx(base, hwiosym)
281*5113495bSYour Name #define HWIO_PHYSXI(base, hwiosym, index)                   __msmhwio_physxi(base, hwiosym, index)
282*5113495bSYour Name #define HWIO_PHYSXI2(base, hwiosym, index1, index2)         __msmhwio_physxi2(base, hwiosym, index1, index2)
283*5113495bSYour Name #define HWIO_PHYSXI3(base, hwiosym, index1, index2, index3) __msmhwio_physxi3(base, hwiosym, index1, index2, index3)
284*5113495bSYour Name 
285*5113495bSYour Name #define HWIO_OFFS(hwiosym)                               __msmhwio_offs(hwiosym)
286*5113495bSYour Name #define HWIO_OFFSI(hwiosym, index)                       __msmhwio_offsi(hwiosym, index)
287*5113495bSYour Name #define HWIO_OFFSI2(hwiosym, index1, index2)             __msmhwio_offsi2(hwiosym, index1, index2)
288*5113495bSYour Name #define HWIO_OFFSI3(hwiosym, index1, index2, index3)     __msmhwio_offsi3(hwiosym, index1, index2, index3)
289*5113495bSYour Name 
290*5113495bSYour Name /** @} */
291*5113495bSYour Name 
292*5113495bSYour Name 
293*5113495bSYour Name /*===========================================================================
294*5113495bSYour Name  *
295*5113495bSYour Name  *                         MACRO DECLARATIONS
296*5113495bSYour Name  *
297*5113495bSYour Name  *===========================================================================*/
298*5113495bSYour Name 
299*5113495bSYour Name #define HWIO_POR(io)                                  HWIO_##io##_POR
300*5113495bSYour Name 
301*5113495bSYour Name /**
302*5113495bSYour Name  * @name Input Macros
303*5113495bSYour Name  *
304*5113495bSYour Name  * These macros are used for reading from a named hardware register.  Register
305*5113495bSYour Name  * arrays ("indexed") use the macros with the "I" suffix.  The "M" suffix
306*5113495bSYour Name  * indicates that the input will be masked with the supplied mask.  The HWIO_INF*
307*5113495bSYour Name  * macros take a field name and will do the appropriate masking and shifting
308*5113495bSYour Name  * to return just the value of that field.
309*5113495bSYour Name  * The "X" extension is used for explicit addressing where the base address of
310*5113495bSYour Name  * the module in question is provided as an argument to the macro.
311*5113495bSYour Name  *
312*5113495bSYour Name  * Generally you want to use either HWIO_IN or HWIO_INF (with required indexing).
313*5113495bSYour Name  *
314*5113495bSYour Name  * @{
315*5113495bSYour Name  */
316*5113495bSYour Name 
317*5113495bSYour Name #define HWIO_IN(hwiosym)                                         __msmhwio_in(hwiosym)
318*5113495bSYour Name #define HWIO_INI(hwiosym, index)                                 __msmhwio_ini(hwiosym, index)
319*5113495bSYour Name #define HWIO_INI2(hwiosym, index1, index2)                       __msmhwio_ini2(hwiosym, index1, index2)
320*5113495bSYour Name #define HWIO_INI3(hwiosym, index1, index2, index3)               __msmhwio_ini3(hwiosym, index1, index2, index3)
321*5113495bSYour Name 
322*5113495bSYour Name #define HWIO_INM(hwiosym, mask)                                  __msmhwio_inm(hwiosym, mask)
323*5113495bSYour Name #define HWIO_INMI(hwiosym, index, mask)                          __msmhwio_inmi(hwiosym, index, mask)
324*5113495bSYour Name #define HWIO_INMI2(hwiosym, index1, index2, mask)                __msmhwio_inmi2(hwiosym, index1, index2, mask)
325*5113495bSYour Name #define HWIO_INMI3(hwiosym, index1, index2, index3, mask)        __msmhwio_inmi3(hwiosym, index1, index2, index3, mask)
326*5113495bSYour Name 
327*5113495bSYour Name 
328*5113495bSYour Name #define HWIO_INF(io, field)                                      (HWIO_INM(io, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
329*5113495bSYour Name #define HWIO_INFI(io, index, field)                              (HWIO_INMI(io, index, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
330*5113495bSYour Name #define HWIO_INFI2(io, index1, index2, field)                    (HWIO_INMI2(io, index1, index2, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
331*5113495bSYour Name #define HWIO_INFI3(io, index1, index2, index3, field)            (HWIO_INMI3(io, index1, index2, index3, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
332*5113495bSYour Name 
333*5113495bSYour Name #define HWIO_INX(base, hwiosym)                                  __msmhwio_inx(base, hwiosym)
334*5113495bSYour Name #define HWIO_INXI(base, hwiosym, index)                          __msmhwio_inxi(base, hwiosym, index)
335*5113495bSYour Name #define HWIO_INXI2(base, hwiosym, index1, index2)                __msmhwio_inxi2(base, hwiosym, index1, index2)
336*5113495bSYour Name #define HWIO_INXI3(base, hwiosym, index1, index2, index3)        __msmhwio_inxi3(base, hwiosym, index1, index2, index3)
337*5113495bSYour Name 
338*5113495bSYour Name #define HWIO_INXM(base, hwiosym, mask)                           __msmhwio_inxm(base, hwiosym, mask)
339*5113495bSYour Name #define HWIO_INXMI(base, hwiosym, index, mask)                   __msmhwio_inxmi(base, hwiosym, index, mask)
340*5113495bSYour Name #define HWIO_INXMI2(base, hwiosym, index1, index2, mask)         __msmhwio_inxmi2(base, hwiosym, index1, index2, mask)
341*5113495bSYour Name #define HWIO_INXMI3(base, hwiosym, index1, index2, index3, mask) __msmhwio_inxmi3(base, hwiosym, index1, index2, index3, mask)
342*5113495bSYour Name 
343*5113495bSYour Name #define HWIO_INXF(base, io, field)                               (HWIO_INXM(base, io, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
344*5113495bSYour Name #define HWIO_INXFI(base, io, index, field)                       (HWIO_INXMI(base, io, index, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
345*5113495bSYour Name #define HWIO_INXFI2(base, io, index1, index2, field)             (HWIO_INXMI2(base, io, index1, index2, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
346*5113495bSYour Name #define HWIO_INXFI3(base, io, index1, index2, index3, field)     (HWIO_INXMI3(base, io, index1, index2, index3, HWIO_FMSK(io, field)) >> HWIO_SHFT(io, field))
347*5113495bSYour Name /** @} */
348*5113495bSYour Name 
349*5113495bSYour Name 
350*5113495bSYour Name 
351*5113495bSYour Name /**
352*5113495bSYour Name  * @name Output Macros
353*5113495bSYour Name  *
354*5113495bSYour Name  * These macros are used for writing to a named hardware register.  Register
355*5113495bSYour Name  * arrays ("indexed") use the macros with the "I" suffix.  The "M" suffix
356*5113495bSYour Name  * indicates that the output will be masked with the supplied mask (meaning these
357*5113495bSYour Name  * macros do a read first, mask in the supplied data, then write it back).
358*5113495bSYour Name  * The "X" extension is used for explicit addressing where the base address of
359*5113495bSYour Name  * the module in question is provided as an argument to the macro.
360*5113495bSYour Name  * The HWIO_OUTF* macros take a field name and will do the appropriate masking
361*5113495bSYour Name  * and shifting to output just the value of that field.
362*5113495bSYour Name  * HWIO_OUTV* registers take a named value instead of a numeric value and
363*5113495bSYour Name  * do the same masking/shifting as HWIO_OUTF.
364*5113495bSYour Name  *
365*5113495bSYour Name  * Generally you want to use either HWIO_OUT or HWIO_OUTF (with required indexing).
366*5113495bSYour Name  *
367*5113495bSYour Name  * @{
368*5113495bSYour Name  */
369*5113495bSYour Name 
370*5113495bSYour Name #define HWIO_OUT(hwiosym, val)                                   __msmhwio_out(hwiosym, val)
371*5113495bSYour Name #define HWIO_OUTI(hwiosym, index, val)                           __msmhwio_outi(hwiosym, index, val)
372*5113495bSYour Name #define HWIO_OUTI2(hwiosym, index1, index2, val)                 __msmhwio_outi2(hwiosym, index1, index2, val)
373*5113495bSYour Name #define HWIO_OUTI3(hwiosym, index1, index2, index3, val)         __msmhwio_outi3(hwiosym, index1, index2, index3, val)
374*5113495bSYour Name 
375*5113495bSYour Name #define HWIO_OUTM(hwiosym, mask, val)                            __msmhwio_outm(hwiosym, mask, val)
376*5113495bSYour Name #define HWIO_OUTMI(hwiosym, index, mask, val)                    __msmhwio_outmi(hwiosym, index, mask, val)
377*5113495bSYour Name #define HWIO_OUTMI2(hwiosym, index1, index2, mask, val)          __msmhwio_outmi2(hwiosym, index1, index2, mask, val)
378*5113495bSYour Name #define HWIO_OUTMI3(hwiosym, index1, index2, index3, mask, val)  __msmhwio_outmi3(hwiosym, index1, index2, index3, mask, val)
379*5113495bSYour Name 
380*5113495bSYour Name #define HWIO_OUTF(io, field, val)                                HWIO_OUTM(io, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
381*5113495bSYour Name #define HWIO_OUTFI(io, index, field, val)                        HWIO_OUTMI(io, index, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
382*5113495bSYour Name #define HWIO_OUTFI2(io, index1, index2, field, val)              HWIO_OUTMI2(io, index1, index2, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
383*5113495bSYour Name #define HWIO_OUTFI3(io, index1, index2, index3, field, val)      HWIO_OUTMI3(io, index1, index2, index3, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
384*5113495bSYour Name 
385*5113495bSYour Name 
386*5113495bSYour Name //----------------------------------------------------------------------------------------------
387*5113495bSYour Name //<DVICP> added for Waverider
388*5113495bSYour Name #define HWIO_OUTF2(io, field2, field1, val2, val1)   HWIO_OUTM(io, (HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
389*5113495bSYour Name                                                      ( (val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
390*5113495bSYour Name #define HWIO_OUTF3(io, field3, field2, field1, val3, val2, val1)   HWIO_OUTM(io, (HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
391*5113495bSYour Name                                                      ( (val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
392*5113495bSYour Name #define HWIO_OUTF4(io, field4, field3, field2, field1, val4, val3, val2, val1)   HWIO_OUTM(io, (HWIO_FMSK(io, field4) |HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
393*5113495bSYour Name                                                      ( (val4<<HWIO_SHFT(io, field4))|(val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
394*5113495bSYour Name #define HWIO_OUTF5(io, field5, field4, field3, field2, field1, val5, val4, val3, val2, val1)   HWIO_OUTM(io, (HWIO_FMSK(io, field5)|HWIO_FMSK(io, field4)|HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
395*5113495bSYour Name                                                      ( (val5<<HWIO_SHFT(io, field5))|(val4<<HWIO_SHFT(io, field4))|(val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
396*5113495bSYour Name #define HWIO_OUTF6(io, field6, field5, field4, field3, field2, field1, val6, val5, val4, val3, val2, val1)   HWIO_OUTM(io, (HWIO_FMSK(io, field6)|HWIO_FMSK(io, field5)|HWIO_FMSK(io, field4)|HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
397*5113495bSYour Name                                                      ( (val6<<HWIO_SHFT(io, field6))|(val5<<HWIO_SHFT(io, field5))|(val4<<HWIO_SHFT(io, field4))|(val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
398*5113495bSYour Name 
399*5113495bSYour Name #define HWIO_OUTF2I(io, idx, field2, field1, val2, val1)  HWIO_OUTMI(io, idx, (HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
400*5113495bSYour Name                                                           ( (val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
401*5113495bSYour Name #define HWIO_OUTF3I(io, idx, field3, field2, field1, val3, val2, val1)  HWIO_OUTMI(io, idx, (HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
402*5113495bSYour Name                                                           ( (val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
403*5113495bSYour Name #define HWIO_OUTF4I(io, idx, field4, field3, field2, field1, val4, val3, val2, val1)  HWIO_OUTMI(io, idx, (HWIO_FMSK(io, field4)|HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
404*5113495bSYour Name                                                           ( (val4<<HWIO_SHFT(io, field4))|(val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
405*5113495bSYour Name #define HWIO_OUTF5I(io, idx, field5, field4, field3, field2, field1, val5, val4, val3, val2, val1)  HWIO_OUTMI(io, idx, (HWIO_FMSK(io, field5)|HWIO_FMSK(io, field4)|HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
406*5113495bSYour Name                                                           ( (val5<<HWIO_SHFT(io, field5))|(val4<<HWIO_SHFT(io, field4))|(val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
407*5113495bSYour Name #define HWIO_OUTF6I(io, idx, field6, field5, field4, field3, field2, field1, val6, val5, val4, val3, val2, val1)  HWIO_OUTMI(io, idx, (HWIO_FMSK(io, field6)|HWIO_FMSK(io, field5)|HWIO_FMSK(io, field4)|HWIO_FMSK(io, field3)|HWIO_FMSK(io, field2)|HWIO_FMSK(io, field1)), \
408*5113495bSYour Name                                                           ( (val6<<HWIO_SHFT(io, field6))|(val5<<HWIO_SHFT(io, field5))|(val4<<HWIO_SHFT(io, field4))|(val3<<HWIO_SHFT(io, field3))|(val2<<HWIO_SHFT(io, field2))|(val1<<HWIO_SHFT(io, field1))) )
409*5113495bSYour Name // ----------------------------------------------------------------------------------------------
410*5113495bSYour Name 
411*5113495bSYour Name 
412*5113495bSYour Name #define HWIO_OUTV(io, field, val)                                HWIO_OUTM(io, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
413*5113495bSYour Name #define HWIO_OUTVI(io, index, field, val)                        HWIO_OUTMI(io, index, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
414*5113495bSYour Name #define HWIO_OUTVI2(io, index1, index2, field, val)              HWIO_OUTMI2(io, index1, index2, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
415*5113495bSYour Name #define HWIO_OUTVI3(io, index1, index2, index3, field, val)      HWIO_OUTMI3(io, index1, index2, index3, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
416*5113495bSYour Name 
417*5113495bSYour Name #define HWIO_OUTX(base, hwiosym, val)                                   __msmhwio_outx(base, hwiosym, val)
418*5113495bSYour Name #define HWIO_OUTXI(base, hwiosym, index, val)                           __msmhwio_outxi(base, hwiosym, index, val)
419*5113495bSYour Name #define HWIO_OUTXI2(base, hwiosym, index1, index2, val)                 __msmhwio_outxi2(base, hwiosym, index1, index2, val)
420*5113495bSYour Name #define HWIO_OUTXI3(base, hwiosym, index1, index2, index3, val)         __msmhwio_outxi3(base, hwiosym, index1, index2, index3, val)
421*5113495bSYour Name 
422*5113495bSYour Name #define HWIO_OUTXM(base, hwiosym, mask, val)                            __msmhwio_outxm(base, hwiosym, mask, val)
423*5113495bSYour Name #define HWIO_OUTXM2(base, hwiosym, mask1, mask2, val1, val2)  __msmhwio_outxm2(base, hwiosym, mask1, mask2, val1, val2)
424*5113495bSYour Name #define HWIO_OUTXM3(base, hwiosym, mask1, mask2, mask3, val1, val2, val3) __msmhwio_outxm3(base, hwiosym, mask1, mask2, mask3, val1, val2, val3)
425*5113495bSYour Name #define HWIO_OUTXM4(base, hwiosym, mask1, mask2, mask3, mask4, val1, val2, val3, val4) __msmhwio_outxm4(base, hwiosym, mask1, mask2, mask3, mask4, val1, val2, val3, val4)
426*5113495bSYour Name #define HWIO_OUTXMI(base, hwiosym, index, mask, val)                    __msmhwio_outxmi(base, hwiosym, index, mask, val)
427*5113495bSYour Name #define HWIO_OUTXMI2(base, hwiosym, index1, index2, mask, val)          __msmhwio_outxmi2(base, hwiosym, index1, index2, mask, val)
428*5113495bSYour Name #define HWIO_OUTXMI3(base, hwiosym, index1, index2, index3, mask, val)  __msmhwio_outxmi3(base, hwiosym, index1, index2, index3, mask, val)
429*5113495bSYour Name 
430*5113495bSYour Name #define HWIO_OUTXF(base, io, field, val)                                HWIO_OUTXM(base, io, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
431*5113495bSYour Name #define HWIO_OUTX2F(base, io, field1, field2, val1, val2)                                HWIO_OUTXM2(base, io, HWIO_FMSK(io, field1),  HWIO_FMSK(io, field2), (uint32)(val1) << HWIO_SHFT(io, field1), (uint32)(val2) << HWIO_SHFT(io, field2))
432*5113495bSYour Name #define HWIO_OUTX3F(base, io, field1, field2, field3, val1, val2, val3)                                HWIO_OUTXM3(base, io, HWIO_FMSK(io, field1),  HWIO_FMSK(io, field2),  HWIO_FMSK(io, field3),(uint32)(val1) << HWIO_SHFT(io, field1), (uint32)(val2) << HWIO_SHFT(io, field2), (uint32)(val3) << HWIO_SHFT(io, field3) )
433*5113495bSYour Name #define HWIO_OUTX4F(base, io, field1, field2, field3, field4, val1, val2, val3, val4)                                HWIO_OUTXM4(base, io, HWIO_FMSK(io, field1),  HWIO_FMSK(io, field2),  HWIO_FMSK(io, field3),  HWIO_FMSK(io, field4), (uint32)(val1) << HWIO_SHFT(io, field1) , (uint32)(val2) << HWIO_SHFT(io, field2), (uint32)(val3) << HWIO_SHFT(io, field3), (uint32)(val4) << HWIO_SHFT(io, field4) )
434*5113495bSYour Name #define HWIO_OUTXFI(base, io, index, field, val)                        HWIO_OUTXMI(base, io, index, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
435*5113495bSYour Name #define HWIO_OUTXFI2(base, io, index1, index2, field, val)              HWIO_OUTXMI2(base, io, index1, index2, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
436*5113495bSYour Name #define HWIO_OUTXFI3(base, io, index1, index2, index3, field, val)      HWIO_OUTXMI3(base, io, index1, index2, index3, HWIO_FMSK(io, field), (uint32)(val) << HWIO_SHFT(io, field))
437*5113495bSYour Name 
438*5113495bSYour Name #define HWIO_OUTXV(base, io, field, val)                                HWIO_OUTXM(base, io, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
439*5113495bSYour Name #define HWIO_OUTXVI(base, io, index, field, val)                        HWIO_OUTXMI(base, io, index, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
440*5113495bSYour Name #define HWIO_OUTXVI2(base, io, index1, index2, field, val)              HWIO_OUTXMI2(base, io, index1, index2, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
441*5113495bSYour Name #define HWIO_OUTXVI3(base, io, index1, index2, index3, field, val)      HWIO_OUTXMI3(base, io, index1, index2, index3, HWIO_FMSK(io, field), (uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field))
442*5113495bSYour Name /** @} */
443*5113495bSYour Name 
444*5113495bSYour Name 
445*5113495bSYour Name 
446*5113495bSYour Name /**
447*5113495bSYour Name  * @name Shift and Mask Macros
448*5113495bSYour Name  *
449*5113495bSYour Name  * Macros for getting shift and mask values for fields and registers.
450*5113495bSYour Name  *  HWIO_RMSK: The mask value for accessing an entire register.  For example:
451*5113495bSYour Name  *             @code
452*5113495bSYour Name  *             HWIO_RMSK(REG) -> 0xFFFFFFFF
453*5113495bSYour Name  *             @endcode
454*5113495bSYour Name  *  HWIO_RSHFT: The right-shift value for an entire register (rarely necessary).\n
455*5113495bSYour Name  *  HWIO_SHFT: The right-shift value for accessing a field in a register.  For example:
456*5113495bSYour Name  *             @code
457*5113495bSYour Name  *             HWIO_SHFT(REG, FLD) -> 8
458*5113495bSYour Name  *             @endcode
459*5113495bSYour Name  *  HWIO_FMSK: The mask value for accessing a field in a register.  For example:
460*5113495bSYour Name  *             @code
461*5113495bSYour Name  *             HWIO_FMSK(REG, FLD) -> 0xFF00
462*5113495bSYour Name  *             @endcode
463*5113495bSYour Name  *  HWIO_VAL:  The value for a field in a register.  For example:
464*5113495bSYour Name  *             @code
465*5113495bSYour Name  *             HWIO_VAL(REG, FLD, ON) -> 0x1
466*5113495bSYour Name  *             @endcode
467*5113495bSYour Name  *  HWIO_FVAL: This macro takes a numerical value and will shift and mask it into
468*5113495bSYour Name  *             the given field position.  For example:
469*5113495bSYour Name  *             @code
470*5113495bSYour Name  *             HWIO_FVAL(REG, FLD, 0x1) -> 0x100
471*5113495bSYour Name  *             @endcode
472*5113495bSYour Name  *  HWIO_FVALV: This macro takes a logical (named) value and will shift and mask it
473*5113495bSYour Name  *              into the given field position.  For example:
474*5113495bSYour Name  *              @code
475*5113495bSYour Name  *              HWIO_FVALV(REG, FLD, ON) -> 0x100
476*5113495bSYour Name  *              @endcode
477*5113495bSYour Name  *
478*5113495bSYour Name  * @{
479*5113495bSYour Name  */
480*5113495bSYour Name #define HWIO_RMSK(hwiosym)                               __msmhwio_rmsk(hwiosym)
481*5113495bSYour Name #define HWIO_RMSKI(hwiosym, index)                       __msmhwio_rmski(hwiosym, index)
482*5113495bSYour Name #define HWIO_RSHFT(hwiosym)                              __msmhwio_rshft(hwiosym)
483*5113495bSYour Name #define HWIO_SHFT(hwio_regsym, hwio_fldsym)              __msmhwio_shft(hwio_regsym, hwio_fldsym)
484*5113495bSYour Name #define HWIO_FMSK(hwio_regsym, hwio_fldsym)              __msmhwio_fmsk(hwio_regsym, hwio_fldsym)
485*5113495bSYour Name #define HWIO_VAL(io, field, val)                         __msmhwio_val(io, field, val)
486*5113495bSYour Name #define HWIO_FVAL(io, field, val)                        (((uint32)(val) << HWIO_SHFT(io, field)) & HWIO_FMSK(io, field))
487*5113495bSYour Name #define HWIO_FVALV(io, field, val)                       (((uint32)(HWIO_VAL(io, field, val)) << HWIO_SHFT(io, field)) & HWIO_FMSK(io, field))
488*5113495bSYour Name /** @} */
489*5113495bSYour Name 
490*5113495bSYour Name 
491*5113495bSYour Name /**
492*5113495bSYour Name  * @name Shadow Register Macros
493*5113495bSYour Name  *
494*5113495bSYour Name  * These macros are used for directly reading the value stored in a
495*5113495bSYour Name  * shadow register.
496*5113495bSYour Name  * Shadow registers are defined for write-only registers.  Generally these
497*5113495bSYour Name  * macros should not be necessary as HWIO_OUTM* macros will automatically use
498*5113495bSYour Name  * the shadow values internally.
499*5113495bSYour Name  *
500*5113495bSYour Name  * @{
501*5113495bSYour Name  */
502*5113495bSYour Name #define HWIO_SHDW(hwiosym)                               __msmhwio_shdw(hwiosym)
503*5113495bSYour Name #define HWIO_SHDWI(hwiosym, index)                       __msmhwio_shdwi(hwiosym, index)
504*5113495bSYour Name /** @} */
505*5113495bSYour Name 
506*5113495bSYour Name 
507*5113495bSYour Name 
508*5113495bSYour Name /**
509*5113495bSYour Name   @}
510*5113495bSYour Name */ /* end_group */
511*5113495bSYour Name 
512*5113495bSYour Name 
513*5113495bSYour Name 
514*5113495bSYour Name 
515*5113495bSYour Name 
516*5113495bSYour Name 
517*5113495bSYour Name 
518*5113495bSYour Name #define __msmhwio_in(hwiosym)                                   HWIO_##hwiosym##_IN
519*5113495bSYour Name #define __msmhwio_ini(hwiosym, index)                           HWIO_##hwiosym##_INI(index)
520*5113495bSYour Name #define __msmhwio_ini2(hwiosym, index1, index2)                 HWIO_##hwiosym##_INI2(index1, index2)
521*5113495bSYour Name #define __msmhwio_ini3(hwiosym, index1, index2, index3)         HWIO_##hwiosym##_INI3(index1, index2, index3)
522*5113495bSYour Name #define __msmhwio_inm(hwiosym, mask)                            HWIO_##hwiosym##_INM(mask)
523*5113495bSYour Name #define __msmhwio_inmi(hwiosym, index, mask)                    HWIO_##hwiosym##_INMI(index, mask)
524*5113495bSYour Name #define __msmhwio_inmi2(hwiosym, index1, index2, mask)          HWIO_##hwiosym##_INMI2(index1, index2, mask)
525*5113495bSYour Name #define __msmhwio_inmi3(hwiosym, index1, index2, index3, mask)  HWIO_##hwiosym##_INMI3(index1, index2, index3, mask)
526*5113495bSYour Name #define __msmhwio_out(hwiosym, val)                             HWIO_##hwiosym##_OUT(val)
527*5113495bSYour Name #define __msmhwio_outi(hwiosym, index, val)                     HWIO_##hwiosym##_OUTI(index,val)
528*5113495bSYour Name #define __msmhwio_outi2(hwiosym, index1, index2, val)           HWIO_##hwiosym##_OUTI2(index1, index2, val)
529*5113495bSYour Name #define __msmhwio_outi3(hwiosym, index1, index2, index3, val)   HWIO_##hwiosym##_OUTI2(index1, index2, index3, val)
530*5113495bSYour Name #define __msmhwio_outm(hwiosym, mask, val)                      HWIO_##hwiosym##_OUTM(mask, val)
531*5113495bSYour Name #define __msmhwio_outmi(hwiosym, index, mask, val)              HWIO_##hwiosym##_OUTMI(index, mask, val)
532*5113495bSYour Name #define __msmhwio_outmi2(hwiosym, idx1, idx2, mask, val)        HWIO_##hwiosym##_OUTMI2(idx1, idx2, mask, val)
533*5113495bSYour Name #define __msmhwio_outmi3(hwiosym, idx1, idx2, idx3, mask, val)  HWIO_##hwiosym##_OUTMI3(idx1, idx2, idx3, mask, val)
534*5113495bSYour Name 
535*5113495bSYour Name #define __msmhwio_addr(hwiosym)                                 HWIO_##hwiosym##_ADDR
536*5113495bSYour Name #define __msmhwio_addri(hwiosym, index)                         HWIO_##hwiosym##_ADDR(index)
537*5113495bSYour Name #define __msmhwio_addri2(hwiosym, idx1, idx2)                   HWIO_##hwiosym##_ADDR(idx1, idx2)
538*5113495bSYour Name #define __msmhwio_addri3(hwiosym, idx1, idx2, idx3)             HWIO_##hwiosym##_ADDR(idx1, idx2, idx3)
539*5113495bSYour Name #define __msmhwio_phys(hwiosym)                                 HWIO_##hwiosym##_PHYS
540*5113495bSYour Name #define __msmhwio_physi(hwiosym, index)                         HWIO_##hwiosym##_PHYS(index)
541*5113495bSYour Name #define __msmhwio_physi2(hwiosym, idx1, idx2)                   HWIO_##hwiosym##_PHYS(idx1, idx2)
542*5113495bSYour Name #define __msmhwio_physi3(hwiosym, idx1, idx2, idx3)             HWIO_##hwiosym##_PHYS(idx1, idx2, idx3)
543*5113495bSYour Name #define __msmhwio_offs(hwiosym)                                 HWIO_##hwiosym##_OFFS
544*5113495bSYour Name #define __msmhwio_offsi(hwiosym, index)                         HWIO_##hwiosym##_OFFS(index)
545*5113495bSYour Name #define __msmhwio_offsi2(hwiosym, idx1, idx2)                   HWIO_##hwiosym##_OFFS(idx1, idx2)
546*5113495bSYour Name #define __msmhwio_offsi3(hwiosym, idx1, idx2, idx3)             HWIO_##hwiosym##_OFFS(idx1, idx2, idx3)
547*5113495bSYour Name #define __msmhwio_rmsk(hwiosym)                                 HWIO_##hwiosym##_RMSK
548*5113495bSYour Name #define __msmhwio_rmski(hwiosym, index)                         HWIO_##hwiosym##_RMSK(index)
549*5113495bSYour Name #define __msmhwio_fmsk(hwiosym, hwiofldsym)                     HWIO_##hwiosym##_##hwiofldsym##_BMSK
550*5113495bSYour Name #define __msmhwio_rshft(hwiosym)                                HWIO_##hwiosym##_SHFT
551*5113495bSYour Name #define __msmhwio_shft(hwiosym, hwiofldsym)                     HWIO_##hwiosym##_##hwiofldsym##_SHFT
552*5113495bSYour Name #define __msmhwio_shdw(hwiosym)                                 HWIO_##hwiosym##_shadow
553*5113495bSYour Name #define __msmhwio_shdwi(hwiosym, index)                         HWIO_##hwiosym##_SHDW(index)
554*5113495bSYour Name #define __msmhwio_val(hwiosym, hwiofld, hwioval)                HWIO_##hwiosym##_##hwiofld##_##hwioval##_FVAL
555*5113495bSYour Name 
556*5113495bSYour Name #define __msmhwio_inx(base, hwiosym)                                  HWIO_##hwiosym##_IN(base)
557*5113495bSYour Name #define __msmhwio_inxi(base, hwiosym, index)                          HWIO_##hwiosym##_INI(base, index)
558*5113495bSYour Name #define __msmhwio_inxi2(base, hwiosym, index1, index2)                HWIO_##hwiosym##_INI2(base, index1, index2)
559*5113495bSYour Name #define __msmhwio_inxi3(base, hwiosym, index1, index2, index3)        HWIO_##hwiosym##_INI3(base, index1, index2, index3)
560*5113495bSYour Name #define __msmhwio_inxm(base, hwiosym, mask)                           HWIO_##hwiosym##_INM(base, mask)
561*5113495bSYour Name #define __msmhwio_inxmi(base, hwiosym, index, mask)                   HWIO_##hwiosym##_INMI(base, index, mask)
562*5113495bSYour Name #define __msmhwio_inxmi2(base, hwiosym, index1, index2, mask)         HWIO_##hwiosym##_INMI2(base, index1, index2, mask)
563*5113495bSYour Name #define __msmhwio_inxmi3(base, hwiosym, index1, index2, index3, mask) HWIO_##hwiosym##_INMI3(base, index1, index2, index3, mask)
564*5113495bSYour Name #define __msmhwio_outx(base, hwiosym, val)                            HWIO_##hwiosym##_OUT(base, val)
565*5113495bSYour Name #define __msmhwio_outxi(base, hwiosym, index, val)                    HWIO_##hwiosym##_OUTI(base, index,val)
566*5113495bSYour Name #define __msmhwio_outxi2(base, hwiosym, index1, index2, val)          HWIO_##hwiosym##_OUTI2(base, index1, index2, val)
567*5113495bSYour Name #define __msmhwio_outxi3(base, hwiosym, index1, index2, index3, val)  HWIO_##hwiosym##_OUTI3(base, index1, index2, index3, val)
568*5113495bSYour Name #define __msmhwio_outxm(base, hwiosym, mask, val)                     HWIO_##hwiosym##_OUTM(base, mask, val)
569*5113495bSYour Name #define __msmhwio_outxm2(base, hwiosym, mask1, mask2, val1, val2)  {	\
570*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask1, val1); \
571*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask2, val2); \
572*5113495bSYour Name                                                                                }
573*5113495bSYour Name #define __msmhwio_outxm3(base, hwiosym, mask1, mask2, mask3,  val1, val2, val3) { \
574*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask1, val1); \
575*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask2, val2); \
576*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask3, val3); \
577*5113495bSYour Name                                                                                }
578*5113495bSYour Name #define __msmhwio_outxm4(base, hwiosym, mask1, mask2, mask3, mask4, val1, val2, val3, val4) { \
579*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask1, val1); \
580*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask2, val2); \
581*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask3, val3); \
582*5113495bSYour Name                                                                                 HWIO_##hwiosym##_OUTM(base, mask4, val4); \
583*5113495bSYour Name                                                                                }
584*5113495bSYour Name #define __msmhwio_outxmi(base, hwiosym, index, mask, val)             HWIO_##hwiosym##_OUTMI(base, index, mask, val)
585*5113495bSYour Name #define __msmhwio_outxmi2(base, hwiosym, idx1, idx2, mask, val)       HWIO_##hwiosym##_OUTMI2(base, idx1, idx2, mask, val)
586*5113495bSYour Name #define __msmhwio_outxmi3(base, hwiosym, idx1, idx2, idx3, mask, val) HWIO_##hwiosym##_OUTMI3(base, idx1, idx2, idx3, mask, val)
587*5113495bSYour Name #define __msmhwio_addrx(base, hwiosym)                                HWIO_##hwiosym##_ADDR(base)
588*5113495bSYour Name #define __msmhwio_addrxi(base, hwiosym, index)                        HWIO_##hwiosym##_ADDR(base, index)
589*5113495bSYour Name #define __msmhwio_addrxi2(base, hwiosym, idx1, idx2)                  HWIO_##hwiosym##_ADDR(base, idx1, idx2)
590*5113495bSYour Name #define __msmhwio_addrxi3(base, hwiosym, idx1, idx2, idx3)            HWIO_##hwiosym##_ADDR(base, idx1, idx2, idx3)
591*5113495bSYour Name #define __msmhwio_physx(base, hwiosym)                                HWIO_##hwiosym##_PHYS(base)
592*5113495bSYour Name #define __msmhwio_physxi(base, hwiosym, index)                        HWIO_##hwiosym##_PHYS(base, index)
593*5113495bSYour Name #define __msmhwio_physxi2(base, hwiosym, idx1, idx2)                  HWIO_##hwiosym##_PHYS(base, idx1, idx2)
594*5113495bSYour Name #define __msmhwio_physxi3(base, hwiosym, idx1, idx2, idx3)            HWIO_##hwiosym##_PHYS(base, idx1, idx2, idx3)
595*5113495bSYour Name 
596*5113495bSYour Name 
597*5113495bSYour Name 
598*5113495bSYour Name 
599*5113495bSYour Name 
600*5113495bSYour Name /*
601*5113495bSYour Name  * MSM_x (depreciated)
602*5113495bSYour Name  *
603*5113495bSYour Name  * These macros should be replaced with the relevant HWIO equivalent.
604*5113495bSYour Name  */
605*5113495bSYour Name #define MSM_OUT(io, val)                HWIO_OUT(io, val)
606*5113495bSYour Name #define MSM_IN(io)                      HWIO_IN(io)
607*5113495bSYour Name #define MSM_OUTM(io, mask, val)         HWIO_OUTM(io, mask, val)
608*5113495bSYour Name #define MSM_INM(io, mask)               HWIO_INM(io, mask)
609*5113495bSYour Name #define MSM_INF(io, field)              HWIO_INF(io, field)
610*5113495bSYour Name #define MSM_FIELD(field, val)           (((val) << field##_SHFT) & (field##_BMSK))
611*5113495bSYour Name #define MSM_OUTSH(io, mask, val)        HWIO_OUTM(io, mask, val)
612*5113495bSYour Name #define MSM_FOUTSH(io, field, val)      HWIO_OUTM(io, mask, val)
613*5113495bSYour Name #define MSM_SET(io, field)              HWIO_OUTM(io, HWIO_FMSK(io, field), HWIO_FMSK(io, field))
614*5113495bSYour Name #define MSM_SET_BIT(io, bit)            HWIO_OUTM(io, (1<<bit), (1<<bit))
615*5113495bSYour Name #define MSM_SET_i(io, field, index)     HWIO_OUTMI(io, index, HWIO_FMSK(io,field), HWIO_FMSK(io,field))
616*5113495bSYour Name #define MSM_SET_ij(io, field, index1, index2) HWIO_OUTMI2(io, index1, index2, HWIO_FMSK(io,field), HWIO_FMSK(io,field))
617*5113495bSYour Name #define MSM_CLEAR(io, field)            HWIO_OUTM(io, HWIO_FMSK(io, field), 0)
618*5113495bSYour Name #define MSM_CLEAR_BIT(io, bit)          HWIO_OUTM(io, (1<<bit), 0)
619*5113495bSYour Name #define MSM_CLEAR_i(io, field, n)       HWIO_OUTMI(io, n, HWIO_FMSK(io,field), 0)
620*5113495bSYour Name #define MSM_CLEAR_ij(io, field, m, n)   HWIO_OUTMI2(io, m, n, HWIO_FMSK(io,field), 0)
621*5113495bSYour Name #define MSM_SET_MASK(io, mask)          HWIO_OUTM(io, mask, mask)
622*5113495bSYour Name #define MSM_CLEAR_MASK(io, mask)        HWIO_OUTM(io, mask, 0)
623*5113495bSYour Name #define MSM_PULSE(io, field)            HWIO_OUTF(io, field, 1); HWIO_OUTF(io, field, 0)
624*5113495bSYour Name #define MSM_GET(io, field)              HWIO_INF(io, field)
625*5113495bSYour Name #define MSM_W(io, val)                  HWIO_OUT(io, val)
626*5113495bSYour Name #define MSM_W_i(io, val, index)         HWIO_OUTI(io, index, val)
627*5113495bSYour Name #define MSM_W_ij(io, val, index1, index2) HWIO_OUTI2(io, index1, index2, val )
628*5113495bSYour Name #define MSM_W_MASKED(io, field, val)    HWIO_OUTF(io, field, val)
629*5113495bSYour Name #define MSM_W_MASKED_i(io, field, val, index)            HWIO_OUTFI(io, index, field, val)
630*5113495bSYour Name #define MSM_W_MASKED_ij(io, field, val, index1, index2)  HWIO_OUTFI2(io, index1, index2, field, val)
631*5113495bSYour Name #define MSM_R(io)                       HWIO_IN(io)
632*5113495bSYour Name #define MSM_R_MASKED(base, field)       HWIO_INF(base, field)
633*5113495bSYour Name #define MSM_R_MASKED_i(base, field, n)  HWIO_INFI(base, n, field)
634*5113495bSYour Name #define MSM_R_MASKED_ij(base, field, index1, index2)  HWIO_INFI2(base, index1, index2, field)
635*5113495bSYour Name #define MSM_GET_BIT(io, bit)            (HWIO_INM(io, (1<<bit) ) >> bit)
636*5113495bSYour Name #define MSM_NOT_USED( i )               if(i) {}
637*5113495bSYour Name 
638*5113495bSYour Name 
639*5113495bSYour Name /*
640*5113495bSYour Name  * MSM_LOCK / MSM_UNLOCK (depreciated)
641*5113495bSYour Name  *
642*5113495bSYour Name  * These macros are intended to be used if a client will be issuing a
643*5113495bSYour Name  * series of HWIO writes to avoid the multiple locking/freeing of interrupts
644*5113495bSYour Name  * that will otherwise occur.
645*5113495bSYour Name  * They should be replaced with HWIO_LOCK / HWIO_UNLOCK
646*5113495bSYour Name  */
647*5113495bSYour Name #define MSM_LOCK_REQUIRED                 \
648*5113495bSYour Name   /*lint -save -e548 else expected*/      \
649*5113495bSYour Name   MSM_LOCK_required = MSM_LOCK_required;  \
650*5113495bSYour Name   /*lint -restore */
651*5113495bSYour Name 
652*5113495bSYour Name #define MSM_LOCK( )                   \
653*5113495bSYour Name   {                                   \
654*5113495bSYour Name     boolean MSM_LOCK_required = TRUE; \
655*5113495bSYour Name     uint32 msm_sav;                   \
656*5113495bSYour Name     INTLOCK_SAV(msm_sav)
657*5113495bSYour Name 
658*5113495bSYour Name #define MSM_UNLOCK( )      \
659*5113495bSYour Name     MSM_LOCK_REQUIRED      \
660*5113495bSYour Name     INTFREE_SAV(msm_sav);  \
661*5113495bSYour Name   }
662*5113495bSYour Name 
663*5113495bSYour Name #define MSM_UNLOCK_AND_LOCK( ) \
664*5113495bSYour Name     MSM_LOCK_REQUIRED          \
665*5113495bSYour Name     INTFREE_SAV( msm_sav ),    \
666*5113495bSYour Name     INTLOCK_SAV( msm_sav )
667*5113495bSYour Name 
668*5113495bSYour Name 
669*5113495bSYour Name /*
670*5113495bSYour Name  * INPxx / OUTPxx (depreciated)
671*5113495bSYour Name  *
672*5113495bSYour Name  */
673*5113495bSYour Name #define INP32(addr)          in_dword(addr)
674*5113495bSYour Name #define INP32M(addr, mask)   in_dword_masked(addr,mask)
675*5113495bSYour Name #define OUTP32(addr, val)    out_dword(addr, val)
676*5113495bSYour Name #define OUTP32M(addr, mask, val)                      \
677*5113495bSYour Name    HWIO_INTLOCK();                                    \
678*5113495bSYour Name    out_dword_masked_ns(addr, mask, val, INP32(addr)); \
679*5113495bSYour Name    HWIO_INTFREE()
680*5113495bSYour Name 
681*5113495bSYour Name 
682*5113495bSYour Name /*
683*5113495bSYour Name  * HWIO_LOCK / HWIO_UNLOCK
684*5113495bSYour Name  *
685*5113495bSYour Name  * These macros are intended to be used if a client will be issuing a
686*5113495bSYour Name  * series of HWIO writes to avoid the multiple locking/freeing of interrupts
687*5113495bSYour Name  * that will otherwise occur.
688*5113495bSYour Name  */
689*5113495bSYour Name #define HWIO_LOCK()    \
690*5113495bSYour Name   {                    \
691*5113495bSYour Name     uint16 hwio_sav;   \
692*5113495bSYour Name     INTLOCK_SAV(hwio_sav)
693*5113495bSYour Name 
694*5113495bSYour Name #define HWIO_UNLOCK()       \
695*5113495bSYour Name     INTFREE_SAV(hwio_sav);  \
696*5113495bSYour Name   }
697*5113495bSYour Name 
698*5113495bSYour Name 
699*5113495bSYour Name #if defined(FEATURE_WINCE_BOOTLOADER)
700*5113495bSYour Name 
701*5113495bSYour Name   #define HWIO_INTLOCK()
702*5113495bSYour Name 
703*5113495bSYour Name   #define HWIO_INTFREE()
704*5113495bSYour Name 
705*5113495bSYour Name #elif defined(FEATURE_WINCE_OAL)
706*5113495bSYour Name 
707*5113495bSYour Name   #define HWIO_INTLOCK() \
708*5113495bSYour Name    { \
709*5113495bSYour Name      uint32 ints_already_enabled = INTERRUPTS_ENABLE(FALSE)
710*5113495bSYour Name 
711*5113495bSYour Name   #define HWIO_INTFREE() \
712*5113495bSYour Name      if (ints_already_enabled) INTERRUPTS_ENABLE(TRUE); \
713*5113495bSYour Name    }
714*5113495bSYour Name 
715*5113495bSYour Name #else
716*5113495bSYour Name 
717*5113495bSYour Name   #define HWIO_INTLOCK()     \
718*5113495bSYour Name    {                         \
719*5113495bSYour Name      uint32 intlock_sav;     \
720*5113495bSYour Name      INTLOCK_SAV(intlock_sav)
721*5113495bSYour Name 
722*5113495bSYour Name   #define HWIO_INTFREE()       \
723*5113495bSYour Name      INTFREE_SAV(intlock_sav); \
724*5113495bSYour Name    }
725*5113495bSYour Name 
726*5113495bSYour Name #endif
727*5113495bSYour Name 
728*5113495bSYour Name #if defined (PTI_PRINTF_EN) || defined(PTI_MEMORY_EN) || defined(PTI_STM_EN)
729*5113495bSYour Name 
730*5113495bSYour Name   #define __inp(port)         (*((volatile uint8 *) (port)))
731*5113495bSYour Name   #define __inpw(port)        (*((volatile uint16 *) (port)))
732*5113495bSYour Name //  #define __inpdw(port)       (*((volatile uint32 *) (port)))
733*5113495bSYour Name   #define __inpdw(port)       pti_inpdw((uint32 *) (port))
734*5113495bSYour Name 
735*5113495bSYour Name   #define __outp(port, val)   (*((volatile uint8 *) (port)) = ((uint8) (val)))
736*5113495bSYour Name   #define __outpw(port, val)  (*((volatile uint16 *) (port)) = ((uint16) (val)))
737*5113495bSYour Name //  #define __outpdw(port, val) (*((volatile uint32 *) (port)) = ((uint32) (val)))
738*5113495bSYour Name   #define __outpdw(port, val) pti_outpdw((uint32 *) (port), (val))
739*5113495bSYour Name #elif defined(__FWV) || defined(__KERNEL__) || defined(__SHARED_CODE) || defined(QURT_UFW_BUILD) || defined (_WIN)
740*5113495bSYour Name extern uint32_t registerRead(unsigned long addr);
741*5113495bSYour Name extern void registerWrite(unsigned long addr, uint32_t value);
742*5113495bSYour Name #define __inp(port)       registerRead(port)
743*5113495bSYour Name #define __inpw(port)       registerRead(port)
744*5113495bSYour Name #define __inpdw(port)       registerRead(port)
745*5113495bSYour Name #define __outp(port, val)  registerWrite(port, val)
746*5113495bSYour Name #define __outpw(port, val)  registerWrite(port, val)
747*5113495bSYour Name #define __outpdw(port, val)  registerWrite(port, val)
748*5113495bSYour Name #else
749*5113495bSYour Name #ifdef CDVI_SVTB_VERBOSE
750*5113495bSYour Name   #define __inp(port)         ((printf("CDVI_SVTB_VERBOSE: Calling bus_read from %s:%0d\n", __FILE__,__LINE__)&0) + bus_read(port))
751*5113495bSYour Name #else
752*5113495bSYour Name   #define __inp(port)         bus_read(port)
753*5113495bSYour Name #endif
754*5113495bSYour Name   #define __inpw(port)        __inp(port)
755*5113495bSYour Name   #define __inpdw(port)       __inp(port)
756*5113495bSYour Name 
757*5113495bSYour Name #ifdef CDVI_SVTB_VERBOSE
758*5113495bSYour Name   #define __outp(port, val)   ((printf("CDVI_SVTB_VERBOSE: Calling bus_write from %s:%0d\n",__FILE__,__LINE__)&0) + bus_write (port, val))
759*5113495bSYour Name #else
760*5113495bSYour Name   #define __outp(port, val)   bus_write (port, val)
761*5113495bSYour Name #endif
762*5113495bSYour Name   #define __outpw(port, val)  __outp (port, val)
763*5113495bSYour Name   #define __outpdw(port, val) __outp (port, val)
764*5113495bSYour Name #endif
765*5113495bSYour Name 
766*5113495bSYour Name 
767*5113495bSYour Name #define in_byte(addr)               (__inp(addr))
768*5113495bSYour Name #define in_byte_masked(addr, mask)  (__inp(addr) & (mask))
769*5113495bSYour Name #define out_byte(addr, val)         __outp(addr,val)
770*5113495bSYour Name #define out_byte_masked(io, mask, val, shadow)  \
771*5113495bSYour Name   HWIO_INTLOCK();    \
772*5113495bSYour Name   (void) out_byte( io, shadow); \
773*5113495bSYour Name   shadow = (shadow & (uint16)(~(mask))) | ((uint16)((val) & (mask))); \
774*5113495bSYour Name   HWIO_INTFREE()
775*5113495bSYour Name #define out_byte_masked_ns(io, mask, val, current_reg_content)  \
776*5113495bSYour Name   (void) out_byte( io, ((current_reg_content & (uint16)(~(mask))) | \
777*5113495bSYour Name                        ((uint16)((val) & (mask)))) )
778*5113495bSYour Name 
779*5113495bSYour Name #define in_word(addr)              (__inpw(addr))
780*5113495bSYour Name #define in_word_masked(addr, mask) (__inpw(addr) & (mask))
781*5113495bSYour Name #define out_word(addr, val)        __outpw(addr,val)
782*5113495bSYour Name #define out_word_masked(io, mask, val, shadow)  \
783*5113495bSYour Name   HWIO_INTLOCK( ); \
784*5113495bSYour Name   shadow = (shadow & (uint16)(~(mask))) |  ((uint16)((val) & (mask))); \
785*5113495bSYour Name   (void) out_word( io, shadow); \
786*5113495bSYour Name   HWIO_INTFREE( )
787*5113495bSYour Name #define out_word_masked_ns(io, mask, val, current_reg_content)  \
788*5113495bSYour Name   (void) out_word( io, ((current_reg_content & (uint16)(~(mask))) | \
789*5113495bSYour Name                        ((uint16)((val) & (mask)))) )
790*5113495bSYour Name 
791*5113495bSYour Name #define in_dword(addr)              (__inpdw(addr))
792*5113495bSYour Name #define in_dword_masked(addr, mask) (__inpdw(addr) & (mask))
793*5113495bSYour Name #define out_dword(addr, val)        __outpdw(addr,val)
794*5113495bSYour Name #define out_dword_masked(io, mask, val, shadow)  \
795*5113495bSYour Name    HWIO_INTLOCK( ); \
796*5113495bSYour Name    shadow = (shadow & (uint32)(~(mask))) | ((uint32)((val) & (mask))); \
797*5113495bSYour Name    (void) out_dword( io, shadow); \
798*5113495bSYour Name    HWIO_INTFREE( )
799*5113495bSYour Name #define out_dword_masked_ns(io, mask, val, current_reg_content) \
800*5113495bSYour Name   (void) out_dword( io, ((current_reg_content & (uint32)(~(mask))) | ((uint32)((val) & (mask)))) )
801*5113495bSYour Name 
802*5113495bSYour Name /*
803*5113495bSYour Name  * Base 64-bit quad-word accessing macros.
804*5113495bSYour Name  */
805*5113495bSYour Name #define in_qword(addr)              (__inpqw(addr))
806*5113495bSYour Name #define in_qword_masked(addr, mask) (__inpqw(addr) & (mask))
807*5113495bSYour Name #define out_qword(addr, val)        __outpqw(addr,val)
808*5113495bSYour Name #define out_qword_masked(io, mask, val, shadow)  \
809*5113495bSYour Name    HWIO_INTLOCK(); \
810*5113495bSYour Name    shadow = (shadow & (uint64)(~(mask))) | ((uint64)((val) & (mask))); \
811*5113495bSYour Name    out_qword( io, shadow); \
812*5113495bSYour Name    HWIO_INTFREE()
813*5113495bSYour Name #define out_qword_masked_ns(io, mask, val, current_reg_content) \
814*5113495bSYour Name   out_qword( io, ((current_reg_content & (uint64)(~(mask))) | \
815*5113495bSYour Name                  ((uint64)((val) & (mask)))) )
816*5113495bSYour Name 
817*5113495bSYour Name #define OUTP64(addr, val)    	out_qword(addr, val)
818*5113495bSYour Name #define __outpqw(port, val) 	(*((volatile uint64 *) (port)) = ((uint64) (val)))
819*5113495bSYour Name 
820*5113495bSYour Name #define INP64(addr)    			in_qword(addr)
821*5113495bSYour Name #define __inpqw(port)       	(*((volatile uint64 *) (port)))
822*5113495bSYour Name 
823*5113495bSYour Name #endif
824*5113495bSYour Name 
825*5113495bSYour Name 
826