예제 #1
0
파일: ramcfg.c 프로젝트: 383530895/linux
u8
nvbios_ramcfg_index(struct nouveau_subdev *subdev)
{
	struct nouveau_bios *bios = nouveau_bios(subdev);
	u8 strap = nvbios_ramcfg_strap(subdev);
	u32 xlat = 0x00000000;
	struct bit_entry bit_M;
	struct nvbios_M0203E M0203E;
	u8 ver, hdr;

	if (!bit_entry(bios, 'M', &bit_M)) {
		if (bit_M.version == 1 && bit_M.length >= 5)
			xlat = nv_ro16(bios, bit_M.offset + 3);
		if (bit_M.version == 2 && bit_M.length >= 3) {
			/*XXX: is M ever shorter than this?
			 *     if not - what is xlat used for now?
			 *     also - sigh..
			 */
			if (bit_M.length >= 7 &&
			    nvbios_M0203Em(bios, strap, &ver, &hdr, &M0203E))
				return M0203E.group;
			xlat = nv_ro16(bios, bit_M.offset + 1);
		}
	}

	if (xlat)
		strap = nv_ro08(bios, xlat + strap);
	return strap;
}
예제 #2
0
파일: base.c 프로젝트: 383530895/linux
int
nouveau_fb_bios_memtype(struct nouveau_bios *bios)
{
	const u8 ramcfg = (nv_rd32(bios, 0x101000) & 0x0000003c) >> 2;
	struct nvbios_M0203E M0203E;
	u8 ver, hdr;

	if (nvbios_M0203Em(bios, ramcfg, &ver, &hdr, &M0203E)) {
		switch (M0203E.type) {
		case M0203E_TYPE_DDR2 : return NV_MEM_TYPE_DDR2;
		case M0203E_TYPE_DDR3 : return NV_MEM_TYPE_DDR3;
		case M0203E_TYPE_GDDR3: return NV_MEM_TYPE_GDDR3;
		case M0203E_TYPE_GDDR5: return NV_MEM_TYPE_GDDR5;
		default:
			nv_warn(bios, "M0203E type %02x\n", M0203E.type);
			return NV_MEM_TYPE_UNKNOWN;
		}
	}

	nv_warn(bios, "M0203E not matched!\n");
	return NV_MEM_TYPE_UNKNOWN;
}
예제 #3
0
파일: base.c 프로젝트: 020gzh/linux
int
nvkm_fb_bios_memtype(struct nvkm_bios *bios)
{
	struct nvkm_subdev *subdev = &bios->subdev;
	struct nvkm_device *device = subdev->device;
	const u8 ramcfg = (nvkm_rd32(device, 0x101000) & 0x0000003c) >> 2;
	struct nvbios_M0203E M0203E;
	u8 ver, hdr;

	if (nvbios_M0203Em(bios, ramcfg, &ver, &hdr, &M0203E)) {
		switch (M0203E.type) {
		case M0203E_TYPE_DDR2 : return NVKM_RAM_TYPE_DDR2;
		case M0203E_TYPE_DDR3 : return NVKM_RAM_TYPE_DDR3;
		case M0203E_TYPE_GDDR3: return NVKM_RAM_TYPE_GDDR3;
		case M0203E_TYPE_GDDR5: return NVKM_RAM_TYPE_GDDR5;
		default:
			nvkm_warn(subdev, "M0203E type %02x\n", M0203E.type);
			return NVKM_RAM_TYPE_UNKNOWN;
		}
	}

	nvkm_warn(subdev, "M0203E not matched!\n");
	return NVKM_RAM_TYPE_UNKNOWN;
}