Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15606cb4 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/bios: translate ramcfg strap through M0203



A machine has been spotted where the ramcfg strap is "8", and the ramcfg
xlat table goes 0-7,0-7, resulting in us selecting config 0 for memory
items.  On this particular system, config "8" is available and supposed
to be used.  It appears that starting from GT21x (where Mv2 appears),
we're supposed to use the value in this table instead.

One concern here is that not all the places we currently use ramcfg xlat
are supposed to be treated the same now.  The strap xlat table wasn't
removed from the vbios either, presumably for some kind of good reason.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 1a72f2bd
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <subdev/bios.h>
#include <subdev/bios/bit.h>
#include <subdev/bios/ramcfg.h>
#include <subdev/bios/M0203.h>

static u8
nvbios_ramcfg_strap(struct nouveau_subdev *subdev)
@@ -54,13 +55,23 @@ nvbios_ramcfg_index(struct nouveau_subdev *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)
		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);