Subversion Repositories Kolibri OS

Rev

Rev 2336 | Rev 2339 | 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
 
2330 Serge 31
#include "drmP.h"
32
#include "drm.h"
33
#include "i915_drm.h"
34
#include "i915_drv.h"
35
#include "intel_drv.h"
36
2325 Serge 37
 
2330 Serge 38
 
2325 Serge 39
#include 
40
#include 
41
#include 
42
#include 
43
44
 
45
46
 
2330 Serge 47
2327 Serge 48
 
2338 Serge 49
2330 Serge 50
 
2338 Serge 51
 
2332 Serge 52
2330 Serge 53
 
2332 Serge 54
2330 Serge 55
 
2332 Serge 56
2330 Serge 57
 
2336 Serge 58
2330 Serge 59
 
60
61
 
2332 Serge 62
2330 Serge 63
 
2332 Serge 64
2330 Serge 65
 
2326 Serge 66
67
 
2325 Serge 68
    .class = PCI_CLASS_DISPLAY_VGA << 8,    \
69
    .class_mask = 0xff0000,                 \
70
    .vendor = 0x8086,                       \
71
    .device = id,                           \
72
    .subvendor = PCI_ANY_ID,                \
73
    .subdevice = PCI_ANY_ID,                \
74
    .driver_data = (unsigned long) info }
75
76
 
77
    .gen = 6,
78
	.need_gfx_hws = 1, .has_hotplug = 1,
2330 Serge 79
    .has_bsd_ring = 1,
2325 Serge 80
    .has_blt_ring = 1,
81
};
82
83
 
84
	.gen = 6, .is_mobile = 1,
2330 Serge 85
	.need_gfx_hws = 1, .has_hotplug = 1,
86
    .has_fbc      = 1,
2325 Serge 87
    .has_bsd_ring = 1,
88
    .has_blt_ring = 1,
89
};
90
91
 
92
 
93
    INTEL_VGA_DEVICE(0x0102, &intel_sandybridge_d_info),
94
    INTEL_VGA_DEVICE(0x0112, &intel_sandybridge_d_info),
95
    INTEL_VGA_DEVICE(0x0122, &intel_sandybridge_d_info),
96
    INTEL_VGA_DEVICE(0x0106, &intel_sandybridge_m_info),
97
    INTEL_VGA_DEVICE(0x0116, &intel_sandybridge_m_info),
98
    INTEL_VGA_DEVICE(0x0126, &intel_sandybridge_m_info),
99
    INTEL_VGA_DEVICE(0x010A, &intel_sandybridge_d_info),
100
    {0, 0, 0}
101
};
102
103
 
2326 Serge 104
#define INTEL_PCH_IBX_DEVICE_ID_TYPE    0x3b00
105
#define INTEL_PCH_CPT_DEVICE_ID_TYPE    0x1c00
106
#define INTEL_PCH_PPT_DEVICE_ID_TYPE    0x1e00
107
2325 Serge 108
 
2326 Serge 109
{
110
    struct drm_i915_private *dev_priv = dev->dev_private;
111
    struct pci_dev *pch;
112
113
 
114
     * The reason to probe ISA bridge instead of Dev31:Fun0 is to
115
     * make graphics device passthrough work easy for VMM, that only
116
     * need to expose ISA bridge to let driver know the real hardware
117
     * underneath. This is a requirement from virtualization team.
118
     */
119
    pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
120
    if (pch) {
121
        if (pch->vendor == PCI_VENDOR_ID_INTEL) {
122
            int id;
123
            id = pch->device & INTEL_PCH_DEVICE_ID_MASK;
124
125
 
126
                dev_priv->pch_type = PCH_IBX;
127
                DRM_DEBUG_KMS("Found Ibex Peak PCH\n");
128
            } else if (id == INTEL_PCH_CPT_DEVICE_ID_TYPE) {
129
                dev_priv->pch_type = PCH_CPT;
130
                DRM_DEBUG_KMS("Found CougarPoint PCH\n");
131
            } else if (id == INTEL_PCH_PPT_DEVICE_ID_TYPE) {
132
                /* PantherPoint is CPT compatible */
133
                dev_priv->pch_type = PCH_CPT;
134
                DRM_DEBUG_KMS("Found PatherPoint PCH\n");
135
            }
136
        }
137
    }
138
}
139
140
 
141
{
142
    int count;
143
144
 
145
    while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1))
146
        udelay(10);
147
148
 
149
    POSTING_READ(FORCEWAKE);
150
151
 
152
    while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1) == 0)
153
        udelay(10);
154
}
155
156
 
157
 * Generally this is called implicitly by the register read function. However,
158
 * if some sequence requires the GT to not power down then this function should
159
 * be called at the beginning of the sequence followed by a call to
160
 * gen6_gt_force_wake_put() at the end of the sequence.
161
 */
162
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
163
{
164
//    WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
165
166
 
167
    if (atomic_add_return(1, &dev_priv->forcewake_count) == 1)
168
        __gen6_gt_force_wake_get(dev_priv);
169
}
170
171
 
172
{
173
    I915_WRITE_NOTRACE(FORCEWAKE, 0);
174
    POSTING_READ(FORCEWAKE);
175
}
176
177
 
178
 * see gen6_gt_force_wake_get()
179
 */
180
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
181
{
182
//    WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
183
184
 
185
        __gen6_gt_force_wake_put(dev_priv);
186
}
187
188
 
189
{
190
    if (dev_priv->gt_fifo_count < GT_FIFO_NUM_RESERVED_ENTRIES ) {
191
        int loop = 500;
192
        u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES);
193
        while (fifo <= GT_FIFO_NUM_RESERVED_ENTRIES && loop--) {
194
            udelay(10);
195
            fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES);
196
        }
197
//        WARN_ON(loop < 0 && fifo <= GT_FIFO_NUM_RESERVED_ENTRIES);
198
        dev_priv->gt_fifo_count = fifo;
199
    }
200
    dev_priv->gt_fifo_count--;
201
}
202
203
 
204
 
205
 
206
 
207
 
2325 Serge 208
209
 
210
{
211
    static pci_dev_t device;
212
    const struct pci_device_id  *ent;
213
    int  err;
214
215
 
216
    {
217
        DRM_ERROR("drm/i915 can't work without intel_agp module!\n");
218
        return 0;
219
    };
220
221
 
222
223
 
224
    {
225
        dbgprintf("device not found\n");
226
        return 0;
227
    };
228
229
 
230
                                device.pci_dev.device);
231
232
 
233
234
 
235
}
236
237
 
238
{
239
    static struct drm_device *dev;
240
    int ret;
241
242
 
243
244
 
245
    if (!dev)
246
        return -ENOMEM;
247
248
 
249
 //   if (ret)
250
 //       goto err_g1;
251
252
 
253
254
 
255
 //       printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
256
 //       goto err_g2;
257
 //   }
258
259
 
260
    dev->pci_device = pdev->device;
261
    dev->pci_vendor = pdev->vendor;
262
263
 
264
    INIT_LIST_HEAD(&dev->ctxlist);
265
    INIT_LIST_HEAD(&dev->vmalist);
266
    INIT_LIST_HEAD(&dev->maplist);
267
268
 
269
    mutex_init(&dev->struct_mutex);
270
    mutex_init(&dev->ctxlist_mutex);
271
272
 
2336 Serge 273
2325 Serge 274
 
2338 Serge 275
        goto err_g4;
276
2330 Serge 277
 
2338 Serge 278
2336 Serge 279
 
2338 Serge 280
        goto err_g4;
281
2336 Serge 282
 
283
 
2325 Serge 284
//        init_display_kms(dev->dev_private, &usermode);
285
//    else
286
//        init_display(dev->dev_private, &usermode);
287
288
 
289
290
 
291
292
 
293
//    drm_put_minor(&dev->primary);
294
//err_g3:
295
//    if (drm_core_check_feature(dev, DRIVER_MODESET))
296
//        drm_put_minor(&dev->control);
297
//err_g2:
298
//    pci_disable_device(pdev);
299
//err_g1:
300
    free(dev);
301
302
 
303
304
 
305
}
306