44 if (device->
handle == name) {
62 static const u64 disable_map[] = {
111 device = nv_device(client->
device);
122 *pobject = nv_object(devobj);
132 if (args->
disable & disable_map[i])
133 disable |= (1ULL <<
i);
139 map =
ioremap(mmio_base, 0x102000);
157 if ((boot0 & 0x0f000000) > 0) {
158 device->
chipset = (boot0 & 0xff00000) >> 20;
159 switch (device->
chipset & 0xf0) {
160 case 0x10: device->
card_type = NV_10;
break;
161 case 0x20: device->
card_type = NV_20;
break;
162 case 0x30: device->
card_type = NV_30;
break;
164 case 0x60: device->
card_type = NV_40;
break;
168 case 0xa0: device->
card_type = NV_50;
break;
169 case 0xc0: device->
card_type = NV_C0;
break;
170 case 0xd0: device->
card_type = NV_D0;
break;
171 case 0xe0: device->
card_type = NV_E0;
break;
176 if ((boot0 & 0xff00fff0) == 0x20004000) {
177 if (boot0 & 0x00f00000)
200 nv_error(device,
"unknown chipset, 0x%08x\n", boot0);
204 nv_info(device,
"BOOT0 : 0x%08x\n", boot0);
205 nv_info(device,
"Chipset: %s (NV%02X)\n",
217 case 0x00000000: device->
crystal = 13500;
break;
218 case 0x00000040: device->
crystal = 14318;
break;
219 case 0x00400000: device->
crystal = 27000;
break;
220 case 0x00400040: device->
crystal = 25000;
break;
227 !nv_subdev(device)->mmio) {
228 nv_subdev(device)->mmio =
ioremap(mmio_base, mmio_size);
229 if (!nv_subdev(device)->mmio) {
230 nv_error(device,
"unable to map device registers\n");
237 if (!(oclass = device->
oclass[i]) || (disable & (1ULL << i)))
284 for (i = NVDEV_SUBDEV_NR - 1; i >= 0; i--)
302 if ((subdev = devobj->
subdev[i])) {
315 for (--i; i >= 0; i--) {
316 if ((subdev = devobj->
subdev[i])) {
332 for (i = NVDEV_SUBDEV_NR - 1; i >= 0; i--) {
333 if ((subdev = devobj->
subdev[i])) {
345 if ((subdev = devobj->
subdev[i])) {
361 return nv_rd08(object->
engine, addr);
367 return nv_rd16(object->
engine, addr);
373 return nv_rd32(object->
engine, addr);
379 nv_wr08(object->
engine, addr, data);
385 nv_wr16(object->
engine, addr, data);
391 nv_wr32(object->
engine, addr, data);
395 nouveau_devobj_ofuncs = {
396 .ctor = nouveau_devobj_ctor,
397 .dtor = nouveau_devobj_dtor,
398 .init = nouveau_devobj_init,
399 .fini = nouveau_devobj_fini,
400 .rd08 = nouveau_devobj_rd08,
401 .rd16 = nouveau_devobj_rd16,
402 .rd32 = nouveau_devobj_rd32,
403 .wr08 = nouveau_devobj_wr08,
404 .wr16 = nouveau_devobj_wr16,
405 .wr32 = nouveau_devobj_wr32,
413 { 0x0080, &nouveau_devobj_ofuncs },
426 if (device->
base.mmio)
433 nouveau_device_oclass = {
436 .dtor = nouveau_device_dtor,
442 const char *
cfg,
const char *
dbg,
443 int length,
void **pobject)
450 if (device->
handle == name)
455 "DEVICE",
"device", length, pobject);
465 device->
name = sname;
468 list_add(&device->
head, &nv_devices);