NV50: A minor change.
[platform/upstream/libdrm.git] / linux-core / nouveau_bios.h
1 /*
2  * Copyright (C) 2005-2006 Erik Waling
3  * Copyright (C) 2006 Stephane Marchesin
4  * Copyright (C) 2007-2008 Stuart Bennett
5  * Copyright (C) 2008 Maarten Maathuis.
6  * All Rights Reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice (including the
17  * next paragraph) shall be included in all copies or substantial
18  * portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
24  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  *
28  */
29
30 #ifndef __NOUVEAU_BIOS_H__
31 #define __NOUVEAU_BIOS_H__
32
33 #include "drmP.h"
34 #include "drm.h"
35
36 #define LOC_ON_CHIP 0
37
38 enum dcb_output_type {/* matches DCB types */
39         DCB_OUTPUT_NONE = 4,
40         DCB_OUTPUT_ANALOG = 0,
41         DCB_OUTPUT_TMDS = 2,
42         DCB_OUTPUT_LVDS = 3,
43         DCB_OUTPUT_TV = 1,
44 };
45
46 struct bios {
47         uint8_t *data;
48         unsigned int length;
49         bool execute;
50
51         uint8_t major_version, chip_version;
52         uint8_t feature_byte;
53
54         uint32_t fmaxvco, fminvco;
55
56         uint32_t dactestval;
57
58         uint16_t init_script_tbls_ptr;
59         uint16_t extra_init_script_tbl_ptr;
60         uint16_t macro_index_tbl_ptr;
61         uint16_t macro_tbl_ptr;
62         uint16_t condition_tbl_ptr;
63         uint16_t io_condition_tbl_ptr;
64         uint16_t io_flag_condition_tbl_ptr;
65         uint16_t init_function_tbl_ptr;
66
67         uint16_t pll_limit_tbl_ptr;
68         uint16_t ram_restrict_tbl_ptr;
69
70         struct {
71                 struct nouveau_hw_mode *native_mode;
72                 uint8_t *edid;
73                 uint16_t lvdsmanufacturerpointer;
74                 uint16_t xlated_entry;
75                 bool power_off_for_reset;
76                 bool reset_after_pclk_change;
77                 bool dual_link;
78                 bool link_c_increment;
79                 bool if_is_24bit;
80                 bool BITbit1;
81                 int duallink_transition_clk;
82                 /* lower nibble stores PEXTDEV_BOOT_0 strap
83                  * upper nibble stores xlated display strap */
84                 uint8_t strapping;
85         } fp;
86
87         struct {
88                 uint16_t output0_script_ptr;
89                 uint16_t output1_script_ptr;
90         } tmds;
91
92         struct {
93                 uint16_t mem_init_tbl_ptr;
94                 uint16_t sdr_seq_tbl_ptr;
95                 uint16_t ddr_seq_tbl_ptr;
96
97                 struct {
98                         uint8_t crt, tv, panel;
99                 } i2c_indices;
100         } legacy;
101 };
102
103 struct dcb_entry {
104         int index;
105         uint8_t type;
106         uint8_t i2c_index;
107         uint8_t heads;
108         uint8_t bus;
109         uint8_t location;
110         uint8_t or;
111         bool duallink_possible;
112         union {
113                 struct {
114                         bool use_straps_for_mode;
115                         bool use_power_scripts;
116                 } lvdsconf;
117         };
118 };
119
120 /* changing these requires matching changes to reg tables in nv_get_clock */
121 #define MAX_PLL_TYPES   4
122 enum pll_types {
123         NVPLL,
124         MPLL,
125         VPLL1,
126         VPLL2
127 };
128
129 struct pll_lims {
130         struct {
131                 int minfreq;
132                 int maxfreq;
133                 int min_inputfreq;
134                 int max_inputfreq;
135
136                 uint8_t min_m;
137                 uint8_t max_m;
138                 uint8_t min_n;
139                 uint8_t max_n;
140         } vco1, vco2;
141
142         uint8_t unk1c;
143         uint8_t max_log2p_bias;
144         uint8_t log2p_bias;
145         int refclk;
146 };
147
148 bool get_pll_limits(struct drm_device *dev, uint32_t limit_match, struct pll_lims *pll_lim);
149 int nouveau_parse_bios(struct drm_device *dev);
150
151 #endif /* __NOUVEAU_BIOS_H__ */