Subversion Repositories Kolibri OS

Rev

Rev 2325 | Rev 2327 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2325 Rev 2326
Line 35... Line 35...
35
#include 
35
#include 
36
#include 
36
#include 
37
#include 
37
#include 
38
 
38
 
Line 39... Line -...
39
 
-
 
40
enum {
-
 
41
    RCS = 0x0,
-
 
42
    VCS,
-
 
43
    BCS,
-
 
44
    I915_NUM_RINGS,
-
 
45
};
-
 
46
 
-
 
47
 
-
 
48
#include "i915_drv.h"
39
#include "i915_drv.h"
49
#include 
40
#include 
Line -... Line 41...
-
 
41
 
-
 
42
#define PCI_VENDOR_ID_INTEL        0x8086
50
 
43
 
51
#define INTEL_VGA_DEVICE(id, info) {        \
44
#define INTEL_VGA_DEVICE(id, info) {        \
52
    .class = PCI_CLASS_DISPLAY_VGA << 8,    \
45
    .class = PCI_CLASS_DISPLAY_VGA << 8,    \
53
    .class_mask = 0xff0000,                 \
46
    .class_mask = 0xff0000,                 \
54
    .vendor = 0x8086,                       \
47
    .vendor = 0x8086,                       \
Line 86... Line 79...
86
    INTEL_VGA_DEVICE(0x010A, &intel_sandybridge_d_info),
79
    INTEL_VGA_DEVICE(0x010A, &intel_sandybridge_d_info),
87
    {0, 0, 0}
80
    {0, 0, 0}
88
};
81
};
89
 
82
 
Line -... Line 83...
-
 
83
#define INTEL_PCH_DEVICE_ID_MASK        0xff00
-
 
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
 
-
 
88
void intel_detect_pch (struct drm_device *dev)
-
 
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
            if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) {
-
 
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
static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
-
 
121
{
-
 
122
    int count;
-
 
123
 
-
 
124
    count = 0;
-
 
125
    while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1))
-
 
126
        udelay(10);
-
 
127
 
-
 
128
    I915_WRITE_NOTRACE(FORCEWAKE, 1);
-
 
129
    POSTING_READ(FORCEWAKE);
-
 
130
 
-
 
131
    count = 0;
-
 
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
    /* Forcewake is atomic in case we get in here without the lock */
-
 
147
    if (atomic_add_return(1, &dev_priv->forcewake_count) == 1)
-
 
148
        __gen6_gt_force_wake_get(dev_priv);
-
 
149
}
-
 
150
 
-
 
151
static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
-
 
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
    if (atomic_dec_and_test(&dev_priv->forcewake_count))
-
 
165
        __gen6_gt_force_wake_put(dev_priv);
-
 
166
}
-
 
167
 
-
 
168
void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
-
 
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
 
Line 90... Line 186...
90
 
186
 
Line 91... Line 187...
91
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent);
187
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent);
92
 
188
 
Line 154... Line 250...
154
    mutex_init(&dev->ctxlist_mutex);
250
    mutex_init(&dev->ctxlist_mutex);
155
 
251
 
Line 156... Line 252...
156
//int i915_driver_load(struct drm_device *dev, unsigned long flags)
252
//int i915_driver_load(struct drm_device *dev, unsigned long flags)
Line 157... Line 253...
157
 
253
 
158
//    ret = radeon_driver_load_kms(dev, ent->driver_data );
254
    ret = i915_driver_load(dev, ent->driver_data );
159
//    if (ret)
255
//    if (ret)
Line 160... Line 256...
160
//        goto err_g4;
256
//        goto err_g4;
161
 
257