static int nouveau_bios_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nouveau_bios *bios; struct bit_entry bit_i; int ret; ret = nouveau_subdev_create(parent, engine, oclass, 0, "VBIOS", "bios", &bios); *pobject = nv_object(bios); if (ret) return ret; ret = nouveau_bios_shadow(bios); if (ret) return ret; /* detect type of vbios we're dealing with */ bios->bmp_offset = nvbios_findstr(bios->data, bios->size, "\xff\x7f""NV\0", 5); if (bios->bmp_offset) { nv_info(bios, "BMP version %x.%x\n", bmp_version(bios) >> 8, bmp_version(bios) & 0xff); }
int nvkm_bios_new(struct nvkm_device *device, int index, struct nvkm_bios **pbios) { struct nvkm_bios *bios; struct bit_entry bit_i; int ret; if (!(bios = *pbios = kzalloc(sizeof(*bios), GFP_KERNEL))) return -ENOMEM; nvkm_subdev_ctor(&nvkm_bios, device, index, &bios->subdev); ret = nvbios_shadow(bios); if (ret) return ret; /* detect type of vbios we're dealing with */ bios->bmp_offset = nvbios_findstr(bios->data, bios->size, "\xff\x7f""NV\0", 5); if (bios->bmp_offset) { nvkm_debug(&bios->subdev, "BMP version %x.%x\n", bmp_version(bios) >> 8, bmp_version(bios) & 0xff); }
return ret; ret = nouveau_bios_shadow(bios); if (ret) return ret; /* detect type of vbios we're dealing with */ bios->bmp_offset = nvbios_findstr(bios->data, bios->size, "\xff\x7f""NV\0", 5); if (bios->bmp_offset) { nv_info(bios, "BMP version %x.%x\n", bmp_version(bios) >> 8, bmp_version(bios) & 0xff); } bios->bit_offset = nvbios_findstr(bios->data, bios->size, "\xff\xb8""BIT", 5); if (bios->bit_offset) nv_info(bios, "BIT signature found\n"); /* determine the vbios version number */ if (!bit_entry(bios, 'i', &bit_i) && bit_i.length >= 4) { bios->version.major = nv_ro08(bios, bit_i.offset + 3); bios->version.chip = nv_ro08(bios, bit_i.offset + 2); bios->version.minor = nv_ro08(bios, bit_i.offset + 1); bios->version.micro = nv_ro08(bios, bit_i.offset + 0); bios->version.patch = nv_ro08(bios, bit_i.offset + 4); } else if (bmp_version(bios)) { bios->version.major = nv_ro08(bios, bios->bmp_offset + 13); bios->version.chip = nv_ro08(bios, bios->bmp_offset + 12); bios->version.minor = nv_ro08(bios, bios->bmp_offset + 11);