Subversion Repositories Kolibri OS

Rev

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