Skip to content

Commit

Permalink
Add detailed message for IO_STRICT_DEVMEM kernel config
Browse files Browse the repository at this point in the history
Also add this to the README.

Signed-off-by: Christian Blichmann <[email protected]>
  • Loading branch information
cblichmann committed Sep 8, 2017
1 parent 6b814a6 commit 695c2e3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ The following command will extract the BIOS firmware and save the image to
`bios_image.bin`:
```bash
sudo .build/pawn bios_image.bin
```
```

You can then use other tools like
Note: When running a Linux kernel > 4.8.4, make sure that either
`CONFIG_IO_DEVMEM=n` is set or that you've booted with the `iomem=relaxed`
boot option.

After extraction, you can then use other tools like
[UEFITool](https://github.com/LongSoft/UEFITool) to process the firmware
image further.
14 changes: 12 additions & 2 deletions pawn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,20 @@ int PawnMain(const char* dump_filename) {
"Mapping 16KiB chipset configuration space at RCBA = 0x%8X, this may "
"fail...\n",
rcba.base_address);
QCHECK_OK(chipset->MapRootComplex(rcba));
status = chipset->MapRootComplex(rcba);
if (!status.ok()) {
printf(
"Error: %s\n"
" Check if your kernel was compiled with IO_STRICT_DEVMEM=y.\n"
" On Debian kernels > 4.8.4, boot with iomem=relaxed to\n"
" temporarily disable /dev/mem IO protection.\n",
status.error_message().c_str());
return EXIT_FAILURE;
}

auto gcs = chipset->ReadGcsRegister();
const char* kBootBiosStrapsDesc[] = {"LPC", "Reserved", "PCI", "SPI"};
constexpr const char* kBootBiosStrapsDesc[] = {"LPC", "Reserved", "PCI",
"SPI"};
printf("Boot BIOS Straps (BBS): %s\n",
kBootBiosStrapsDesc[gcs.boot_bios_straps]);
if (gcs.boot_bios_straps != Chipset::kBbsSpi) {
Expand Down
1 change: 1 addition & 0 deletions physical_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ util::Status PhysicalMemory::Init(uintptr_t physical_offset, size_t length) {
mem_ = mmap(nullptr /* Address hint */, length_, PROT_READ | PROT_WRITE,
MAP_SHARED, mem_fd_, physical_offset);
if (mem_ == MAP_FAILED) {
mem_ = nullptr;
string error(std::strerror(errno));
return util::Status(util::error::FAILED_PRECONDITION,
string("Could not map physical memory: ") + error);
Expand Down

0 comments on commit 695c2e3

Please sign in to comment.