base.c 59.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * Copyright 2012 Red Hat Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: Ben Skeggs
 */
24 25
#include "priv.h"
#include "acpi.h"
26

27
#include <core/notify.h>
28
#include <core/option.h>
29

30
#include <subdev/bios.h>
31 32 33 34

static DEFINE_MUTEX(nv_devices_mutex);
static LIST_HEAD(nv_devices);

35 36
static struct nvkm_device *
nvkm_device_find_locked(u64 handle)
37
{
38
	struct nvkm_device *device;
39
	list_for_each_entry(device, &nv_devices, head) {
40 41
		if (device->handle == handle)
			return device;
42
	}
43 44 45 46 47 48 49 50 51
	return NULL;
}

struct nvkm_device *
nvkm_device_find(u64 handle)
{
	struct nvkm_device *device;
	mutex_lock(&nv_devices_mutex);
	device = nvkm_device_find_locked(handle);
52
	mutex_unlock(&nv_devices_mutex);
53
	return device;
54 55
}

56
int
57
nvkm_device_list(u64 *name, int size)
58
{
59
	struct nvkm_device *device;
60 61 62 63 64 65 66 67 68 69
	int nr = 0;
	mutex_lock(&nv_devices_mutex);
	list_for_each_entry(device, &nv_devices, head) {
		if (nr++ < size)
			name[nr - 1] = device->handle;
	}
	mutex_unlock(&nv_devices_mutex);
	return nr;
}

70 71 72
static const struct nvkm_device_chip
null_chipset = {
	.name = "NULL",
73
	.bios = nvkm_bios_new,
74 75 76 77 78
};

static const struct nvkm_device_chip
nv4_chipset = {
	.name = "NV04",
79
	.bios = nvkm_bios_new,
80
	.bus = nv04_bus_new,
81
	.clk = nv04_clk_new,
82
	.devinit = nv04_devinit_new,
83
	.fb = nv04_fb_new,
84
	.i2c = nv04_i2c_new,
85
	.imem = nv04_instmem_new,
86
	.mc = nv04_mc_new,
87
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
88
	.pci = nv04_pci_new,
89
	.timer = nv04_timer_new,
90
	.disp = nv04_disp_new,
91
	.dma = nv04_dma_new,
92
	.fifo = nv04_fifo_new,
93
	.gr = nv04_gr_new,
94
	.sw = nv04_sw_new,
95 96 97 98 99
};

static const struct nvkm_device_chip
nv5_chipset = {
	.name = "NV05",
100
	.bios = nvkm_bios_new,
101
	.bus = nv04_bus_new,
102
	.clk = nv04_clk_new,
103
	.devinit = nv05_devinit_new,
104
	.fb = nv04_fb_new,
105
	.i2c = nv04_i2c_new,
106
	.imem = nv04_instmem_new,
107
	.mc = nv04_mc_new,
108
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
109
	.pci = nv04_pci_new,
110
	.timer = nv04_timer_new,
111
	.disp = nv04_disp_new,
112
	.dma = nv04_dma_new,
113
	.fifo = nv04_fifo_new,
114
	.gr = nv04_gr_new,
115
	.sw = nv04_sw_new,
116 117 118 119 120
};

static const struct nvkm_device_chip
nv10_chipset = {
	.name = "NV10",
121
	.bios = nvkm_bios_new,
122
	.bus = nv04_bus_new,
123
	.clk = nv04_clk_new,
124
	.devinit = nv10_devinit_new,
125
	.fb = nv10_fb_new,
126
	.gpio = nv10_gpio_new,
127
	.i2c = nv04_i2c_new,
128
	.imem = nv04_instmem_new,
129
	.mc = nv04_mc_new,
130
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
131
	.pci = nv04_pci_new,
132
	.timer = nv04_timer_new,
133
	.disp = nv04_disp_new,
134
	.dma = nv04_dma_new,
135
	.gr = nv10_gr_new,
136 137 138 139 140
};

static const struct nvkm_device_chip
nv11_chipset = {
	.name = "NV11",
141
	.bios = nvkm_bios_new,
142
	.bus = nv04_bus_new,
143
	.clk = nv04_clk_new,
144
	.devinit = nv10_devinit_new,
145
	.fb = nv10_fb_new,
146
	.gpio = nv10_gpio_new,
147
	.i2c = nv04_i2c_new,
148
	.imem = nv04_instmem_new,
149
	.mc = nv04_mc_new,
150
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
151
	.pci = nv04_pci_new,
152
	.timer = nv04_timer_new,
153
	.disp = nv04_disp_new,
154
	.dma = nv04_dma_new,
155
	.fifo = nv10_fifo_new,
156
	.gr = nv15_gr_new,
157
	.sw = nv10_sw_new,
158 159 160 161 162
};

static const struct nvkm_device_chip
nv15_chipset = {
	.name = "NV15",
163
	.bios = nvkm_bios_new,
164
	.bus = nv04_bus_new,
165
	.clk = nv04_clk_new,
166
	.devinit = nv10_devinit_new,
167
	.fb = nv10_fb_new,
168
	.gpio = nv10_gpio_new,
169
	.i2c = nv04_i2c_new,
170
	.imem = nv04_instmem_new,
171
	.mc = nv04_mc_new,
172
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
173
	.pci = nv04_pci_new,
174
	.timer = nv04_timer_new,
175
	.disp = nv04_disp_new,
176
	.dma = nv04_dma_new,
177
	.fifo = nv10_fifo_new,
178
	.gr = nv15_gr_new,
179
	.sw = nv10_sw_new,
180 181 182 183 184
};

static const struct nvkm_device_chip
nv17_chipset = {
	.name = "NV17",
185
	.bios = nvkm_bios_new,
186
	.bus = nv04_bus_new,
187
	.clk = nv04_clk_new,
188
	.devinit = nv10_devinit_new,
189
	.fb = nv10_fb_new,
190
	.gpio = nv10_gpio_new,
191
	.i2c = nv04_i2c_new,
192
	.imem = nv04_instmem_new,
193
	.mc = nv04_mc_new,
194
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
195
	.pci = nv04_pci_new,
196
	.timer = nv04_timer_new,
197
	.disp = nv04_disp_new,
198
	.dma = nv04_dma_new,
199
	.fifo = nv17_fifo_new,
200
	.gr = nv17_gr_new,
201
	.sw = nv10_sw_new,
202 203 204 205 206
};

static const struct nvkm_device_chip
nv18_chipset = {
	.name = "NV18",
207
	.bios = nvkm_bios_new,
208
	.bus = nv04_bus_new,
209
	.clk = nv04_clk_new,
210
	.devinit = nv10_devinit_new,
211
	.fb = nv10_fb_new,
212
	.gpio = nv10_gpio_new,
213
	.i2c = nv04_i2c_new,
214
	.imem = nv04_instmem_new,
215
	.mc = nv04_mc_new,
216
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
217
	.pci = nv04_pci_new,
218
	.timer = nv04_timer_new,
219
	.disp = nv04_disp_new,
220
	.dma = nv04_dma_new,
221
	.fifo = nv17_fifo_new,
222
	.gr = nv17_gr_new,
223
	.sw = nv10_sw_new,
224 225 226 227 228
};

static const struct nvkm_device_chip
nv1a_chipset = {
	.name = "nForce",
229
	.bios = nvkm_bios_new,
230
	.bus = nv04_bus_new,
231
	.clk = nv04_clk_new,
232
	.devinit = nv1a_devinit_new,
233
	.fb = nv1a_fb_new,
234
	.gpio = nv10_gpio_new,
235
	.i2c = nv04_i2c_new,
236
	.imem = nv04_instmem_new,
237
	.mc = nv04_mc_new,
238
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
239
	.pci = nv04_pci_new,
240
	.timer = nv04_timer_new,
241
	.disp = nv04_disp_new,
242
	.dma = nv04_dma_new,
243
	.fifo = nv10_fifo_new,
244
	.gr = nv15_gr_new,
245
	.sw = nv10_sw_new,
246 247 248 249 250
};

static const struct nvkm_device_chip
nv1f_chipset = {
	.name = "nForce2",
251
	.bios = nvkm_bios_new,
252
	.bus = nv04_bus_new,
253
	.clk = nv04_clk_new,
254
	.devinit = nv1a_devinit_new,
255
	.fb = nv1a_fb_new,
256
	.gpio = nv10_gpio_new,
257
	.i2c = nv04_i2c_new,
258
	.imem = nv04_instmem_new,
259
	.mc = nv04_mc_new,
260
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
261
	.pci = nv04_pci_new,
262
	.timer = nv04_timer_new,
263
	.disp = nv04_disp_new,
264
	.dma = nv04_dma_new,
265
	.fifo = nv17_fifo_new,
266
	.gr = nv17_gr_new,
267
	.sw = nv10_sw_new,
268 269 270 271 272
};

static const struct nvkm_device_chip
nv20_chipset = {
	.name = "NV20",
273
	.bios = nvkm_bios_new,
274
	.bus = nv04_bus_new,
275
	.clk = nv04_clk_new,
276
	.devinit = nv20_devinit_new,
277
	.fb = nv20_fb_new,
278
	.gpio = nv10_gpio_new,
279
	.i2c = nv04_i2c_new,
280
	.imem = nv04_instmem_new,
281
	.mc = nv04_mc_new,
282
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
283
	.pci = nv04_pci_new,
284
	.timer = nv04_timer_new,
285
	.disp = nv04_disp_new,
286
	.dma = nv04_dma_new,
287
	.fifo = nv17_fifo_new,
288
	.gr = nv20_gr_new,
289
	.sw = nv10_sw_new,
290 291 292 293 294
};

static const struct nvkm_device_chip
nv25_chipset = {
	.name = "NV25",
295
	.bios = nvkm_bios_new,
296
	.bus = nv04_bus_new,
297
	.clk = nv04_clk_new,
298
	.devinit = nv20_devinit_new,
299
	.fb = nv25_fb_new,
300
	.gpio = nv10_gpio_new,
301
	.i2c = nv04_i2c_new,
302
	.imem = nv04_instmem_new,
303
	.mc = nv04_mc_new,
304
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
305
	.pci = nv04_pci_new,
306
	.timer = nv04_timer_new,
307
	.disp = nv04_disp_new,
308
	.dma = nv04_dma_new,
309
	.fifo = nv17_fifo_new,
310
	.gr = nv25_gr_new,
311
	.sw = nv10_sw_new,
312 313 314 315 316
};

static const struct nvkm_device_chip
nv28_chipset = {
	.name = "NV28",
317
	.bios = nvkm_bios_new,
318
	.bus = nv04_bus_new,
319
	.clk = nv04_clk_new,
320
	.devinit = nv20_devinit_new,
321
	.fb = nv25_fb_new,
322
	.gpio = nv10_gpio_new,
323
	.i2c = nv04_i2c_new,
324
	.imem = nv04_instmem_new,
325
	.mc = nv04_mc_new,
326
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
327
	.pci = nv04_pci_new,
328
	.timer = nv04_timer_new,
329
	.disp = nv04_disp_new,
330
	.dma = nv04_dma_new,
331
	.fifo = nv17_fifo_new,
332
	.gr = nv25_gr_new,
333
	.sw = nv10_sw_new,
334 335 336 337 338
};

static const struct nvkm_device_chip
nv2a_chipset = {
	.name = "NV2A",
339
	.bios = nvkm_bios_new,
340
	.bus = nv04_bus_new,
341
	.clk = nv04_clk_new,
342
	.devinit = nv20_devinit_new,
343
	.fb = nv25_fb_new,
344
	.gpio = nv10_gpio_new,
345
	.i2c = nv04_i2c_new,
346
	.imem = nv04_instmem_new,
347
	.mc = nv04_mc_new,
348
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
349
	.pci = nv04_pci_new,
350
	.timer = nv04_timer_new,
351
	.disp = nv04_disp_new,
352
	.dma = nv04_dma_new,
353
	.fifo = nv17_fifo_new,
354
	.gr = nv2a_gr_new,
355
	.sw = nv10_sw_new,
356 357 358 359 360
};

static const struct nvkm_device_chip
nv30_chipset = {
	.name = "NV30",
361
	.bios = nvkm_bios_new,
362
	.bus = nv04_bus_new,
363
	.clk = nv04_clk_new,
364
	.devinit = nv20_devinit_new,
365
	.fb = nv30_fb_new,
366
	.gpio = nv10_gpio_new,
367
	.i2c = nv04_i2c_new,
368
	.imem = nv04_instmem_new,
369
	.mc = nv04_mc_new,
370
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
371
	.pci = nv04_pci_new,
372
	.timer = nv04_timer_new,
373
	.disp = nv04_disp_new,
374
	.dma = nv04_dma_new,
375
	.fifo = nv17_fifo_new,
376
	.gr = nv30_gr_new,
377
	.sw = nv10_sw_new,
378 379 380 381 382
};

static const struct nvkm_device_chip
nv31_chipset = {
	.name = "NV31",
383
	.bios = nvkm_bios_new,
384
	.bus = nv31_bus_new,
385
	.clk = nv04_clk_new,
386
	.devinit = nv20_devinit_new,
387
	.fb = nv30_fb_new,
388
	.gpio = nv10_gpio_new,
389
	.i2c = nv04_i2c_new,
390
	.imem = nv04_instmem_new,
391
	.mc = nv04_mc_new,
392
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
393
	.pci = nv04_pci_new,
394
	.timer = nv04_timer_new,
395
	.disp = nv04_disp_new,
396
	.dma = nv04_dma_new,
397
	.fifo = nv17_fifo_new,
398
	.gr = nv30_gr_new,
399
	.mpeg = nv31_mpeg_new,
400
	.sw = nv10_sw_new,
401 402 403 404 405
};

static const struct nvkm_device_chip
nv34_chipset = {
	.name = "NV34",
406
	.bios = nvkm_bios_new,
407
	.bus = nv31_bus_new,
408
	.clk = nv04_clk_new,
409
	.devinit = nv10_devinit_new,
410
	.fb = nv10_fb_new,
411
	.gpio = nv10_gpio_new,
412
	.i2c = nv04_i2c_new,
413
	.imem = nv04_instmem_new,
414
	.mc = nv04_mc_new,
415
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
416
	.pci = nv04_pci_new,
417
	.timer = nv04_timer_new,
418
	.disp = nv04_disp_new,
419
	.dma = nv04_dma_new,
420
	.fifo = nv17_fifo_new,
421
	.gr = nv34_gr_new,
422
	.mpeg = nv31_mpeg_new,
423
	.sw = nv10_sw_new,
424 425 426 427 428
};

static const struct nvkm_device_chip
nv35_chipset = {
	.name = "NV35",
429
	.bios = nvkm_bios_new,
430
	.bus = nv04_bus_new,
431
	.clk = nv04_clk_new,
432
	.devinit = nv20_devinit_new,
433
	.fb = nv35_fb_new,
434
	.gpio = nv10_gpio_new,
435
	.i2c = nv04_i2c_new,
436
	.imem = nv04_instmem_new,
437
	.mc = nv04_mc_new,
438
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
439
	.pci = nv04_pci_new,
440
	.timer = nv04_timer_new,
441
	.disp = nv04_disp_new,
442
	.dma = nv04_dma_new,
443
	.fifo = nv17_fifo_new,
444
	.gr = nv35_gr_new,
445
	.sw = nv10_sw_new,
446 447 448 449 450
};

static const struct nvkm_device_chip
nv36_chipset = {
	.name = "NV36",
451
	.bios = nvkm_bios_new,
452
	.bus = nv31_bus_new,
453
	.clk = nv04_clk_new,
454
	.devinit = nv20_devinit_new,
455
	.fb = nv36_fb_new,
456
	.gpio = nv10_gpio_new,
457
	.i2c = nv04_i2c_new,
458
	.imem = nv04_instmem_new,
459
	.mc = nv04_mc_new,
460
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
461
	.pci = nv04_pci_new,
462
	.timer = nv04_timer_new,
463
	.disp = nv04_disp_new,
464
	.dma = nv04_dma_new,
465
	.fifo = nv17_fifo_new,
466
	.gr = nv35_gr_new,
467
	.mpeg = nv31_mpeg_new,
468
	.sw = nv10_sw_new,
469 470 471 472 473
};

static const struct nvkm_device_chip
nv40_chipset = {
	.name = "NV40",
474
	.bios = nvkm_bios_new,
475
	.bus = nv31_bus_new,
476
	.clk = nv40_clk_new,
477
	.devinit = nv1a_devinit_new,
478
	.fb = nv40_fb_new,
479
	.gpio = nv10_gpio_new,
480
	.i2c = nv04_i2c_new,
481
	.imem = nv40_instmem_new,
482
	.mc = nv04_mc_new,
483
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
484
	.pci = nv40_pci_new,
485
	.therm = nv40_therm_new,
486
	.timer = nv40_timer_new,
487
	.volt = nv40_volt_new,
488
	.disp = nv04_disp_new,
489
	.dma = nv04_dma_new,
490
	.fifo = nv40_fifo_new,
491
	.gr = nv40_gr_new,
492
	.mpeg = nv40_mpeg_new,
493
	.pm = nv40_pm_new,
494
	.sw = nv10_sw_new,
495 496 497 498 499
};

static const struct nvkm_device_chip
nv41_chipset = {
	.name = "NV41",
500
	.bios = nvkm_bios_new,
501
	.bus = nv31_bus_new,
502
	.clk = nv40_clk_new,
503
	.devinit = nv1a_devinit_new,
504
	.fb = nv41_fb_new,
505
	.gpio = nv10_gpio_new,
506
	.i2c = nv04_i2c_new,
507
	.imem = nv40_instmem_new,
508
	.mc = nv04_mc_new,
509
	.mmu = nv41_mmu_new,
B
Ben Skeggs 已提交
510
	.pci = nv40_pci_new,
511
	.therm = nv40_therm_new,
512
	.timer = nv41_timer_new,
513
	.volt = nv40_volt_new,
514
	.disp = nv04_disp_new,
515
	.dma = nv04_dma_new,
516
	.fifo = nv40_fifo_new,
517
	.gr = nv40_gr_new,
518
	.mpeg = nv40_mpeg_new,
519
	.pm = nv40_pm_new,
520
	.sw = nv10_sw_new,
521 522 523 524 525
};

static const struct nvkm_device_chip
nv42_chipset = {
	.name = "NV42",
526
	.bios = nvkm_bios_new,
527
	.bus = nv31_bus_new,
528
	.clk = nv40_clk_new,
529
	.devinit = nv1a_devinit_new,
530
	.fb = nv41_fb_new,
531
	.gpio = nv10_gpio_new,
532
	.i2c = nv04_i2c_new,
533
	.imem = nv40_instmem_new,
534
	.mc = nv04_mc_new,
535
	.mmu = nv41_mmu_new,
B
Ben Skeggs 已提交
536
	.pci = nv40_pci_new,
537
	.therm = nv40_therm_new,
538
	.timer = nv41_timer_new,
539
	.volt = nv40_volt_new,
540
	.disp = nv04_disp_new,
541
	.dma = nv04_dma_new,
542
	.fifo = nv40_fifo_new,
543
	.gr = nv40_gr_new,
544
	.mpeg = nv40_mpeg_new,
545
	.pm = nv40_pm_new,
546
	.sw = nv10_sw_new,
547 548 549 550 551
};

static const struct nvkm_device_chip
nv43_chipset = {
	.name = "NV43",
552
	.bios = nvkm_bios_new,
553
	.bus = nv31_bus_new,
554
	.clk = nv40_clk_new,
555
	.devinit = nv1a_devinit_new,
556
	.fb = nv41_fb_new,
557
	.gpio = nv10_gpio_new,
558
	.i2c = nv04_i2c_new,
559
	.imem = nv40_instmem_new,
560
	.mc = nv04_mc_new,
561
	.mmu = nv41_mmu_new,
B
Ben Skeggs 已提交
562
	.pci = nv40_pci_new,
563
	.therm = nv40_therm_new,
564
	.timer = nv41_timer_new,
565
	.volt = nv40_volt_new,
566
	.disp = nv04_disp_new,
567
	.dma = nv04_dma_new,
568
	.fifo = nv40_fifo_new,
569
	.gr = nv40_gr_new,
570
	.mpeg = nv40_mpeg_new,
571
	.pm = nv40_pm_new,
572
	.sw = nv10_sw_new,
573 574 575 576 577
};

static const struct nvkm_device_chip
nv44_chipset = {
	.name = "NV44",
578
	.bios = nvkm_bios_new,
579
	.bus = nv31_bus_new,
580
	.clk = nv40_clk_new,
581
	.devinit = nv1a_devinit_new,
582
	.fb = nv44_fb_new,
583
	.gpio = nv10_gpio_new,
584
	.i2c = nv04_i2c_new,
585
	.imem = nv40_instmem_new,
586
	.mc = nv44_mc_new,
587
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
588
	.pci = nv40_pci_new,
589
	.therm = nv40_therm_new,
590
	.timer = nv41_timer_new,
591
	.volt = nv40_volt_new,
592
	.disp = nv04_disp_new,
593
	.dma = nv04_dma_new,
594
	.fifo = nv40_fifo_new,
595
	.gr = nv44_gr_new,
596
	.mpeg = nv44_mpeg_new,
597
	.pm = nv40_pm_new,
598
	.sw = nv10_sw_new,
599 600 601 602 603
};

static const struct nvkm_device_chip
nv45_chipset = {
	.name = "NV45",
604
	.bios = nvkm_bios_new,
605
	.bus = nv31_bus_new,
606
	.clk = nv40_clk_new,
607
	.devinit = nv1a_devinit_new,
608
	.fb = nv40_fb_new,
609
	.gpio = nv10_gpio_new,
610
	.i2c = nv04_i2c_new,
611
	.imem = nv40_instmem_new,
612
	.mc = nv04_mc_new,
613
	.mmu = nv04_mmu_new,
B
Ben Skeggs 已提交
614
	.pci = nv40_pci_new,
615
	.therm = nv40_therm_new,
616
	.timer = nv41_timer_new,
617
	.volt = nv40_volt_new,
618
	.disp = nv04_disp_new,
619
	.dma = nv04_dma_new,
620
	.fifo = nv40_fifo_new,
621
	.gr = nv40_gr_new,
622
	.mpeg = nv44_mpeg_new,
623
	.pm = nv40_pm_new,
624
	.sw = nv10_sw_new,
625 626 627 628 629
};

static const struct nvkm_device_chip
nv46_chipset = {
	.name = "G72",
630
	.bios = nvkm_bios_new,
631
	.bus = nv31_bus_new,
632
	.clk = nv40_clk_new,
633
	.devinit = nv1a_devinit_new,
634
	.fb = nv46_fb_new,
635
	.gpio = nv10_gpio_new,
636
	.i2c = nv04_i2c_new,
637
	.imem = nv40_instmem_new,
638
	.mc = nv44_mc_new,
639
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
640
	.pci = nv4c_pci_new,
641
	.therm = nv40_therm_new,
642
	.timer = nv41_timer_new,
643
	.volt = nv40_volt_new,
644
	.disp = nv04_disp_new,
645
	.dma = nv04_dma_new,
646
	.fifo = nv40_fifo_new,
647
	.gr = nv44_gr_new,
648
	.mpeg = nv44_mpeg_new,
649
	.pm = nv40_pm_new,
650
	.sw = nv10_sw_new,
651 652 653 654 655
};

static const struct nvkm_device_chip
nv47_chipset = {
	.name = "G70",
656
	.bios = nvkm_bios_new,
657
	.bus = nv31_bus_new,
658
	.clk = nv40_clk_new,
659
	.devinit = nv1a_devinit_new,
660
	.fb = nv47_fb_new,
661
	.gpio = nv10_gpio_new,
662
	.i2c = nv04_i2c_new,
663
	.imem = nv40_instmem_new,
664
	.mc = nv04_mc_new,
665
	.mmu = nv41_mmu_new,
B
Ben Skeggs 已提交
666
	.pci = nv40_pci_new,
667
	.therm = nv40_therm_new,
668
	.timer = nv41_timer_new,
669
	.volt = nv40_volt_new,
670
	.disp = nv04_disp_new,
671
	.dma = nv04_dma_new,
672
	.fifo = nv40_fifo_new,
673
	.gr = nv40_gr_new,
674
	.mpeg = nv44_mpeg_new,
675
	.pm = nv40_pm_new,
676
	.sw = nv10_sw_new,
677 678 679 680 681
};

static const struct nvkm_device_chip
nv49_chipset = {
	.name = "G71",
682
	.bios = nvkm_bios_new,
683
	.bus = nv31_bus_new,
684
	.clk = nv40_clk_new,
685
	.devinit = nv1a_devinit_new,
686
	.fb = nv49_fb_new,
687
	.gpio = nv10_gpio_new,
688
	.i2c = nv04_i2c_new,
689
	.imem = nv40_instmem_new,
690
	.mc = nv04_mc_new,
691
	.mmu = nv41_mmu_new,
B
Ben Skeggs 已提交
692
	.pci = nv40_pci_new,
693
	.therm = nv40_therm_new,
694
	.timer = nv41_timer_new,
695
	.volt = nv40_volt_new,
696
	.disp = nv04_disp_new,
697
	.dma = nv04_dma_new,
698
	.fifo = nv40_fifo_new,
699
	.gr = nv40_gr_new,
700
	.mpeg = nv44_mpeg_new,
701
	.pm = nv40_pm_new,
702
	.sw = nv10_sw_new,
703 704 705 706 707
};

static const struct nvkm_device_chip
nv4a_chipset = {
	.name = "NV44A",
708
	.bios = nvkm_bios_new,
709
	.bus = nv31_bus_new,
710
	.clk = nv40_clk_new,
711
	.devinit = nv1a_devinit_new,
712
	.fb = nv44_fb_new,
713
	.gpio = nv10_gpio_new,
714
	.i2c = nv04_i2c_new,
715
	.imem = nv40_instmem_new,
716
	.mc = nv44_mc_new,
717
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
718
	.pci = nv40_pci_new,
719
	.therm = nv40_therm_new,
720
	.timer = nv41_timer_new,
721
	.volt = nv40_volt_new,
722
	.disp = nv04_disp_new,
723
	.dma = nv04_dma_new,
724
	.fifo = nv40_fifo_new,
725
	.gr = nv44_gr_new,
726
	.mpeg = nv44_mpeg_new,
727
	.pm = nv40_pm_new,
728
	.sw = nv10_sw_new,
729 730 731 732 733
};

static const struct nvkm_device_chip
nv4b_chipset = {
	.name = "G73",
734
	.bios = nvkm_bios_new,
735
	.bus = nv31_bus_new,
736
	.clk = nv40_clk_new,
737
	.devinit = nv1a_devinit_new,
738
	.fb = nv49_fb_new,
739
	.gpio = nv10_gpio_new,
740
	.i2c = nv04_i2c_new,
741
	.imem = nv40_instmem_new,
742
	.mc = nv04_mc_new,
743
	.mmu = nv41_mmu_new,
B
Ben Skeggs 已提交
744
	.pci = nv40_pci_new,
745
	.therm = nv40_therm_new,
746
	.timer = nv41_timer_new,
747
	.volt = nv40_volt_new,
748
	.disp = nv04_disp_new,
749
	.dma = nv04_dma_new,
750
	.fifo = nv40_fifo_new,
751
	.gr = nv40_gr_new,
752
	.mpeg = nv44_mpeg_new,
753
	.pm = nv40_pm_new,
754
	.sw = nv10_sw_new,
755 756 757 758 759
};

static const struct nvkm_device_chip
nv4c_chipset = {
	.name = "C61",
760
	.bios = nvkm_bios_new,
761
	.bus = nv31_bus_new,
762
	.clk = nv40_clk_new,
763
	.devinit = nv1a_devinit_new,
764
	.fb = nv46_fb_new,
765
	.gpio = nv10_gpio_new,
766
	.i2c = nv04_i2c_new,
767
	.imem = nv40_instmem_new,
768
	.mc = nv44_mc_new,
769
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
770
	.pci = nv4c_pci_new,
771
	.therm = nv40_therm_new,
772
	.timer = nv41_timer_new,
773
	.volt = nv40_volt_new,
774
	.disp = nv04_disp_new,
775
	.dma = nv04_dma_new,
776
	.fifo = nv40_fifo_new,
777
	.gr = nv44_gr_new,
778
	.mpeg = nv44_mpeg_new,
779
	.pm = nv40_pm_new,
780
	.sw = nv10_sw_new,
781 782 783 784 785
};

static const struct nvkm_device_chip
nv4e_chipset = {
	.name = "C51",
786
	.bios = nvkm_bios_new,
787
	.bus = nv31_bus_new,
788
	.clk = nv40_clk_new,
789
	.devinit = nv1a_devinit_new,
790
	.fb = nv4e_fb_new,
791
	.gpio = nv10_gpio_new,
792
	.i2c = nv4e_i2c_new,
793
	.imem = nv40_instmem_new,
794
	.mc = nv44_mc_new,
795
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
796
	.pci = nv4c_pci_new,
797
	.therm = nv40_therm_new,
798
	.timer = nv41_timer_new,
799
	.volt = nv40_volt_new,
800
	.disp = nv04_disp_new,
801
	.dma = nv04_dma_new,
802
	.fifo = nv40_fifo_new,
803
	.gr = nv44_gr_new,
804
	.mpeg = nv44_mpeg_new,
805
	.pm = nv40_pm_new,
806
	.sw = nv10_sw_new,
807 808 809 810 811
};

static const struct nvkm_device_chip
nv50_chipset = {
	.name = "G80",
812
	.bar = nv50_bar_new,
813
	.bios = nvkm_bios_new,
814
	.bus = nv50_bus_new,
815
	.clk = nv50_clk_new,
816
	.devinit = nv50_devinit_new,
817
	.fb = nv50_fb_new,
818
	.fuse = nv50_fuse_new,
819
	.gpio = nv50_gpio_new,
820
	.i2c = nv50_i2c_new,
821
	.imem = nv50_instmem_new,
822
	.mc = nv50_mc_new,
823
	.mmu = nv50_mmu_new,
824
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
825
	.pci = nv50_pci_new,
826
	.therm = nv50_therm_new,
827
	.timer = nv41_timer_new,
828
	.volt = nv40_volt_new,
829
	.disp = nv50_disp_new,
830
	.dma = nv50_dma_new,
831
	.fifo = nv50_fifo_new,
832
	.gr = nv50_gr_new,
833
	.mpeg = nv50_mpeg_new,
834
	.pm = nv50_pm_new,
835
	.sw = nv50_sw_new,
836 837 838 839 840
};

static const struct nvkm_device_chip
nv63_chipset = {
	.name = "C73",
841
	.bios = nvkm_bios_new,
842
	.bus = nv31_bus_new,
843
	.clk = nv40_clk_new,
844
	.devinit = nv1a_devinit_new,
845
	.fb = nv46_fb_new,
846
	.gpio = nv10_gpio_new,
847
	.i2c = nv04_i2c_new,
848
	.imem = nv40_instmem_new,
849
	.mc = nv44_mc_new,
850
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
851
	.pci = nv4c_pci_new,
852
	.therm = nv40_therm_new,
853
	.timer = nv41_timer_new,
854
	.volt = nv40_volt_new,
855
	.disp = nv04_disp_new,
856
	.dma = nv04_dma_new,
857
	.fifo = nv40_fifo_new,
858
	.gr = nv44_gr_new,
859
	.mpeg = nv44_mpeg_new,
860
	.pm = nv40_pm_new,
861
	.sw = nv10_sw_new,
862 863 864 865 866
};

static const struct nvkm_device_chip
nv67_chipset = {
	.name = "C67",
867
	.bios = nvkm_bios_new,
868
	.bus = nv31_bus_new,
869
	.clk = nv40_clk_new,
870
	.devinit = nv1a_devinit_new,
871
	.fb = nv46_fb_new,
872
	.gpio = nv10_gpio_new,
873
	.i2c = nv04_i2c_new,
874
	.imem = nv40_instmem_new,
875
	.mc = nv44_mc_new,
876
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
877
	.pci = nv4c_pci_new,
878
	.therm = nv40_therm_new,
879
	.timer = nv41_timer_new,
880
	.volt = nv40_volt_new,
881
	.disp = nv04_disp_new,
882
	.dma = nv04_dma_new,
883
	.fifo = nv40_fifo_new,
884
	.gr = nv44_gr_new,
885
	.mpeg = nv44_mpeg_new,
886
	.pm = nv40_pm_new,
887
	.sw = nv10_sw_new,
888 889 890 891 892
};

static const struct nvkm_device_chip
nv68_chipset = {
	.name = "C68",
893
	.bios = nvkm_bios_new,
894
	.bus = nv31_bus_new,
895
	.clk = nv40_clk_new,
896
	.devinit = nv1a_devinit_new,
897
	.fb = nv46_fb_new,
898
	.gpio = nv10_gpio_new,
899
	.i2c = nv04_i2c_new,
900
	.imem = nv40_instmem_new,
901
	.mc = nv44_mc_new,
902
	.mmu = nv44_mmu_new,
B
Ben Skeggs 已提交
903
	.pci = nv4c_pci_new,
904
	.therm = nv40_therm_new,
905
	.timer = nv41_timer_new,
906
	.volt = nv40_volt_new,
907
	.disp = nv04_disp_new,
908
	.dma = nv04_dma_new,
909
	.fifo = nv40_fifo_new,
910
	.gr = nv44_gr_new,
911
	.mpeg = nv44_mpeg_new,
912
	.pm = nv40_pm_new,
913
	.sw = nv10_sw_new,
914 915 916 917 918
};

static const struct nvkm_device_chip
nv84_chipset = {
	.name = "G84",
919
	.bar = g84_bar_new,
920
	.bios = nvkm_bios_new,
921
	.bus = nv50_bus_new,
922
	.clk = g84_clk_new,
923
	.devinit = g84_devinit_new,
924
	.fb = g84_fb_new,
925
	.fuse = nv50_fuse_new,
926
	.gpio = nv50_gpio_new,
927
	.i2c = nv50_i2c_new,
928
	.imem = nv50_instmem_new,
929
	.mc = nv50_mc_new,
930
	.mmu = nv50_mmu_new,
931
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
932
	.pci = nv50_pci_new,
933
	.therm = g84_therm_new,
934
	.timer = nv41_timer_new,
935
	.volt = nv40_volt_new,
936
	.bsp = g84_bsp_new,
937
	.cipher = g84_cipher_new,
938
	.disp = g84_disp_new,
939
	.dma = nv50_dma_new,
940
	.fifo = g84_fifo_new,
941
	.gr = g84_gr_new,
942
	.mpeg = g84_mpeg_new,
943
	.pm = g84_pm_new,
944
	.sw = nv50_sw_new,
945
	.vp = g84_vp_new,
946 947 948 949 950
};

static const struct nvkm_device_chip
nv86_chipset = {
	.name = "G86",
951
	.bar = g84_bar_new,
952
	.bios = nvkm_bios_new,
953
	.bus = nv50_bus_new,
954
	.clk = g84_clk_new,
955
	.devinit = g84_devinit_new,
956
	.fb = g84_fb_new,
957
	.fuse = nv50_fuse_new,
958
	.gpio = nv50_gpio_new,
959
	.i2c = nv50_i2c_new,
960
	.imem = nv50_instmem_new,
961
	.mc = nv50_mc_new,
962
	.mmu = nv50_mmu_new,
963
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
964
	.pci = nv50_pci_new,
965
	.therm = g84_therm_new,
966
	.timer = nv41_timer_new,
967
	.volt = nv40_volt_new,
968
	.bsp = g84_bsp_new,
969
	.cipher = g84_cipher_new,
970
	.disp = g84_disp_new,
971
	.dma = nv50_dma_new,
972
	.fifo = g84_fifo_new,
973
	.gr = g84_gr_new,
974
	.mpeg = g84_mpeg_new,
975
	.pm = g84_pm_new,
976
	.sw = nv50_sw_new,
977
	.vp = g84_vp_new,
978 979 980 981 982
};

static const struct nvkm_device_chip
nv92_chipset = {
	.name = "G92",
983
	.bar = g84_bar_new,
984
	.bios = nvkm_bios_new,
985
	.bus = nv50_bus_new,
986
	.clk = g84_clk_new,
987
	.devinit = g84_devinit_new,
988
	.fb = g84_fb_new,
989
	.fuse = nv50_fuse_new,
990
	.gpio = nv50_gpio_new,
991
	.i2c = nv50_i2c_new,
992
	.imem = nv50_instmem_new,
993
	.mc = nv50_mc_new,
994
	.mmu = nv50_mmu_new,
995
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
996
	.pci = nv50_pci_new,
997
	.therm = g84_therm_new,
998
	.timer = nv41_timer_new,
999
	.volt = nv40_volt_new,
1000
	.bsp = g84_bsp_new,
1001
	.cipher = g84_cipher_new,
1002
	.disp = g84_disp_new,
1003
	.dma = nv50_dma_new,
1004
	.fifo = g84_fifo_new,
1005
	.gr = g84_gr_new,
1006
	.mpeg = g84_mpeg_new,
1007
	.pm = g84_pm_new,
1008
	.sw = nv50_sw_new,
1009
	.vp = g84_vp_new,
1010 1011 1012 1013 1014
};

static const struct nvkm_device_chip
nv94_chipset = {
	.name = "G94",
1015
	.bar = g84_bar_new,
1016
	.bios = nvkm_bios_new,
1017
	.bus = g94_bus_new,
1018
	.clk = g84_clk_new,
1019
	.devinit = g84_devinit_new,
1020
	.fb = g84_fb_new,
1021
	.fuse = nv50_fuse_new,
1022
	.gpio = g94_gpio_new,
1023
	.i2c = g94_i2c_new,
1024
	.imem = nv50_instmem_new,
1025
	.mc = nv50_mc_new,
1026
	.mmu = nv50_mmu_new,
1027
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1028
	.pci = nv40_pci_new,
1029
	.therm = g84_therm_new,
1030
	.timer = nv41_timer_new,
1031
	.volt = nv40_volt_new,
1032
	.bsp = g84_bsp_new,
1033
	.cipher = g84_cipher_new,
1034
	.disp = g94_disp_new,
1035
	.dma = nv50_dma_new,
1036
	.fifo = g84_fifo_new,
1037
	.gr = g84_gr_new,
1038
	.mpeg = g84_mpeg_new,
1039
	.pm = g84_pm_new,
1040
	.sw = nv50_sw_new,
1041
	.vp = g84_vp_new,
1042 1043 1044 1045 1046
};

static const struct nvkm_device_chip
nv96_chipset = {
	.name = "G96",
B
Ben Skeggs 已提交
1047
	.bar = g84_bar_new,
1048
	.bios = nvkm_bios_new,
B
Ben Skeggs 已提交
1049
	.bus = g94_bus_new,
1050
	.clk = g84_clk_new,
1051
	.devinit = g84_devinit_new,
1052
	.fb = g84_fb_new,
B
Ben Skeggs 已提交
1053 1054 1055
	.fuse = nv50_fuse_new,
	.gpio = g94_gpio_new,
	.i2c = g94_i2c_new,
1056
	.imem = nv50_instmem_new,
1057
	.mc = nv50_mc_new,
1058
	.mmu = nv50_mmu_new,
B
Ben Skeggs 已提交
1059 1060 1061 1062
	.mxm = nv50_mxm_new,
	.pci = nv40_pci_new,
	.therm = g84_therm_new,
	.timer = nv41_timer_new,
1063
	.volt = nv40_volt_new,
B
Ben Skeggs 已提交
1064 1065 1066
	.bsp = g84_bsp_new,
	.cipher = g84_cipher_new,
	.disp = g94_disp_new,
1067
	.dma = nv50_dma_new,
1068
	.fifo = g84_fifo_new,
1069
	.gr = g84_gr_new,
1070
	.mpeg = g84_mpeg_new,
1071
	.pm = g84_pm_new,
B
Ben Skeggs 已提交
1072 1073
	.sw = nv50_sw_new,
	.vp = g84_vp_new,
1074 1075 1076 1077 1078
};

static const struct nvkm_device_chip
nv98_chipset = {
	.name = "G98",
B
Ben Skeggs 已提交
1079
	.bar = g84_bar_new,
1080
	.bios = nvkm_bios_new,
B
Ben Skeggs 已提交
1081
	.bus = g94_bus_new,
1082
	.clk = g84_clk_new,
1083
	.devinit = g98_devinit_new,
1084
	.fb = g84_fb_new,
B
Ben Skeggs 已提交
1085 1086 1087
	.fuse = nv50_fuse_new,
	.gpio = g94_gpio_new,
	.i2c = g94_i2c_new,
1088
	.imem = nv50_instmem_new,
B
Ben Skeggs 已提交
1089
	.mc = g98_mc_new,
1090
	.mmu = nv50_mmu_new,
B
Ben Skeggs 已提交
1091 1092 1093 1094
	.mxm = nv50_mxm_new,
	.pci = nv40_pci_new,
	.therm = g84_therm_new,
	.timer = nv41_timer_new,
1095
	.volt = nv40_volt_new,
B
Ben Skeggs 已提交
1096
	.disp = g94_disp_new,
1097
	.dma = nv50_dma_new,
1098
	.fifo = g84_fifo_new,
1099
	.gr = g84_gr_new,
1100 1101
	.mspdec = g98_mspdec_new,
	.msppp = g98_msppp_new,
B
Ben Skeggs 已提交
1102
	.msvld = g98_msvld_new,
1103
	.pm = g84_pm_new,
B
Ben Skeggs 已提交
1104 1105
	.sec = g98_sec_new,
	.sw = nv50_sw_new,
1106 1107 1108 1109 1110
};

static const struct nvkm_device_chip
nva0_chipset = {
	.name = "GT200",
1111
	.bar = g84_bar_new,
1112
	.bios = nvkm_bios_new,
1113
	.bus = g94_bus_new,
1114
	.clk = g84_clk_new,
1115
	.devinit = g84_devinit_new,
1116
	.fb = g84_fb_new,
1117
	.fuse = nv50_fuse_new,
1118
	.gpio = g94_gpio_new,
1119
	.i2c = nv50_i2c_new,
1120
	.imem = nv50_instmem_new,
1121
	.mc = g98_mc_new,
1122
	.mmu = nv50_mmu_new,
1123
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1124
	.pci = nv40_pci_new,
1125
	.therm = g84_therm_new,
1126
	.timer = nv41_timer_new,
1127
	.volt = nv40_volt_new,
1128
	.bsp = g84_bsp_new,
1129
	.cipher = g84_cipher_new,
1130
	.disp = gt200_disp_new,
1131
	.dma = nv50_dma_new,
1132
	.fifo = g84_fifo_new,
1133
	.gr = gt200_gr_new,
1134
	.mpeg = g84_mpeg_new,
1135
	.pm = gt200_pm_new,
1136
	.sw = nv50_sw_new,
1137
	.vp = g84_vp_new,
1138 1139 1140 1141 1142
};

static const struct nvkm_device_chip
nva3_chipset = {
	.name = "GT215",
1143
	.bar = g84_bar_new,
1144
	.bios = nvkm_bios_new,
1145
	.bus = g94_bus_new,
1146
	.clk = gt215_clk_new,
1147
	.devinit = gt215_devinit_new,
1148
	.fb = gt215_fb_new,
1149
	.fuse = nv50_fuse_new,
1150
	.gpio = g94_gpio_new,
1151
	.i2c = g94_i2c_new,
1152
	.imem = nv50_instmem_new,
1153
	.mc = g98_mc_new,
1154
	.mmu = nv50_mmu_new,
1155
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1156
	.pci = nv40_pci_new,
1157
	.pmu = gt215_pmu_new,
1158
	.therm = gt215_therm_new,
1159
	.timer = nv41_timer_new,
1160
	.volt = nv40_volt_new,
1161
	.ce[0] = gt215_ce_new,
1162
	.disp = gt215_disp_new,
1163
	.dma = nv50_dma_new,
1164
	.fifo = g84_fifo_new,
1165
	.gr = gt215_gr_new,
1166
	.mpeg = g84_mpeg_new,
1167 1168 1169
	.mspdec = gt215_mspdec_new,
	.msppp = gt215_msppp_new,
	.msvld = gt215_msvld_new,
1170
	.pm = gt215_pm_new,
1171
	.sw = nv50_sw_new,
1172 1173 1174 1175 1176
};

static const struct nvkm_device_chip
nva5_chipset = {
	.name = "GT216",
1177
	.bar = g84_bar_new,
1178
	.bios = nvkm_bios_new,
1179
	.bus = g94_bus_new,
1180
	.clk = gt215_clk_new,
1181
	.devinit = gt215_devinit_new,
1182
	.fb = gt215_fb_new,
1183
	.fuse = nv50_fuse_new,
1184
	.gpio = g94_gpio_new,
1185
	.i2c = g94_i2c_new,
1186
	.imem = nv50_instmem_new,
1187
	.mc = g98_mc_new,
1188
	.mmu = nv50_mmu_new,
1189
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1190
	.pci = nv40_pci_new,
1191
	.pmu = gt215_pmu_new,
1192
	.therm = gt215_therm_new,
1193
	.timer = nv41_timer_new,
1194
	.volt = nv40_volt_new,
1195
	.ce[0] = gt215_ce_new,
1196
	.disp = gt215_disp_new,
1197
	.dma = nv50_dma_new,
1198
	.fifo = g84_fifo_new,
1199
	.gr = gt215_gr_new,
1200 1201 1202
	.mspdec = gt215_mspdec_new,
	.msppp = gt215_msppp_new,
	.msvld = gt215_msvld_new,
1203
	.pm = gt215_pm_new,
1204
	.sw = nv50_sw_new,
1205 1206 1207 1208 1209
};

static const struct nvkm_device_chip
nva8_chipset = {
	.name = "GT218",
1210
	.bar = g84_bar_new,
1211
	.bios = nvkm_bios_new,
1212
	.bus = g94_bus_new,
1213
	.clk = gt215_clk_new,
1214
	.devinit = gt215_devinit_new,
1215
	.fb = gt215_fb_new,
1216
	.fuse = nv50_fuse_new,
1217
	.gpio = g94_gpio_new,
1218
	.i2c = g94_i2c_new,
1219
	.imem = nv50_instmem_new,
1220
	.mc = g98_mc_new,
1221
	.mmu = nv50_mmu_new,
1222
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1223
	.pci = nv40_pci_new,
1224
	.pmu = gt215_pmu_new,
1225
	.therm = gt215_therm_new,
1226
	.timer = nv41_timer_new,
1227
	.volt = nv40_volt_new,
1228
	.ce[0] = gt215_ce_new,
1229
	.disp = gt215_disp_new,
1230
	.dma = nv50_dma_new,
1231
	.fifo = g84_fifo_new,
1232
	.gr = gt215_gr_new,
1233 1234 1235
	.mspdec = gt215_mspdec_new,
	.msppp = gt215_msppp_new,
	.msvld = gt215_msvld_new,
1236
	.pm = gt215_pm_new,
1237
	.sw = nv50_sw_new,
1238 1239 1240 1241 1242
};

static const struct nvkm_device_chip
nvaa_chipset = {
	.name = "MCP77/MCP78",
1243
	.bar = g84_bar_new,
1244
	.bios = nvkm_bios_new,
1245
	.bus = g94_bus_new,
1246
	.clk = mcp77_clk_new,
1247
	.devinit = g98_devinit_new,
1248
	.fb = mcp77_fb_new,
1249
	.fuse = nv50_fuse_new,
1250
	.gpio = g94_gpio_new,
1251
	.i2c = g94_i2c_new,
1252
	.imem = nv50_instmem_new,
1253
	.mc = g98_mc_new,
1254
	.mmu = nv50_mmu_new,
1255
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1256
	.pci = nv40_pci_new,
1257
	.therm = g84_therm_new,
1258
	.timer = nv41_timer_new,
1259
	.volt = nv40_volt_new,
1260
	.disp = g94_disp_new,
1261
	.dma = nv50_dma_new,
1262
	.fifo = g84_fifo_new,
1263
	.gr = gt200_gr_new,
1264 1265 1266
	.mspdec = g98_mspdec_new,
	.msppp = g98_msppp_new,
	.msvld = g98_msvld_new,
1267
	.pm = g84_pm_new,
1268
	.sec = g98_sec_new,
1269
	.sw = nv50_sw_new,
1270 1271 1272 1273 1274
};

static const struct nvkm_device_chip
nvac_chipset = {
	.name = "MCP79/MCP7A",
1275
	.bar = g84_bar_new,
1276
	.bios = nvkm_bios_new,
1277
	.bus = g94_bus_new,
1278
	.clk = mcp77_clk_new,
1279
	.devinit = g98_devinit_new,
1280
	.fb = mcp77_fb_new,
1281
	.fuse = nv50_fuse_new,
1282
	.gpio = g94_gpio_new,
1283
	.i2c = g94_i2c_new,
1284
	.imem = nv50_instmem_new,
1285
	.mc = g98_mc_new,
1286
	.mmu = nv50_mmu_new,
1287
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1288
	.pci = nv40_pci_new,
1289
	.therm = g84_therm_new,
1290
	.timer = nv41_timer_new,
1291
	.volt = nv40_volt_new,
1292
	.disp = g94_disp_new,
1293
	.dma = nv50_dma_new,
1294
	.fifo = g84_fifo_new,
1295
	.gr = mcp79_gr_new,
1296 1297 1298
	.mspdec = g98_mspdec_new,
	.msppp = g98_msppp_new,
	.msvld = g98_msvld_new,
1299
	.pm = g84_pm_new,
1300
	.sec = g98_sec_new,
1301
	.sw = nv50_sw_new,
1302 1303 1304 1305 1306
};

static const struct nvkm_device_chip
nvaf_chipset = {
	.name = "MCP89",
1307
	.bar = g84_bar_new,
1308
	.bios = nvkm_bios_new,
1309
	.bus = g94_bus_new,
1310
	.clk = gt215_clk_new,
1311
	.devinit = mcp89_devinit_new,
1312
	.fb = mcp89_fb_new,
1313
	.fuse = nv50_fuse_new,
1314
	.gpio = g94_gpio_new,
1315
	.i2c = g94_i2c_new,
1316
	.imem = nv50_instmem_new,
1317
	.mc = g98_mc_new,
1318
	.mmu = nv50_mmu_new,
1319
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1320
	.pci = nv40_pci_new,
1321
	.pmu = gt215_pmu_new,
1322
	.therm = gt215_therm_new,
1323
	.timer = nv41_timer_new,
1324
	.volt = nv40_volt_new,
1325
	.ce[0] = gt215_ce_new,
1326
	.disp = gt215_disp_new,
1327
	.dma = nv50_dma_new,
1328
	.fifo = g84_fifo_new,
1329
	.gr = mcp89_gr_new,
1330 1331 1332
	.mspdec = gt215_mspdec_new,
	.msppp = gt215_msppp_new,
	.msvld = mcp89_msvld_new,
1333
	.pm = gt215_pm_new,
1334
	.sw = nv50_sw_new,
1335 1336 1337 1338 1339
};

static const struct nvkm_device_chip
nvc0_chipset = {
	.name = "GF100",
1340
	.bar = gf100_bar_new,
1341
	.bios = nvkm_bios_new,
1342
	.bus = gf100_bus_new,
1343
	.clk = gf100_clk_new,
1344
	.devinit = gf100_devinit_new,
1345
	.fb = gf100_fb_new,
1346
	.fuse = gf100_fuse_new,
1347
	.gpio = g94_gpio_new,
1348
	.i2c = g94_i2c_new,
1349
	.ibus = gf100_ibus_new,
1350
	.imem = nv50_instmem_new,
1351
	.ltc = gf100_ltc_new,
1352
	.mc = gf100_mc_new,
1353
	.mmu = gf100_mmu_new,
1354
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1355
	.pci = gf100_pci_new,
1356
	.pmu = gf100_pmu_new,
1357
	.therm = gt215_therm_new,
1358
	.timer = nv41_timer_new,
1359
	.volt = nv40_volt_new,
1360 1361
	.ce[0] = gf100_ce_new,
	.ce[1] = gf100_ce_new,
1362
	.disp = gt215_disp_new,
1363
	.dma = gf100_dma_new,
1364
	.fifo = gf100_fifo_new,
1365
	.gr = gf100_gr_new,
1366 1367 1368
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1369
	.pm = gf100_pm_new,
1370
	.sw = gf100_sw_new,
1371 1372 1373 1374 1375
};

static const struct nvkm_device_chip
nvc1_chipset = {
	.name = "GF108",
1376
	.bar = gf100_bar_new,
1377
	.bios = nvkm_bios_new,
1378
	.bus = gf100_bus_new,
1379
	.clk = gf100_clk_new,
1380
	.devinit = gf100_devinit_new,
1381
	.fb = gf100_fb_new,
1382
	.fuse = gf100_fuse_new,
1383
	.gpio = g94_gpio_new,
1384
	.i2c = g94_i2c_new,
1385
	.ibus = gf100_ibus_new,
1386
	.imem = nv50_instmem_new,
1387
	.ltc = gf100_ltc_new,
1388
	.mc = gf100_mc_new,
1389
	.mmu = gf100_mmu_new,
1390
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1391
	.pci = nv40_pci_new,
1392
	.pmu = gf100_pmu_new,
1393
	.therm = gt215_therm_new,
1394
	.timer = nv41_timer_new,
1395
	.volt = nv40_volt_new,
1396
	.ce[0] = gf100_ce_new,
1397
	.disp = gt215_disp_new,
1398
	.dma = gf100_dma_new,
1399
	.fifo = gf100_fifo_new,
1400
	.gr = gf108_gr_new,
1401 1402 1403
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1404
	.pm = gf108_pm_new,
1405
	.sw = gf100_sw_new,
1406 1407 1408 1409 1410
};

static const struct nvkm_device_chip
nvc3_chipset = {
	.name = "GF106",
1411
	.bar = gf100_bar_new,
1412
	.bios = nvkm_bios_new,
1413
	.bus = gf100_bus_new,
1414
	.clk = gf100_clk_new,
1415
	.devinit = gf100_devinit_new,
1416
	.fb = gf100_fb_new,
1417
	.fuse = gf100_fuse_new,
1418
	.gpio = g94_gpio_new,
1419
	.i2c = g94_i2c_new,
1420
	.ibus = gf100_ibus_new,
1421
	.imem = nv50_instmem_new,
1422
	.ltc = gf100_ltc_new,
1423
	.mc = gf100_mc_new,
1424
	.mmu = gf100_mmu_new,
1425
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1426
	.pci = nv40_pci_new,
1427
	.pmu = gf100_pmu_new,
1428
	.therm = gt215_therm_new,
1429
	.timer = nv41_timer_new,
1430
	.volt = nv40_volt_new,
1431
	.ce[0] = gf100_ce_new,
1432
	.disp = gt215_disp_new,
1433
	.dma = gf100_dma_new,
1434
	.fifo = gf100_fifo_new,
1435
	.gr = gf104_gr_new,
1436 1437 1438
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1439
	.pm = gf100_pm_new,
1440
	.sw = gf100_sw_new,
1441 1442 1443 1444 1445
};

static const struct nvkm_device_chip
nvc4_chipset = {
	.name = "GF104",
1446
	.bar = gf100_bar_new,
1447
	.bios = nvkm_bios_new,
1448
	.bus = gf100_bus_new,
1449
	.clk = gf100_clk_new,
1450
	.devinit = gf100_devinit_new,
1451
	.fb = gf100_fb_new,
1452
	.fuse = gf100_fuse_new,
1453
	.gpio = g94_gpio_new,
1454
	.i2c = g94_i2c_new,
1455
	.ibus = gf100_ibus_new,
1456
	.imem = nv50_instmem_new,
1457
	.ltc = gf100_ltc_new,
1458
	.mc = gf100_mc_new,
1459
	.mmu = gf100_mmu_new,
1460
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1461
	.pci = gf100_pci_new,
1462
	.pmu = gf100_pmu_new,
1463
	.therm = gt215_therm_new,
1464
	.timer = nv41_timer_new,
1465
	.volt = nv40_volt_new,
1466 1467
	.ce[0] = gf100_ce_new,
	.ce[1] = gf100_ce_new,
1468
	.disp = gt215_disp_new,
1469
	.dma = gf100_dma_new,
1470
	.fifo = gf100_fifo_new,
1471
	.gr = gf104_gr_new,
1472 1473 1474
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1475
	.pm = gf100_pm_new,
1476
	.sw = gf100_sw_new,
1477 1478 1479 1480 1481
};

static const struct nvkm_device_chip
nvc8_chipset = {
	.name = "GF110",
1482
	.bar = gf100_bar_new,
1483
	.bios = nvkm_bios_new,
1484
	.bus = gf100_bus_new,
1485
	.clk = gf100_clk_new,
1486
	.devinit = gf100_devinit_new,
1487
	.fb = gf100_fb_new,
1488
	.fuse = gf100_fuse_new,
1489
	.gpio = g94_gpio_new,
1490
	.i2c = g94_i2c_new,
1491
	.ibus = gf100_ibus_new,
1492
	.imem = nv50_instmem_new,
1493
	.ltc = gf100_ltc_new,
1494
	.mc = gf100_mc_new,
1495
	.mmu = gf100_mmu_new,
1496
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1497
	.pci = gf100_pci_new,
1498
	.pmu = gf100_pmu_new,
1499
	.therm = gt215_therm_new,
1500
	.timer = nv41_timer_new,
1501
	.volt = nv40_volt_new,
1502 1503
	.ce[0] = gf100_ce_new,
	.ce[1] = gf100_ce_new,
1504
	.disp = gt215_disp_new,
1505
	.dma = gf100_dma_new,
1506
	.fifo = gf100_fifo_new,
1507
	.gr = gf110_gr_new,
1508 1509 1510
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1511
	.pm = gf100_pm_new,
1512
	.sw = gf100_sw_new,
1513 1514 1515 1516 1517
};

static const struct nvkm_device_chip
nvce_chipset = {
	.name = "GF114",
1518
	.bar = gf100_bar_new,
1519
	.bios = nvkm_bios_new,
1520
	.bus = gf100_bus_new,
1521
	.clk = gf100_clk_new,
1522
	.devinit = gf100_devinit_new,
1523
	.fb = gf100_fb_new,
1524
	.fuse = gf100_fuse_new,
1525
	.gpio = g94_gpio_new,
1526
	.i2c = g94_i2c_new,
1527
	.ibus = gf100_ibus_new,
1528
	.imem = nv50_instmem_new,
1529
	.ltc = gf100_ltc_new,
1530
	.mc = gf100_mc_new,
1531
	.mmu = gf100_mmu_new,
1532
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1533
	.pci = gf100_pci_new,
1534
	.pmu = gf100_pmu_new,
1535
	.therm = gt215_therm_new,
1536
	.timer = nv41_timer_new,
1537
	.volt = nv40_volt_new,
1538 1539
	.ce[0] = gf100_ce_new,
	.ce[1] = gf100_ce_new,
1540
	.disp = gt215_disp_new,
1541
	.dma = gf100_dma_new,
1542
	.fifo = gf100_fifo_new,
1543
	.gr = gf104_gr_new,
1544 1545 1546
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1547
	.pm = gf100_pm_new,
1548
	.sw = gf100_sw_new,
1549 1550 1551 1552 1553
};

static const struct nvkm_device_chip
nvcf_chipset = {
	.name = "GF116",
1554
	.bar = gf100_bar_new,
1555
	.bios = nvkm_bios_new,
1556
	.bus = gf100_bus_new,
1557
	.clk = gf100_clk_new,
1558
	.devinit = gf100_devinit_new,
1559
	.fb = gf100_fb_new,
1560
	.fuse = gf100_fuse_new,
1561
	.gpio = g94_gpio_new,
1562
	.i2c = g94_i2c_new,
1563
	.ibus = gf100_ibus_new,
1564
	.imem = nv50_instmem_new,
1565
	.ltc = gf100_ltc_new,
1566
	.mc = gf100_mc_new,
1567
	.mmu = gf100_mmu_new,
1568
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1569
	.pci = nv40_pci_new,
1570
	.pmu = gf100_pmu_new,
1571
	.therm = gt215_therm_new,
1572
	.timer = nv41_timer_new,
1573
	.volt = nv40_volt_new,
1574
	.ce[0] = gf100_ce_new,
1575
	.disp = gt215_disp_new,
1576
	.dma = gf100_dma_new,
1577
	.fifo = gf100_fifo_new,
1578
	.gr = gf104_gr_new,
1579 1580 1581
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1582
	.pm = gf100_pm_new,
1583
	.sw = gf100_sw_new,
1584 1585 1586 1587 1588
};

static const struct nvkm_device_chip
nvd7_chipset = {
	.name = "GF117",
1589
	.bar = gf100_bar_new,
1590
	.bios = nvkm_bios_new,
1591
	.bus = gf100_bus_new,
1592
	.clk = gf100_clk_new,
1593
	.devinit = gf100_devinit_new,
1594
	.fb = gf100_fb_new,
1595
	.fuse = gf100_fuse_new,
1596
	.gpio = gf119_gpio_new,
1597
	.i2c = gf117_i2c_new,
1598
	.ibus = gf100_ibus_new,
1599
	.imem = nv50_instmem_new,
1600
	.ltc = gf100_ltc_new,
1601
	.mc = gf100_mc_new,
1602
	.mmu = gf100_mmu_new,
1603
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1604
	.pci = nv40_pci_new,
1605
	.therm = gf119_therm_new,
1606
	.timer = nv41_timer_new,
1607
	.ce[0] = gf100_ce_new,
1608
	.disp = gf119_disp_new,
1609
	.dma = gf119_dma_new,
1610
	.fifo = gf100_fifo_new,
1611
	.gr = gf117_gr_new,
1612 1613 1614
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1615
	.pm = gf117_pm_new,
1616
	.sw = gf100_sw_new,
1617 1618 1619 1620 1621
};

static const struct nvkm_device_chip
nvd9_chipset = {
	.name = "GF119",
1622
	.bar = gf100_bar_new,
1623
	.bios = nvkm_bios_new,
1624
	.bus = gf100_bus_new,
1625
	.clk = gf100_clk_new,
1626
	.devinit = gf100_devinit_new,
1627
	.fb = gf100_fb_new,
1628
	.fuse = gf100_fuse_new,
1629
	.gpio = gf119_gpio_new,
1630
	.i2c = gf119_i2c_new,
1631
	.ibus = gf100_ibus_new,
1632
	.imem = nv50_instmem_new,
1633
	.ltc = gf100_ltc_new,
1634
	.mc = gf100_mc_new,
1635
	.mmu = gf100_mmu_new,
1636
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1637
	.pci = nv40_pci_new,
1638
	.pmu = gf119_pmu_new,
1639
	.therm = gf119_therm_new,
1640
	.timer = nv41_timer_new,
1641
	.volt = nv40_volt_new,
1642
	.ce[0] = gf100_ce_new,
1643
	.disp = gf119_disp_new,
1644
	.dma = gf119_dma_new,
1645
	.fifo = gf100_fifo_new,
1646
	.gr = gf119_gr_new,
1647 1648 1649
	.mspdec = gf100_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gf100_msvld_new,
1650
	.pm = gf117_pm_new,
1651
	.sw = gf100_sw_new,
1652 1653 1654 1655 1656
};

static const struct nvkm_device_chip
nve4_chipset = {
	.name = "GK104",
1657
	.bar = gf100_bar_new,
1658
	.bios = nvkm_bios_new,
1659
	.bus = gf100_bus_new,
1660
	.clk = gk104_clk_new,
1661
	.devinit = gf100_devinit_new,
1662
	.fb = gk104_fb_new,
1663
	.fuse = gf100_fuse_new,
1664
	.gpio = gk104_gpio_new,
1665
	.i2c = gk104_i2c_new,
1666
	.ibus = gk104_ibus_new,
1667
	.imem = nv50_instmem_new,
1668
	.ltc = gk104_ltc_new,
1669
	.mc = gf100_mc_new,
1670
	.mmu = gf100_mmu_new,
1671
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1672
	.pci = nv40_pci_new,
1673
	.pmu = gk104_pmu_new,
1674
	.therm = gf119_therm_new,
1675
	.timer = nv41_timer_new,
1676
	.volt = nv40_volt_new,
1677 1678 1679
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1680
	.disp = gk104_disp_new,
1681
	.dma = gf119_dma_new,
1682
	.fifo = gk104_fifo_new,
1683
	.gr = gk104_gr_new,
1684 1685 1686
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1687
	.pm = gk104_pm_new,
1688
	.sw = gf100_sw_new,
1689 1690 1691 1692 1693
};

static const struct nvkm_device_chip
nve6_chipset = {
	.name = "GK106",
1694
	.bar = gf100_bar_new,
1695
	.bios = nvkm_bios_new,
1696
	.bus = gf100_bus_new,
1697
	.clk = gk104_clk_new,
1698
	.devinit = gf100_devinit_new,
1699
	.fb = gk104_fb_new,
1700
	.fuse = gf100_fuse_new,
1701
	.gpio = gk104_gpio_new,
1702
	.i2c = gk104_i2c_new,
1703
	.ibus = gk104_ibus_new,
1704
	.imem = nv50_instmem_new,
1705
	.ltc = gk104_ltc_new,
1706
	.mc = gf100_mc_new,
1707
	.mmu = gf100_mmu_new,
1708
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1709
	.pci = nv40_pci_new,
1710
	.pmu = gk104_pmu_new,
1711
	.therm = gf119_therm_new,
1712
	.timer = nv41_timer_new,
1713
	.volt = nv40_volt_new,
1714 1715 1716
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1717
	.disp = gk104_disp_new,
1718
	.dma = gf119_dma_new,
1719
	.fifo = gk104_fifo_new,
1720
	.gr = gk104_gr_new,
1721 1722 1723
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1724
	.pm = gk104_pm_new,
1725
	.sw = gf100_sw_new,
1726 1727 1728 1729 1730
};

static const struct nvkm_device_chip
nve7_chipset = {
	.name = "GK107",
1731
	.bar = gf100_bar_new,
1732
	.bios = nvkm_bios_new,
1733
	.bus = gf100_bus_new,
1734
	.clk = gk104_clk_new,
1735
	.devinit = gf100_devinit_new,
1736
	.fb = gk104_fb_new,
1737
	.fuse = gf100_fuse_new,
1738
	.gpio = gk104_gpio_new,
1739
	.i2c = gk104_i2c_new,
1740
	.ibus = gk104_ibus_new,
1741
	.imem = nv50_instmem_new,
1742
	.ltc = gk104_ltc_new,
1743
	.mc = gf100_mc_new,
1744
	.mmu = gf100_mmu_new,
1745
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1746
	.pci = nv40_pci_new,
1747
	.pmu = gf119_pmu_new,
1748
	.therm = gf119_therm_new,
1749
	.timer = nv41_timer_new,
1750
	.volt = nv40_volt_new,
1751 1752 1753
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1754
	.disp = gk104_disp_new,
1755
	.dma = gf119_dma_new,
1756
	.fifo = gk104_fifo_new,
1757
	.gr = gk104_gr_new,
1758 1759 1760
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1761
	.pm = gk104_pm_new,
1762
	.sw = gf100_sw_new,
1763 1764 1765 1766 1767
};

static const struct nvkm_device_chip
nvea_chipset = {
	.name = "GK20A",
1768
	.bar = gk20a_bar_new,
1769
	.bus = gf100_bus_new,
1770
	.clk = gk20a_clk_new,
1771
	.fb = gk20a_fb_new,
1772
	.fuse = gf100_fuse_new,
1773
	.ibus = gk20a_ibus_new,
1774
	.imem = gk20a_instmem_new,
1775
	.ltc = gk104_ltc_new,
1776
	.mc = gk20a_mc_new,
1777
	.mmu = gf100_mmu_new,
1778
	.pmu = gk20a_pmu_new,
1779
	.timer = gk20a_timer_new,
1780
	.volt = gk20a_volt_new,
1781
	.ce[2] = gk104_ce_new,
1782
	.dma = gf119_dma_new,
1783
	.fifo = gk20a_fifo_new,
1784
	.gr = gk20a_gr_new,
1785
	.pm = gk104_pm_new,
1786
	.sw = gf100_sw_new,
1787 1788 1789 1790 1791
};

static const struct nvkm_device_chip
nvf0_chipset = {
	.name = "GK110",
1792
	.bar = gf100_bar_new,
1793
	.bios = nvkm_bios_new,
1794
	.bus = gf100_bus_new,
1795
	.clk = gk104_clk_new,
1796
	.devinit = gf100_devinit_new,
1797
	.fb = gk104_fb_new,
1798
	.fuse = gf100_fuse_new,
1799
	.gpio = gk104_gpio_new,
1800
	.i2c = gk104_i2c_new,
1801
	.ibus = gk104_ibus_new,
1802
	.imem = nv50_instmem_new,
1803
	.ltc = gk104_ltc_new,
1804
	.mc = gf100_mc_new,
1805
	.mmu = gf100_mmu_new,
1806
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1807
	.pci = nv40_pci_new,
1808
	.pmu = gk110_pmu_new,
1809
	.therm = gf119_therm_new,
1810
	.timer = nv41_timer_new,
1811
	.volt = nv40_volt_new,
1812 1813 1814
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1815
	.disp = gk110_disp_new,
1816
	.dma = gf119_dma_new,
1817
	.fifo = gk104_fifo_new,
1818
	.gr = gk110_gr_new,
1819 1820 1821
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1822
	.sw = gf100_sw_new,
1823 1824 1825 1826 1827
};

static const struct nvkm_device_chip
nvf1_chipset = {
	.name = "GK110B",
1828
	.bar = gf100_bar_new,
1829
	.bios = nvkm_bios_new,
1830
	.bus = gf100_bus_new,
1831
	.clk = gk104_clk_new,
1832
	.devinit = gf100_devinit_new,
1833
	.fb = gk104_fb_new,
1834
	.fuse = gf100_fuse_new,
1835
	.gpio = gk104_gpio_new,
1836
	.i2c = gf119_i2c_new,
1837
	.ibus = gk104_ibus_new,
1838
	.imem = nv50_instmem_new,
1839
	.ltc = gk104_ltc_new,
1840
	.mc = gf100_mc_new,
1841
	.mmu = gf100_mmu_new,
1842
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1843
	.pci = nv40_pci_new,
1844
	.pmu = gk110_pmu_new,
1845
	.therm = gf119_therm_new,
1846
	.timer = nv41_timer_new,
1847
	.volt = nv40_volt_new,
1848 1849 1850
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1851
	.disp = gk110_disp_new,
1852
	.dma = gf119_dma_new,
1853
	.fifo = gk104_fifo_new,
1854
	.gr = gk110b_gr_new,
1855 1856 1857
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1858
	.sw = gf100_sw_new,
1859 1860 1861 1862 1863
};

static const struct nvkm_device_chip
nv106_chipset = {
	.name = "GK208B",
1864
	.bar = gf100_bar_new,
1865
	.bios = nvkm_bios_new,
1866
	.bus = gf100_bus_new,
1867
	.clk = gk104_clk_new,
1868
	.devinit = gf100_devinit_new,
1869
	.fb = gk104_fb_new,
1870
	.fuse = gf100_fuse_new,
1871
	.gpio = gk104_gpio_new,
1872
	.i2c = gk104_i2c_new,
1873
	.ibus = gk104_ibus_new,
1874
	.imem = nv50_instmem_new,
1875
	.ltc = gk104_ltc_new,
1876
	.mc = gk20a_mc_new,
1877
	.mmu = gf100_mmu_new,
1878
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1879
	.pci = nv40_pci_new,
1880
	.pmu = gk208_pmu_new,
1881
	.therm = gf119_therm_new,
1882
	.timer = nv41_timer_new,
1883
	.volt = nv40_volt_new,
1884 1885 1886
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1887
	.disp = gk110_disp_new,
1888
	.dma = gf119_dma_new,
1889
	.fifo = gk208_fifo_new,
1890
	.gr = gk208_gr_new,
1891 1892 1893
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1894
	.sw = gf100_sw_new,
1895 1896 1897 1898 1899
};

static const struct nvkm_device_chip
nv108_chipset = {
	.name = "GK208",
1900
	.bar = gf100_bar_new,
1901
	.bios = nvkm_bios_new,
1902
	.bus = gf100_bus_new,
1903
	.clk = gk104_clk_new,
1904
	.devinit = gf100_devinit_new,
1905
	.fb = gk104_fb_new,
1906
	.fuse = gf100_fuse_new,
1907
	.gpio = gk104_gpio_new,
1908
	.i2c = gk104_i2c_new,
1909
	.ibus = gk104_ibus_new,
1910
	.imem = nv50_instmem_new,
1911
	.ltc = gk104_ltc_new,
1912
	.mc = gk20a_mc_new,
1913
	.mmu = gf100_mmu_new,
1914
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1915
	.pci = nv40_pci_new,
1916
	.pmu = gk208_pmu_new,
1917
	.therm = gf119_therm_new,
1918
	.timer = nv41_timer_new,
1919
	.volt = nv40_volt_new,
1920 1921 1922
	.ce[0] = gk104_ce_new,
	.ce[1] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1923
	.disp = gk110_disp_new,
1924
	.dma = gf119_dma_new,
1925
	.fifo = gk208_fifo_new,
1926
	.gr = gk208_gr_new,
1927 1928 1929
	.mspdec = gk104_mspdec_new,
	.msppp = gf100_msppp_new,
	.msvld = gk104_msvld_new,
1930
	.sw = gf100_sw_new,
1931 1932 1933 1934 1935
};

static const struct nvkm_device_chip
nv117_chipset = {
	.name = "GM107",
1936
	.bar = gf100_bar_new,
1937
	.bios = nvkm_bios_new,
1938
	.bus = gf100_bus_new,
1939
	.clk = gk104_clk_new,
1940
	.devinit = gm107_devinit_new,
1941
	.fb = gm107_fb_new,
1942
	.fuse = gm107_fuse_new,
1943
	.gpio = gk104_gpio_new,
1944
	.i2c = gf119_i2c_new,
1945
	.ibus = gk104_ibus_new,
1946
	.imem = nv50_instmem_new,
1947
	.ltc = gm107_ltc_new,
1948
	.mc = gk20a_mc_new,
1949
	.mmu = gf100_mmu_new,
1950
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1951
	.pci = nv40_pci_new,
1952
	.pmu = gm107_pmu_new,
1953
	.therm = gm107_therm_new,
1954
	.timer = gk20a_timer_new,
1955 1956
	.ce[0] = gk104_ce_new,
	.ce[2] = gk104_ce_new,
1957
	.disp = gm107_disp_new,
1958
	.dma = gf119_dma_new,
1959
	.fifo = gk208_fifo_new,
1960
	.gr = gm107_gr_new,
1961
	.sw = gf100_sw_new,
1962 1963 1964 1965 1966
};

static const struct nvkm_device_chip
nv124_chipset = {
	.name = "GM204",
1967
	.bar = gf100_bar_new,
1968
	.bios = nvkm_bios_new,
1969
	.bus = gf100_bus_new,
1970
	.devinit = gm204_devinit_new,
1971
	.fb = gm107_fb_new,
1972
	.fuse = gm107_fuse_new,
1973
	.gpio = gk104_gpio_new,
1974
	.i2c = gm204_i2c_new,
1975
	.ibus = gk104_ibus_new,
1976
	.imem = nv50_instmem_new,
1977
	.ltc = gm107_ltc_new,
1978
	.mc = gk20a_mc_new,
1979
	.mmu = gf100_mmu_new,
1980
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
1981
	.pci = nv40_pci_new,
1982
	.pmu = gm107_pmu_new,
1983
	.timer = gk20a_timer_new,
1984 1985 1986
	.ce[0] = gm204_ce_new,
	.ce[1] = gm204_ce_new,
	.ce[2] = gm204_ce_new,
1987
	.disp = gm204_disp_new,
1988
	.dma = gf119_dma_new,
1989
	.fifo = gm204_fifo_new,
1990
	.gr = gm204_gr_new,
1991
	.sw = gf100_sw_new,
1992 1993 1994 1995 1996
};

static const struct nvkm_device_chip
nv126_chipset = {
	.name = "GM206",
1997
	.bar = gf100_bar_new,
1998
	.bios = nvkm_bios_new,
1999
	.bus = gf100_bus_new,
2000
	.devinit = gm204_devinit_new,
2001
	.fb = gm107_fb_new,
2002
	.fuse = gm107_fuse_new,
2003
	.gpio = gk104_gpio_new,
2004
	.i2c = gm204_i2c_new,
2005
	.ibus = gk104_ibus_new,
2006
	.imem = nv50_instmem_new,
2007
	.ltc = gm107_ltc_new,
2008
	.mc = gk20a_mc_new,
2009
	.mmu = gf100_mmu_new,
2010
	.mxm = nv50_mxm_new,
B
Ben Skeggs 已提交
2011
	.pci = nv40_pci_new,
2012
	.pmu = gm107_pmu_new,
2013
	.timer = gk20a_timer_new,
2014 2015 2016
	.ce[0] = gm204_ce_new,
	.ce[1] = gm204_ce_new,
	.ce[2] = gm204_ce_new,
2017
	.disp = gm204_disp_new,
2018
	.dma = gf119_dma_new,
2019
	.fifo = gm204_fifo_new,
2020
	.gr = gm206_gr_new,
2021
	.sw = gf100_sw_new,
2022 2023 2024 2025 2026
};

static const struct nvkm_device_chip
nv12b_chipset = {
	.name = "GM20B",
2027
	.bar = gk20a_bar_new,
2028
	.bus = gf100_bus_new,
2029
	.fb = gk20a_fb_new,
2030
	.fuse = gm107_fuse_new,
2031
	.ibus = gk20a_ibus_new,
2032
	.imem = gk20a_instmem_new,
2033
	.ltc = gm107_ltc_new,
2034
	.mc = gk20a_mc_new,
2035
	.mmu = gf100_mmu_new,
2036
	.timer = gk20a_timer_new,
2037
	.ce[2] = gm204_ce_new,
2038
	.dma = gf119_dma_new,
2039
	.fifo = gm20b_fifo_new,
2040
	.gr = gm20b_gr_new,
2041
	.sw = gf100_sw_new,
2042 2043
};

2044
static int
2045 2046
nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size,
		       struct nvkm_notify *notify)
2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057
{
	if (!WARN_ON(size != 0)) {
		notify->size  = 0;
		notify->types = 1;
		notify->index = 0;
		return 0;
	}
	return -EINVAL;
}

static const struct nvkm_event_func
2058 2059
nvkm_device_event_func = {
	.ctor = nvkm_device_event_ctor,
2060 2061
};

2062 2063 2064 2065 2066 2067 2068 2069 2070
struct nvkm_subdev *
nvkm_device_subdev(struct nvkm_device *device, int index)
{
	struct nvkm_engine *engine;

	if (device->disable_mask & (1ULL << index))
		return NULL;

	switch (index) {
2071
#define _(n,p,m) case NVKM_SUBDEV_##n: if (p) return (m); break
2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
	_(BAR    , device->bar    , &device->bar->subdev);
	_(VBIOS  , device->bios   , &device->bios->subdev);
	_(BUS    , device->bus    , &device->bus->subdev);
	_(CLK    , device->clk    , &device->clk->subdev);
	_(DEVINIT, device->devinit, &device->devinit->subdev);
	_(FB     , device->fb     , &device->fb->subdev);
	_(FUSE   , device->fuse   , &device->fuse->subdev);
	_(GPIO   , device->gpio   , &device->gpio->subdev);
	_(I2C    , device->i2c    , &device->i2c->subdev);
	_(IBUS   , device->ibus   ,  device->ibus);
	_(INSTMEM, device->imem   , &device->imem->subdev);
	_(LTC    , device->ltc    , &device->ltc->subdev);
	_(MC     , device->mc     , &device->mc->subdev);
	_(MMU    , device->mmu    , &device->mmu->subdev);
	_(MXM    , device->mxm    ,  device->mxm);
B
Ben Skeggs 已提交
2087
	_(PCI    , device->pci    , &device->pci->subdev);
2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108
	_(PMU    , device->pmu    , &device->pmu->subdev);
	_(THERM  , device->therm  , &device->therm->subdev);
	_(TIMER  , device->timer  , &device->timer->subdev);
	_(VOLT   , device->volt   , &device->volt->subdev);
#undef _
	default:
		engine = nvkm_device_engine(device, index);
		if (engine)
			return &engine->subdev;
		break;
	}
	return NULL;
}

struct nvkm_engine *
nvkm_device_engine(struct nvkm_device *device, int index)
{
	if (device->disable_mask & (1ULL << index))
		return NULL;

	switch (index) {
2109
#define _(n,p,m) case NVKM_ENGINE_##n: if (p) return (m); break
2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138
	_(BSP    , device->bsp    ,  device->bsp);
	_(CE0    , device->ce[0]  ,  device->ce[0]);
	_(CE1    , device->ce[1]  ,  device->ce[1]);
	_(CE2    , device->ce[2]  ,  device->ce[2]);
	_(CIPHER , device->cipher ,  device->cipher);
	_(DISP   , device->disp   , &device->disp->engine);
	_(DMAOBJ , device->dma    , &device->dma->engine);
	_(FIFO   , device->fifo   , &device->fifo->engine);
	_(GR     , device->gr     , &device->gr->engine);
	_(IFB    , device->ifb    ,  device->ifb);
	_(ME     , device->me     ,  device->me);
	_(MPEG   , device->mpeg   ,  device->mpeg);
	_(MSENC  , device->msenc  ,  device->msenc);
	_(MSPDEC , device->mspdec ,  device->mspdec);
	_(MSPPP  , device->msppp  ,  device->msppp);
	_(MSVLD  , device->msvld  ,  device->msvld);
	_(PM     , device->pm     , &device->pm->engine);
	_(SEC    , device->sec    ,  device->sec);
	_(SW     , device->sw     , &device->sw->engine);
	_(VIC    , device->vic    ,  device->vic);
	_(VP     , device->vp     ,  device->vp);
#undef _
	default:
		WARN_ON(1);
		break;
	}
	return NULL;
}

2139 2140
int
nvkm_device_fini(struct nvkm_device *device, bool suspend)
2141
{
2142 2143
	const char *action = suspend ? "suspend" : "fini";
	struct nvkm_subdev *subdev;
2144
	int ret, i;
2145 2146 2147 2148 2149 2150
	s64 time;

	nvdev_trace(device, "%s running...\n", action);
	time = ktime_to_us(ktime_get());

	nvkm_acpi_fini(device);
2151

2152
	for (i = NVKM_SUBDEV_NR - 1; i >= 0; i--) {
2153 2154 2155 2156
		if ((subdev = nvkm_device_subdev(device, i))) {
			ret = nvkm_subdev_fini(subdev, suspend);
			if (ret && suspend)
				goto fail;
2157 2158 2159
		}
	}

2160 2161 2162

	if (device->func->fini)
		device->func->fini(device, suspend);
2163 2164 2165 2166 2167

	time = ktime_to_us(ktime_get()) - time;
	nvdev_trace(device, "%s completed in %lldus...\n", action, time);
	return 0;

2168
fail:
2169 2170 2171 2172 2173
	do {
		if ((subdev = nvkm_device_subdev(device, i))) {
			int rret = nvkm_subdev_init(subdev);
			if (rret)
				nvkm_fatal(subdev, "failed restart, %d\n", ret);
2174
		}
2175
	} while (++i < NVKM_SUBDEV_NR);
2176

2177
	nvdev_trace(device, "%s failed with %d\n", action, ret);
2178
	return ret;
2179 2180
}

2181
static int
2182 2183
nvkm_device_preinit(struct nvkm_device *device)
{
2184 2185
	struct nvkm_subdev *subdev;
	int ret, i;
2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196
	s64 time;

	nvdev_trace(device, "preinit running...\n");
	time = ktime_to_us(ktime_get());

	if (device->func->preinit) {
		ret = device->func->preinit(device);
		if (ret)
			goto fail;
	}

2197
	for (i = 0; i < NVKM_SUBDEV_NR; i++) {
2198 2199 2200 2201 2202 2203 2204
		if ((subdev = nvkm_device_subdev(device, i))) {
			ret = nvkm_subdev_preinit(subdev);
			if (ret)
				goto fail;
		}
	}

2205 2206 2207
	ret = nvkm_devinit_post(device->devinit, &device->disable_mask);
	if (ret)
		goto fail;
2208

2209 2210 2211 2212 2213 2214 2215 2216 2217
	time = ktime_to_us(ktime_get()) - time;
	nvdev_trace(device, "preinit completed in %lldus\n", time);
	return 0;

fail:
	nvdev_error(device, "preinit failed with %d\n", ret);
	return ret;
}

2218 2219
int
nvkm_device_init(struct nvkm_device *device)
2220
{
2221
	struct nvkm_subdev *subdev;
2222
	int ret, i;
2223
	s64 time;
2224

2225 2226 2227 2228
	ret = nvkm_device_preinit(device);
	if (ret)
		return ret;

2229 2230 2231 2232
	nvkm_device_fini(device, false);

	nvdev_trace(device, "init running...\n");
	time = ktime_to_us(ktime_get());
2233

2234 2235 2236 2237 2238 2239
	if (device->func->init) {
		ret = device->func->init(device);
		if (ret)
			goto fail;
	}

2240 2241 2242 2243
	for (i = 0; i < NVKM_SUBDEV_NR; i++) {
		if ((subdev = nvkm_device_subdev(device, i))) {
			ret = nvkm_subdev_init(subdev);
			if (ret)
2244
				goto fail_subdev;
2245 2246 2247
		}
	}

2248 2249 2250 2251 2252 2253
	nvkm_acpi_init(device);

	time = ktime_to_us(ktime_get()) - time;
	nvdev_trace(device, "init completed in %lldus\n", time);
	return 0;

2254
fail_subdev:
2255 2256 2257 2258
	do {
		if ((subdev = nvkm_device_subdev(device, i)))
			nvkm_subdev_fini(subdev, false);
	} while (--i >= 0);
2259

2260
fail:
2261
	nvdev_error(device, "init failed with %d\n", ret);
2262
	return ret;
2263 2264
}

2265 2266 2267 2268
void
nvkm_device_del(struct nvkm_device **pdevice)
{
	struct nvkm_device *device = *pdevice;
2269
	int i;
2270 2271
	if (device) {
		mutex_lock(&nv_devices_mutex);
2272
		device->disable_mask = 0;
2273
		for (i = NVKM_SUBDEV_NR - 1; i >= 0; i--) {
2274 2275 2276 2277
			struct nvkm_subdev *subdev =
				nvkm_device_subdev(device, i);
			nvkm_subdev_del(&subdev);
		}
2278 2279

		nvkm_event_fini(&device->event);
2280 2281 2282

		if (device->pri)
			iounmap(device->pri);
2283
		list_del(&device->head);
2284 2285 2286

		if (device->func->dtor)
			*pdevice = device->func->dtor(device);
2287
		mutex_unlock(&nv_devices_mutex);
2288

2289
		kfree(*pdevice);
2290 2291 2292 2293
		*pdevice = NULL;
	}
}

2294
int
2295 2296
nvkm_device_ctor(const struct nvkm_device_func *func,
		 const struct nvkm_device_quirk *quirk,
2297
		 struct device *dev, enum nvkm_device_type type, u64 handle,
2298 2299 2300
		 const char *name, const char *cfg, const char *dbg,
		 bool detect, bool mmio, u64 subdev_mask,
		 struct nvkm_device *device)
2301
{
2302
	struct nvkm_subdev *subdev;
2303 2304 2305
	u64 mmio_base, mmio_size;
	u32 boot0, strap;
	void __iomem *map;
2306
	int ret = -EEXIST;
2307
	int i;
2308 2309

	mutex_lock(&nv_devices_mutex);
2310 2311
	if (nvkm_device_find_locked(handle))
		goto done;
2312

2313 2314
	device->func = func;
	device->quirk = quirk;
2315 2316
	device->dev = dev;
	device->type = type;
2317
	device->handle = handle;
2318 2319
	device->cfgopt = cfg;
	device->dbgopt = dbg;
2320
	device->name = name;
B
Ben Skeggs 已提交
2321
	list_add_tail(&device->head, &nv_devices);
2322
	device->debug = nvkm_dbgopt(device->dbgopt, "device");
2323

2324
	ret = nvkm_event_init(&nvkm_device_event_func, 1, 1, &device->event);
2325 2326 2327
	if (ret)
		goto done;

2328 2329
	mmio_base = device->func->resource_addr(device, 0);
	mmio_size = device->func->resource_size(device, 0);
2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391

	/* identify the chipset, and determine classes of subdev/engines */
	if (detect) {
		map = ioremap(mmio_base, 0x102000);
		if (ret = -ENOMEM, map == NULL)
			goto done;

		/* switch mmio to cpu's native endianness */
#ifndef __BIG_ENDIAN
		if (ioread32_native(map + 0x000004) != 0x00000000) {
#else
		if (ioread32_native(map + 0x000004) == 0x00000000) {
#endif
			iowrite32_native(0x01000001, map + 0x000004);
			ioread32_native(map);
		}

		/* read boot0 and strapping information */
		boot0 = ioread32_native(map + 0x000000);
		strap = ioread32_native(map + 0x101000);
		iounmap(map);

		/* determine chipset and derive architecture from it */
		if ((boot0 & 0x1f000000) > 0) {
			device->chipset = (boot0 & 0x1ff00000) >> 20;
			device->chiprev = (boot0 & 0x000000ff);
			switch (device->chipset & 0x1f0) {
			case 0x010: {
				if (0x461 & (1 << (device->chipset & 0xf)))
					device->card_type = NV_10;
				else
					device->card_type = NV_11;
				device->chiprev = 0x00;
				break;
			}
			case 0x020: device->card_type = NV_20; break;
			case 0x030: device->card_type = NV_30; break;
			case 0x040:
			case 0x060: device->card_type = NV_40; break;
			case 0x050:
			case 0x080:
			case 0x090:
			case 0x0a0: device->card_type = NV_50; break;
			case 0x0c0:
			case 0x0d0: device->card_type = NV_C0; break;
			case 0x0e0:
			case 0x0f0:
			case 0x100: device->card_type = NV_E0; break;
			case 0x110:
			case 0x120: device->card_type = GM100; break;
			default:
				break;
			}
		} else
		if ((boot0 & 0xff00fff0) == 0x20004000) {
			if (boot0 & 0x00f00000)
				device->chipset = 0x05;
			else
				device->chipset = 0x04;
			device->card_type = NV_04;
		}

2392
		switch (device->chipset) {
2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462
		case 0x004: device->chip = &nv4_chipset; break;
		case 0x005: device->chip = &nv5_chipset; break;
		case 0x010: device->chip = &nv10_chipset; break;
		case 0x011: device->chip = &nv11_chipset; break;
		case 0x015: device->chip = &nv15_chipset; break;
		case 0x017: device->chip = &nv17_chipset; break;
		case 0x018: device->chip = &nv18_chipset; break;
		case 0x01a: device->chip = &nv1a_chipset; break;
		case 0x01f: device->chip = &nv1f_chipset; break;
		case 0x020: device->chip = &nv20_chipset; break;
		case 0x025: device->chip = &nv25_chipset; break;
		case 0x028: device->chip = &nv28_chipset; break;
		case 0x02a: device->chip = &nv2a_chipset; break;
		case 0x030: device->chip = &nv30_chipset; break;
		case 0x031: device->chip = &nv31_chipset; break;
		case 0x034: device->chip = &nv34_chipset; break;
		case 0x035: device->chip = &nv35_chipset; break;
		case 0x036: device->chip = &nv36_chipset; break;
		case 0x040: device->chip = &nv40_chipset; break;
		case 0x041: device->chip = &nv41_chipset; break;
		case 0x042: device->chip = &nv42_chipset; break;
		case 0x043: device->chip = &nv43_chipset; break;
		case 0x044: device->chip = &nv44_chipset; break;
		case 0x045: device->chip = &nv45_chipset; break;
		case 0x046: device->chip = &nv46_chipset; break;
		case 0x047: device->chip = &nv47_chipset; break;
		case 0x049: device->chip = &nv49_chipset; break;
		case 0x04a: device->chip = &nv4a_chipset; break;
		case 0x04b: device->chip = &nv4b_chipset; break;
		case 0x04c: device->chip = &nv4c_chipset; break;
		case 0x04e: device->chip = &nv4e_chipset; break;
		case 0x050: device->chip = &nv50_chipset; break;
		case 0x063: device->chip = &nv63_chipset; break;
		case 0x067: device->chip = &nv67_chipset; break;
		case 0x068: device->chip = &nv68_chipset; break;
		case 0x084: device->chip = &nv84_chipset; break;
		case 0x086: device->chip = &nv86_chipset; break;
		case 0x092: device->chip = &nv92_chipset; break;
		case 0x094: device->chip = &nv94_chipset; break;
		case 0x096: device->chip = &nv96_chipset; break;
		case 0x098: device->chip = &nv98_chipset; break;
		case 0x0a0: device->chip = &nva0_chipset; break;
		case 0x0a3: device->chip = &nva3_chipset; break;
		case 0x0a5: device->chip = &nva5_chipset; break;
		case 0x0a8: device->chip = &nva8_chipset; break;
		case 0x0aa: device->chip = &nvaa_chipset; break;
		case 0x0ac: device->chip = &nvac_chipset; break;
		case 0x0af: device->chip = &nvaf_chipset; break;
		case 0x0c0: device->chip = &nvc0_chipset; break;
		case 0x0c1: device->chip = &nvc1_chipset; break;
		case 0x0c3: device->chip = &nvc3_chipset; break;
		case 0x0c4: device->chip = &nvc4_chipset; break;
		case 0x0c8: device->chip = &nvc8_chipset; break;
		case 0x0ce: device->chip = &nvce_chipset; break;
		case 0x0cf: device->chip = &nvcf_chipset; break;
		case 0x0d7: device->chip = &nvd7_chipset; break;
		case 0x0d9: device->chip = &nvd9_chipset; break;
		case 0x0e4: device->chip = &nve4_chipset; break;
		case 0x0e6: device->chip = &nve6_chipset; break;
		case 0x0e7: device->chip = &nve7_chipset; break;
		case 0x0ea: device->chip = &nvea_chipset; break;
		case 0x0f0: device->chip = &nvf0_chipset; break;
		case 0x0f1: device->chip = &nvf1_chipset; break;
		case 0x106: device->chip = &nv106_chipset; break;
		case 0x108: device->chip = &nv108_chipset; break;
		case 0x117: device->chip = &nv117_chipset; break;
		case 0x124: device->chip = &nv124_chipset; break;
		case 0x126: device->chip = &nv126_chipset; break;
		case 0x12b: device->chip = &nv12b_chipset; break;
		default:
2463 2464 2465 2466
			nvdev_error(device, "unknown chipset (%08x)\n", boot0);
			goto done;
		}

2467 2468
		nvdev_info(device, "NVIDIA %s (%08x)\n",
			   device->chip->name, boot0);
2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483

		/* determine frequency of timing crystal */
		if ( device->card_type <= NV_10 || device->chipset < 0x17 ||
		    (device->chipset >= 0x20 && device->chipset < 0x25))
			strap &= 0x00000040;
		else
			strap &= 0x00400040;

		switch (strap) {
		case 0x00000000: device->crystal = 13500; break;
		case 0x00000040: device->crystal = 14318; break;
		case 0x00400000: device->crystal = 27000; break;
		case 0x00400040: device->crystal = 25000; break;
		}
	} else {
2484
		device->chip = &null_chipset;
2485 2486
	}

2487 2488 2489
	if (!device->name)
		device->name = device->chip->name;

2490 2491 2492 2493 2494 2495 2496 2497
	if (mmio) {
		device->pri = ioremap(mmio_base, mmio_size);
		if (!device->pri) {
			nvdev_error(device, "unable to map PRI\n");
			return -ENOMEM;
		}
	}

2498
	mutex_init(&device->mutex);
2499

2500
	for (i = 0; i < NVKM_SUBDEV_NR; i++) {
2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516
#define _(s,m) case s:                                                         \
	if (device->chip->m && (subdev_mask & (1ULL << (s)))) {                \
		ret = device->chip->m(device, (s), &device->m);                \
		if (ret) {                                                     \
			subdev = nvkm_device_subdev(device, (s));              \
			nvkm_subdev_del(&subdev);                              \
			device->m = NULL;                                      \
			if (ret != -ENODEV) {                                  \
				nvdev_error(device, "%s ctor failed, %d\n",    \
					    nvkm_subdev_name[s], ret);         \
				goto done;                                     \
			}                                                      \
		}                                                              \
	}                                                                      \
	break
		switch (i) {
2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531
		_(NVKM_SUBDEV_BAR    ,     bar);
		_(NVKM_SUBDEV_VBIOS  ,    bios);
		_(NVKM_SUBDEV_BUS    ,     bus);
		_(NVKM_SUBDEV_CLK    ,     clk);
		_(NVKM_SUBDEV_DEVINIT, devinit);
		_(NVKM_SUBDEV_FB     ,      fb);
		_(NVKM_SUBDEV_FUSE   ,    fuse);
		_(NVKM_SUBDEV_GPIO   ,    gpio);
		_(NVKM_SUBDEV_I2C    ,     i2c);
		_(NVKM_SUBDEV_IBUS   ,    ibus);
		_(NVKM_SUBDEV_INSTMEM,    imem);
		_(NVKM_SUBDEV_LTC    ,     ltc);
		_(NVKM_SUBDEV_MC     ,      mc);
		_(NVKM_SUBDEV_MMU    ,     mmu);
		_(NVKM_SUBDEV_MXM    ,     mxm);
B
Ben Skeggs 已提交
2532
		_(NVKM_SUBDEV_PCI    ,     pci);
2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557
		_(NVKM_SUBDEV_PMU    ,     pmu);
		_(NVKM_SUBDEV_THERM  ,   therm);
		_(NVKM_SUBDEV_TIMER  ,   timer);
		_(NVKM_SUBDEV_VOLT   ,    volt);
		_(NVKM_ENGINE_BSP    ,     bsp);
		_(NVKM_ENGINE_CE0    ,   ce[0]);
		_(NVKM_ENGINE_CE1    ,   ce[1]);
		_(NVKM_ENGINE_CE2    ,   ce[2]);
		_(NVKM_ENGINE_CIPHER ,  cipher);
		_(NVKM_ENGINE_DISP   ,    disp);
		_(NVKM_ENGINE_DMAOBJ ,     dma);
		_(NVKM_ENGINE_FIFO   ,    fifo);
		_(NVKM_ENGINE_GR     ,      gr);
		_(NVKM_ENGINE_IFB    ,     ifb);
		_(NVKM_ENGINE_ME     ,      me);
		_(NVKM_ENGINE_MPEG   ,    mpeg);
		_(NVKM_ENGINE_MSENC  ,   msenc);
		_(NVKM_ENGINE_MSPDEC ,  mspdec);
		_(NVKM_ENGINE_MSPPP  ,   msppp);
		_(NVKM_ENGINE_MSVLD  ,   msvld);
		_(NVKM_ENGINE_PM     ,      pm);
		_(NVKM_ENGINE_SEC    ,     sec);
		_(NVKM_ENGINE_SW     ,      sw);
		_(NVKM_ENGINE_VIC    ,     vic);
		_(NVKM_ENGINE_VP     ,      vp);
2558 2559 2560 2561 2562 2563 2564 2565
		default:
			WARN_ON(1);
			continue;
		}
#undef _
	}

	ret = 0;
2566 2567 2568 2569
done:
	mutex_unlock(&nv_devices_mutex);
	return ret;
}