Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1029 serge 1
 
2
#include "radeon_chipset_gen.h"
3
#include "radeon_chipinfo_gen.h"
4
5
 
6
 
7
 
8
xf86TokenToString(SymTabPtr table, int token)
9
{
10
    int i;
11
12
 
13
14
 
15
      return NULL;
16
    else
17
      return(table[i].name);
18
}
19
20
 
21
 
22
 
23
{
24
  while(list->pci_device_id)
25
  {
26
    if(dev == list->pci_device_id)
27
      return list;
28
    list++;
29
  }
30
  return 0;
31
}
32
33
 
34
 
35
{
36
    const RADEONCardInfo *dev;
37
    u32_t bus, last_bus;
38
39
 
40
        return 0;
41
42
 
43
    {
44
        u32_t devfn;
45
46
 
47
        {
48
            u32_t id;
49
            id = PciRead32(bus,devfn, 0);
50
51
 
52
                continue;
53
54
 
55
56
 
57
            {
58
                u32_t reg2C;
59
                int i;
60
61
 
62
                if (!rhd.chipset){
63
                    dbgprintf("ChipID 0x%04x is not recognized\n", rhd.PciDeviceID);
64
                    return FALSE;
65
                }
66
                dbgprintf("Chipset: \"%s\" (ChipID = 0x%04x)\n",
67
                           rhd.chipset,rhd.PciDeviceID);
68
69
 
70
                rhd.devfn = devfn;
71
                rhd.PciTag = pciTag(bus,(devfn>>3)&0x1F,devfn&0x7);
72
73
 
74
                rhd.IsMobility  = dev->mobility;
75
                rhd.IsIGP       = dev->igp;
76
                rhd.HasCRTC2    = !dev->nocrtc2;
77
78
 
79
80
 
81
                rhd.subdevice_id = reg2C >> 16;
82
83
 
84
                    dbgprintf("R600 unsupported yet.\nExit\n");
85
86
 
87
                    rhd.gart_type = RADEON_IS_PCIE;
88
                else
89
                    rhd.gart_type = RADEON_IS_PCI;
90
91
 
92
                {
93
                    u32_t base;
94
                    Bool validSize;
95
96
 
97
                    if(base)
98
                    {
99
                        if (base & PCI_MAP_IO){
100
                            rhd.ioBase[i] = (u32_t)PCIGETIO(base);
101
                            rhd.memtype[i]   = base & PCI_MAP_IO_ATTR_MASK;
102
                        }
103
                        else{
104
                            rhd.memBase[i] = (u32_t)PCIGETMEMORY(base);
105
                            rhd.memtype[i] = base & PCI_MAP_MEMORY_ATTR_MASK;
106
                        }
107
                    }
108
                    rhd.memsize[i] = pciGetBaseSize(bus,devfn, i, TRUE, &validSize);
109
                }
110
                return &rhd;
111
            }
112
        }
113
    };
114
    return NULL;
115
}
116
117
 
118
 
119
 
120
{
121
  int offset;
122
  u32_t addr1;
123
  u32_t addr2;
124
  u32_t mask1;
125
  u32_t mask2;
126
  int bits = 0;
127
128
 
129
   * silently ignore bogus index values.  Valid values are 0-6.  0-5 are
130
   * the 6 base address registers, and 6 is the ROM base address register.
131
   */
132
  if (index < 0 || index > 6)
133
    return 0;
134
135
 
136
    *min = destructive;
137
138
 
139
  if (index == 6)
140
    offset = PCI_MAP_ROM_REG;
141
  else
142
    offset = PCI_MAP_REG_START + (index << 2);
143
144
 
145
  /*
146
   * Check if this is the second part of a 64 bit address.
147
   * XXX need to check how endianness affects 64 bit addresses.
148
   */
149
  if (index > 0 && index < 6) {
150
    addr2 = PciRead32(bus, devfn, offset - 4);
151
    if (PCI_MAP_IS_MEM(addr2) && PCI_MAP_IS64BITMEM(addr2))
152
      return 0;
153
  }
154
155
 
156
     PciWrite32(bus, devfn, offset, 0xffffffff);
157
     mask1 = PciRead32(bus, devfn, offset);
158
     PciWrite32(bus, devfn, offset, addr1);
159
  } else {
160
    mask1 = addr1;
161
  }
162
163
 
164
  if (index < 5 && PCI_MAP_IS_MEM(mask1) && PCI_MAP_IS64BITMEM(mask1))
165
  {
166
    if (PCIGETMEMORY(mask1) == 0)
167
    {
168
      addr2 = PciRead32(bus, devfn, offset + 4);
169
      if (destructive)
170
      {
171
        PciWrite32(bus, devfn, offset + 4, 0xffffffff);
172
        mask2 = PciRead32(bus, devfn, offset + 4);
173
        PciWrite32(bus, devfn, offset + 4, addr2);
174
      }
175
      else
176
     {
177
       mask2 = addr2;
178
     }
179
     if (mask2 == 0)
180
       return 0;
181
     bits = 32;
182
     while ((mask2 & 1) == 0)
183
     {
184
       bits++;
185
       mask2 >>= 1;
186
     }
187
     if (bits > 32)
188
	  return bits;
189
    }
190
  }
191
  if (index < 6)
192
    if (PCI_MAP_IS_MEM(mask1))
193
      mask1 = PCIGETMEMORY(mask1);
194
    else
195
      mask1 = PCIGETIO(mask1);
196
  else
197
    mask1 = PCIGETROM(mask1);
198
  if (mask1 == 0)
199
    return 0;
200
  bits = 0;
201
  while ((mask1 & 1) == 0) {
202
    bits++;
203
    mask1 >>= 1;
204
  }
205
  /* I/O maps can be no larger than 8 bits */
206
207
 
208
    bits = 8;
209
  /* ROM maps can be no larger than 24 bits */
210
  if (index == 6 && bits > 24)
211
    bits = 24;
212
  return bits;
213
}
214
215
 
216
 
217
 
218
219
 
220
                                   int cap, int *ttl)
221
{
222
    u8_t id;
223
224
 
225
    {
226
        pos = pciReadByte(pciTag, pos);
227
		if (pos < 0x40)
228
			break;
229
		pos &= ~3;
230
        id = pciReadByte(pciTag, pos + PCI_CAP_LIST_ID);
231
		if (id == 0xff)
232
			break;
233
		if (id == cap)
234
			return pos;
235
		pos += PCI_CAP_LIST_NEXT;
236
	}
237
	return 0;
238
}
239
240
 
241
{
242
	int ttl = PCI_FIND_CAP_TTL;
243
244
 
245
}
246
247
 
248
{
249
    u16_t status;
250
    u8_t  hdr_type;
251
252
 
253
	if (!(status & PCI_STATUS_CAP_LIST))
254
		return 0;
255
256
 
257
    switch (hdr_type)
258
    {
259
        case PCI_HEADER_TYPE_NORMAL:
260
        case PCI_HEADER_TYPE_BRIDGE:
261
            return PCI_CAPABILITY_LIST;
262
        case PCI_HEADER_TYPE_CARDBUS:
263
            return PCI_CB_CAPABILITY_LIST;
264
        default:
265
            return 0;
266
	}
267
	return 0;
268
}
269
270
 
271
 
272
{
273
	int pos;
274
275
 
276
	if (pos)
277
        pos = __pci_find_next_cap(pciTag, pos, cap);
278
279
 
280
}
281
282
 
283
 
284
{
285
    return pci_find_capability(pciTag, PCI_CAP_ID_EXP);
286
}
287
>
288