2
*-----------------------------------------------------------------------------
5
*-----------------------------------------------------------------------------
6
* Copyright © 2002-2010, Intel Corporation.
8
* This program is free software; you can redistribute it and/or modify it
9
* under the terms and conditions of the GNU General Public License,
10
* version 2, as published by the Free Software Foundation.
12
* This program is distributed in the hope it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
* You should have received a copy of the GNU General Public License along with
18
* this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21
*-----------------------------------------------------------------------------
24
*-----------------------------------------------------------------------------
35
/* Get the MMIO pointer for a display context */
37
EMGD_MMIO((((igd_display_context_t *)dsp)->context->device_context.virt_mmadr))
39
/* Get the 2nd MMIO pointer for a display context */
40
#define MMIO_SDVO(dsp) \
41
EMGD_MMIO(((igd_display_context_t *)dsp)->context->device_context.virt_mmadr_sdvo)
43
/* Definition: value = READ_MMIO_REG(igd_display_context_t *, reg) */
44
#define READ_MMIO_REG(dsp, reg) \
45
EMGD_READ32( MMIO(dsp) +(reg) )
47
/* Definition: WRITE_MMIO_REG(igd_display_context_t *, reg, value) */
48
#define WRITE_MMIO_REG(dsp, reg, value) \
49
EMGD_WRITE32(value, ( MMIO(dsp) + (reg) ) )
51
/* Definition:WRITE_MMIO_REG_BITS(igd_display_context_t *, reg, value, mask) */
52
#define WRITE_MMIO_REG_BITS(dsp, reg, data, mask) \
55
tmp = READ_MMIO_REG((dsp), (reg)); \
57
tmp |= ((data) & (mask)); \
58
WRITE_MMIO_REG((dsp), (reg), (tmp)); \
61
#define PORT_TYPE(d) (PORT(d, (d->port_number))->port_type)
62
#define PORT_TYPE_DH(dh) \
63
(PORT(dh, (((igd_display_context_t *)dh)->port_number))->port_type)
66
/* Based on display port determine which mmio base to use:
67
* port_type == SDVO ==> use 0:3:0 device mmio
68
* port_type == LVDS ==> use 0:2:0 device mmio
69
* port_type == LPC ==> use 0:31:0 device mmio
71
#define MMIO_TNC(port_type) EMGD_MMIO(get_mmio_tnc(port_type))
73
#define READ_MMIO_REG_TNC(pt, reg) read_mmio_reg_tnc(pt, reg)
74
#define WRITE_MMIO_REG_TNC(pt, reg, value) write_mmio_reg_tnc(pt, reg, value)
76
/* Defined in micro_mode_tnc.c */
77
extern unsigned char *get_mmio_tnc(unsigned long port_type);
78
extern unsigned long read_mmio_reg_tnc(unsigned long port_type,
80
extern void write_mmio_reg_tnc(unsigned long port_type, unsigned long reg,
86
* These are temporary macros used only within this header.
87
* Individual config options use these macros to generate macros that look
90
* If CONFIG_FOO is defined
93
* OPT_FOO_VOID_CALL(fn)
96
#define OPTIONAL_VOID_CALL(fn) fn
97
#define OPTIONAL_CALL(fn) \
102
EMGD_ERROR_EXIT("EXIT"); \
107
#define OPTIONAL_CALL_RET(ret, fn) (ret) = (fn)
110
* Debug call macro should be used to call debug printing functions
111
* that will only exist in debug builds.
113
#ifdef DEBUG_BUILD_TYPE
114
#define OPT_DEBUG_SYMBOL(sym) sym
115
#define OPT_DEBUG_VALUE(val, alt) val
116
#define OPT_DEBUG_VOID_CALL(fn) OPTIONAL_VOID_CALL(fn)
117
#define OPT_DEBUG_CALL(fn) OPTIONAL_CALL(fn)
118
#define OPT_DEBUG_INLINE
120
#define OPT_DEBUG_SYMBOL(sym)
121
#define OPT_DEBUG_VALUE(val, alt) alt
122
#define OPT_DEBUG_VOID_CALL(fn)
123
#define OPT_DEBUG_CALL(fn)
124
#define OPT_DEBUG_INLINE static __inline
128
* Micro Symbols are only used when CONFIG_MICRO is not defined.
131
#define OPT_MICRO_SYMBOL(sym) sym
132
#define OPT_MICRO_VALUE(val, alt) val
133
#define OPT_MICRO_VOID_CALL(fn) OPTIONAL_VOID_CALL(fn)
134
#define OPT_MICRO_CALL(fn) OPTIONAL_CALL(fn)
135
#define OPT_MICRO_CALL_RET(ret, fn) OPTIONAL_CALL_RET(ret, fn)
137
#define OPT_MICRO_SYMBOL(sym)
138
#define OPT_MICRO_VALUE(val, alt) alt
139
#define OPT_MICRO_VOID_CALL(fn)
140
#define OPT_MICRO_CALL(fn)
141
#define OPT_MICRO_CALL_RET(ret, fn)
146
#define DISPATCH_PLB(p) {PCI_DEVICE_ID_VGA_PLB, p},
148
#define DISPATCH_PLB(p)
151
#define DISPATCH_TNC(p) {PCI_DEVICE_ID_VGA_TNC, p},
152
#define DISPATCH_TNC_A0(p) {PCI_DEVICE_ID_VGA_TNC_A0, p},
153
#define DISPATCH_LNC(p) {PCI_DEVICE_ID_VGA_LNC, p},
155
#define DISPATCH_TNC(p)
156
#define DISPATCH_TNC_A0(p)
157
#define DISPATCH_LNC(p)
159
#define DISPATCH_END {0, NULL}
164
/*----------------------------------------------------------------------------
165
* File Revision History
166
* $Id: utils.h,v 1.6 2010/08/06 17:50:21 rclovrie Exp $
167
* $Source: /nfs/fm/proj/eia/cvsroot/koheo/linux/egd_drm/emgd/include/utils.h,v $
168
*----------------------------------------------------------------------------