Rev 2326 | Rev 2330 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2325 | Serge | 1 | |
2 | */ |
||
3 | /* |
||
4 | * |
||
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
||
6 | * All Rights Reserved. |
||
7 | * |
||
8 | * Permission is hereby granted, free of charge, to any person obtaining a |
||
9 | * 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, sub license, 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 portions |
||
18 | * of the Software. |
||
19 | * |
||
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
||
21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
||
23 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR |
||
24 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
||
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
27 | * |
||
28 | */ |
||
29 | |||
30 | |||
31 | #include |
||
32 | |||
33 | |||
34 | #include |
||
35 | #include |
||
36 | #include |
||
37 | #include |
||
38 | |||
39 | |||
40 | #include |
||
41 | |||
42 | |||
2327 | Serge | 43 | int i915_vbt_sdvo_panel_type = -1; |
44 | unsigned int i915_panel_use_ssc = 1; |
||
45 | unsigned int i915_powersave = 1; |
||
46 | unsigned int i915_enable_fbc = 1; |
||
47 | |||
48 | |||
2326 | Serge | 49 | |
50 | |||
2325 | Serge | 51 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ |
52 | .class_mask = 0xff0000, \ |
||
53 | .vendor = 0x8086, \ |
||
54 | .device = id, \ |
||
55 | .subvendor = PCI_ANY_ID, \ |
||
56 | .subdevice = PCI_ANY_ID, \ |
||
57 | .driver_data = (unsigned long) info } |
||
58 | |||
59 | |||
60 | .gen = 6, |
||
61 | .need_gfx_hws = 1, |
||
62 | .has_hotplug = 1, |
||
63 | .has_bsd_ring = 1, |
||
64 | .has_blt_ring = 1, |
||
65 | }; |
||
66 | |||
67 | |||
68 | .gen = 6, |
||
69 | .is_mobile = 1, |
||
70 | .need_gfx_hws = 1, |
||
71 | .has_hotplug = 1, |
||
72 | .has_fbc = 1, |
||
73 | .has_bsd_ring = 1, |
||
74 | .has_blt_ring = 1, |
||
75 | }; |
||
76 | |||
77 | |||
78 | |||
79 | INTEL_VGA_DEVICE(0x0102, &intel_sandybridge_d_info), |
||
80 | INTEL_VGA_DEVICE(0x0112, &intel_sandybridge_d_info), |
||
81 | INTEL_VGA_DEVICE(0x0122, &intel_sandybridge_d_info), |
||
82 | INTEL_VGA_DEVICE(0x0106, &intel_sandybridge_m_info), |
||
83 | INTEL_VGA_DEVICE(0x0116, &intel_sandybridge_m_info), |
||
84 | INTEL_VGA_DEVICE(0x0126, &intel_sandybridge_m_info), |
||
85 | INTEL_VGA_DEVICE(0x010A, &intel_sandybridge_d_info), |
||
86 | {0, 0, 0} |
||
87 | }; |
||
88 | |||
89 | |||
2326 | Serge | 90 | #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 |
91 | #define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00 |
||
92 | #define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00 |
||
93 | |||
2325 | Serge | 94 | |
2326 | Serge | 95 | { |
96 | struct drm_i915_private *dev_priv = dev->dev_private; |
||
97 | struct pci_dev *pch; |
||
98 | |||
99 | |||
100 | * The reason to probe ISA bridge instead of Dev31:Fun0 is to |
||
101 | * make graphics device passthrough work easy for VMM, that only |
||
102 | * need to expose ISA bridge to let driver know the real hardware |
||
103 | * underneath. This is a requirement from virtualization team. |
||
104 | */ |
||
105 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); |
||
106 | if (pch) { |
||
107 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { |
||
108 | int id; |
||
109 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; |
||
110 | |||
111 | |||
112 | dev_priv->pch_type = PCH_IBX; |
||
113 | DRM_DEBUG_KMS("Found Ibex Peak PCH\n"); |
||
114 | } else if (id == INTEL_PCH_CPT_DEVICE_ID_TYPE) { |
||
115 | dev_priv->pch_type = PCH_CPT; |
||
116 | DRM_DEBUG_KMS("Found CougarPoint PCH\n"); |
||
117 | } else if (id == INTEL_PCH_PPT_DEVICE_ID_TYPE) { |
||
118 | /* PantherPoint is CPT compatible */ |
||
119 | dev_priv->pch_type = PCH_CPT; |
||
120 | DRM_DEBUG_KMS("Found PatherPoint PCH\n"); |
||
121 | } |
||
122 | } |
||
123 | } |
||
124 | } |
||
125 | |||
126 | |||
127 | { |
||
128 | int count; |
||
129 | |||
130 | |||
131 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1)) |
||
132 | udelay(10); |
||
133 | |||
134 | |||
135 | POSTING_READ(FORCEWAKE); |
||
136 | |||
137 | |||
138 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1) == 0) |
||
139 | udelay(10); |
||
140 | } |
||
141 | |||
142 | |||
143 | * Generally this is called implicitly by the register read function. However, |
||
144 | * if some sequence requires the GT to not power down then this function should |
||
145 | * be called at the beginning of the sequence followed by a call to |
||
146 | * gen6_gt_force_wake_put() at the end of the sequence. |
||
147 | */ |
||
148 | void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) |
||
149 | { |
||
150 | // WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); |
||
151 | |||
152 | |||
153 | if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) |
||
154 | __gen6_gt_force_wake_get(dev_priv); |
||
155 | } |
||
156 | |||
157 | |||
158 | { |
||
159 | I915_WRITE_NOTRACE(FORCEWAKE, 0); |
||
160 | POSTING_READ(FORCEWAKE); |
||
161 | } |
||
162 | |||
163 | |||
164 | * see gen6_gt_force_wake_get() |
||
165 | */ |
||
166 | void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) |
||
167 | { |
||
168 | // WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); |
||
169 | |||
170 | |||
171 | __gen6_gt_force_wake_put(dev_priv); |
||
172 | } |
||
173 | |||
174 | |||
175 | { |
||
176 | if (dev_priv->gt_fifo_count < GT_FIFO_NUM_RESERVED_ENTRIES ) { |
||
177 | int loop = 500; |
||
178 | u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); |
||
179 | while (fifo <= GT_FIFO_NUM_RESERVED_ENTRIES && loop--) { |
||
180 | udelay(10); |
||
181 | fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); |
||
182 | } |
||
183 | // WARN_ON(loop < 0 && fifo <= GT_FIFO_NUM_RESERVED_ENTRIES); |
||
184 | dev_priv->gt_fifo_count = fifo; |
||
185 | } |
||
186 | dev_priv->gt_fifo_count--; |
||
187 | } |
||
188 | |||
189 | |||
190 | |||
191 | |||
192 | |||
193 | |||
2325 | Serge | 194 | |
195 | |||
196 | { |
||
197 | static pci_dev_t device; |
||
198 | const struct pci_device_id *ent; |
||
199 | int err; |
||
200 | |||
201 | |||
202 | { |
||
203 | DRM_ERROR("drm/i915 can't work without intel_agp module!\n"); |
||
204 | return 0; |
||
205 | }; |
||
206 | |||
207 | |||
208 | |||
209 | |||
210 | { |
||
211 | dbgprintf("device not found\n"); |
||
212 | return 0; |
||
213 | }; |
||
214 | |||
215 | |||
216 | device.pci_dev.device); |
||
217 | |||
218 | |||
219 | |||
220 | |||
221 | } |
||
222 | |||
223 | |||
224 | { |
||
225 | static struct drm_device *dev; |
||
226 | int ret; |
||
227 | |||
228 | |||
229 | |||
230 | |||
231 | if (!dev) |
||
232 | return -ENOMEM; |
||
233 | |||
234 | |||
235 | // if (ret) |
||
236 | // goto err_g1; |
||
237 | |||
238 | |||
239 | |||
240 | |||
241 | // printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); |
||
242 | // goto err_g2; |
||
243 | // } |
||
244 | |||
245 | |||
246 | dev->pci_device = pdev->device; |
||
247 | dev->pci_vendor = pdev->vendor; |
||
248 | |||
249 | |||
250 | INIT_LIST_HEAD(&dev->ctxlist); |
||
251 | INIT_LIST_HEAD(&dev->vmalist); |
||
252 | INIT_LIST_HEAD(&dev->maplist); |
||
253 | |||
254 | |||
255 | mutex_init(&dev->struct_mutex); |
||
256 | mutex_init(&dev->ctxlist_mutex); |
||
257 | |||
258 | |||
259 | |||
260 | |||
2326 | Serge | 261 | // if (ret) |
2325 | Serge | 262 | // goto err_g4; |
263 | |||
264 | |||
265 | // init_display_kms(dev->dev_private, &usermode); |
||
266 | // else |
||
267 | // init_display(dev->dev_private, &usermode); |
||
268 | |||
269 | |||
270 | |||
271 | |||
272 | |||
273 | |||
274 | // drm_put_minor(&dev->primary); |
||
275 | //err_g3: |
||
276 | // if (drm_core_check_feature(dev, DRIVER_MODESET)) |
||
277 | // drm_put_minor(&dev->control); |
||
278 | //err_g2: |
||
279 | // pci_disable_device(pdev); |
||
280 | //err_g1: |
||
281 | free(dev); |
||
282 | |||
283 | |||
284 | |||
285 | |||
286 | }=>>=>>>>><>><> |
||
287 |