util/intelmetool: Fix crash on strict devmem kernels

Don't crash if mapping MEI PCI memory fails.
This can happen if CONFIG_STRICT_DEVMEM is enabled.

Change-Id: I33c75a7cccb4cefaa26f70aed4bdc4bd620cdad0
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/25398
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
Patrick Rudolph 2018-02-01 16:12:47 +01:00 committed by Philipp Deppenwiese
parent 44ad86a723
commit aac3b31dbb
2 changed files with 9 additions and 4 deletions

View File

@ -288,17 +288,21 @@ static void dump_me_info(void)
printf("ME: has a broken implementation on your board with" printf("ME: has a broken implementation on your board with"
"this firmware\n"); "this firmware\n");
intel_mei_setup(dev); if (intel_mei_setup(dev))
goto out;
usleep(ME_COMMAND_DELAY); usleep(ME_COMMAND_DELAY);
mei_reset(); mei_reset();
usleep(ME_COMMAND_DELAY); usleep(ME_COMMAND_DELAY);
mkhi_get_fw_version(&ME_major_ver, &ME_minor_ver); if (mkhi_get_fw_version(&ME_major_ver, &ME_minor_ver))
goto out;
usleep(ME_COMMAND_DELAY); usleep(ME_COMMAND_DELAY);
mei_reset(); mei_reset();
usleep(ME_COMMAND_DELAY); usleep(ME_COMMAND_DELAY);
mkhi_get_fwcaps(); if (mkhi_get_fwcaps())
goto out;
usleep(ME_COMMAND_DELAY); usleep(ME_COMMAND_DELAY);
out:
rehide_me(); rehide_me();
} }

View File

@ -582,7 +582,8 @@ uint32_t intel_mei_setup(struct pci_dev *dev)
mei_mmap = map_physical(pagerounded, 0x2000); mei_mmap = map_physical(pagerounded, 0x2000);
mei_mmap += mei_base_address - pagerounded; mei_mmap += mei_base_address - pagerounded;
if (mei_mmap == NULL) { if (mei_mmap == NULL) {
printf("Could not map ME setup memory\n"); printf("Could not map ME setup memory.\n"
"Do you have cmdline argument 'iomem=relaxed' set ?\n");
return 1; return 1;
} }