Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nouveau_bios.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2008 Nouveau Project
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef __NOUVEAU_DISPBIOS_H__
25 #define __NOUVEAU_DISPBIOS_H__
26 
27 #include "nvreg.h"
28 
29 #define DCB_MAX_NUM_ENTRIES 16
30 #define DCB_MAX_NUM_I2C_ENTRIES 16
31 #define DCB_MAX_NUM_GPIO_ENTRIES 32
32 #define DCB_MAX_NUM_CONNECTOR_ENTRIES 16
33 
34 #define DCB_LOC_ON_CHIP 0
35 
36 #define ROM16(x) le16_to_cpu(*(u16 *)&(x))
37 #define ROM32(x) le32_to_cpu(*(u32 *)&(x))
38 #define ROM48(x) ({ u8 *p = &(x); (u64)ROM16(p[4]) << 32 | ROM32(p[0]); })
39 #define ROM64(x) le64_to_cpu(*(u64 *)&(x))
40 #define ROMPTR(d,x) ({ \
41  struct nouveau_drm *drm = nouveau_drm((d)); \
42  ROM16(x) ? &drm->vbios.data[ROM16(x)] : NULL; \
43 })
44 
45 struct bit_entry {
51 };
52 
53 int bit_table(struct drm_device *, u8 id, struct bit_entry *);
54 
55 #include <subdev/bios/dcb.h>
56 #include <subdev/bios/conn.h>
57 
58 struct dcb_table {
60  int entries;
62 };
63 
64 enum nouveau_or {
65  DCB_OUTPUT_A = (1 << 0),
66  DCB_OUTPUT_B = (1 << 1),
67  DCB_OUTPUT_C = (1 << 2)
68 };
69 
71  /* Order *does* matter here */
72  LVDS_INIT = 1,
78 };
79 
80 struct nvbios {
81  struct drm_device *dev;
82  enum {
85  } type;
89 
91 
95  bool fp_no_ddc;
96 
98 
99  bool execute;
100 
103  bool is_mobile;
104 
106 
116 
120 
121  uint16_t some_script_ptr; /* BIT I + 14 */
122  uint16_t init96_tbl_ptr; /* BIT I + 16 */
123 
124  struct dcb_table dcb;
125 
126  struct {
127  int crtchead;
128  } state;
129 
130  struct {
132  int crtc;
134  } display;
135 
136  struct {
137  uint16_t fptablepointer; /* also used by tmds */
146  bool dual_link;
152 
153  /* will need resetting after suspend */
156  } fp;
157 
158  struct {
161  } tmds;
162 
163  struct {
167 
168  struct {
170  } i2c_indices;
171 
173  } legacy;
174 };
175 
176 void *olddcb_table(struct drm_device *);
177 void *olddcb_outp(struct drm_device *, u8 idx);
178 int olddcb_outp_foreach(struct drm_device *, void *data,
179  int (*)(struct drm_device *, void *, int idx, u8 *outp));
180 u8 *olddcb_conntab(struct drm_device *);
181 u8 *olddcb_conn(struct drm_device *, u8 idx);
182 
183 int nouveau_bios_init(struct drm_device *);
184 void nouveau_bios_takedown(struct drm_device *dev);
185 int nouveau_run_vbios_init(struct drm_device *);
186 struct dcb_connector_table_entry *
188 int nouveau_bios_run_display_table(struct drm_device *, u16 id, int clk,
189  struct dcb_output *, int crtc);
190 bool nouveau_bios_fp_mode(struct drm_device *, struct drm_display_mode *);
192 int nouveau_bios_parse_lvds_table(struct drm_device *, int pxclk,
193  bool *dl, bool *if_is_24bit);
194 int run_tmds_table(struct drm_device *, struct dcb_output *,
195  int head, int pxclk);
196 int call_lvds_script(struct drm_device *, struct dcb_output *, int head,
197  enum LVDS_script, int pxclk);
198 bool bios_encoder_match(struct dcb_output *, u32 hash);
199 
200 #endif