boot_loader: load amd microcode update data file

switched to non-packaged paths

Change-Id: I331d4d6ed1af1ce6fa68109c9c6baf4a92bdc7b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5858
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Jérôme Duval 2022-11-29 14:21:59 +01:00
parent 4e742d81ab
commit 616edea7fb

View File

@ -316,15 +316,18 @@ slower_sample:
} }
} }
extern int open_maybe_packaged(BootVolume& volume, const char* path,
int openMode);
void void
ucode_load(BootVolume& volume) ucode_load(BootVolume& volume)
{ {
cpuid_info info; cpuid_info info;
if (get_current_cpuid(&info, 0, 0) != B_OK if (get_current_cpuid(&info, 0, 0) != B_OK)
|| strncmp(info.eax_0.vendor_id, "GenuineIntel", 12) != 0) return;
bool isIntel = strncmp(info.eax_0.vendor_id, "GenuineIntel", 12) == 0;
bool isAmd = strncmp(info.eax_0.vendor_id, "AuthenticAMD", 12) == 0;
if (!isIntel && !isAmd)
return; return;
if (get_current_cpuid(&info, 1, 0) != B_OK) if (get_current_cpuid(&info, 1, 0) != B_OK)
@ -337,11 +340,19 @@ ucode_load(BootVolume& volume)
family += info.eax_1.extended_family; family += info.eax_1.extended_family;
model += (info.eax_1.extended_model << 4); model += (info.eax_1.extended_model << 4);
} }
snprintf(path, sizeof(path), "system/data/firmware/intel-ucode/" if (isIntel) {
"%02x-%02x-%02x", family, model, info.eax_1.stepping); snprintf(path, sizeof(path), "system/non-packaged/data/firmware/intel-ucode/"
"%02x-%02x-%02x", family, model, info.eax_1.stepping);
} else if (family < 0x15) {
snprintf(path, sizeof(path), "system/non-packaged/data/firmware/amd-ucode/"
"microcode_amd.bin");
} else {
snprintf(path, sizeof(path), "system/non-packaged/data/firmware/amd-ucode/"
"microcode_amd_fam%02xh.bin", family);
}
dprintf("ucode_load: %s\n", path); dprintf("ucode_load: %s\n", path);
int fd = open_maybe_packaged(volume, path, O_RDONLY); int fd = open_from(volume.RootDirectory(), path, O_RDONLY);
if (fd < B_OK) { if (fd < B_OK) {
dprintf("ucode_load: couldn't find microcode\n"); dprintf("ucode_load: couldn't find microcode\n");
return; return;