Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Thomas Heijligen: Looks good to me, approved Angel Pons: Looks good to me, but someone else must approve
hwaccess: fix build on non-x86 targets

The changes to hwaccess in commit 49d758698a0dd166679c48b1a2785e50e9b0cc83
cause build failure on non-x86 systems because the hwaccess_x86_*
headers are included in some files that are built for all platforms
(particularly those in the internal programmer) and those headers in
turn include <sys/io.h> which only exists on x86.

This change avoids including those headers on non-x86 platforms so
the internal programmer can be built without errors.

The comment on the stub implementation of rget_io_perms() is also
modified to remove references to non-x86 platforms, since that file is
only built on x86 now.

BUG=None
TEST=meson build succeeds for both x86 and ARM targets

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I20f122679c30340b2c73afd7419e79644ddc3c4e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/61194
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M board_enable.c
M chipset_enable.c
M hwaccess_x86_io.c
M internal.c
4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/board_enable.c b/board_enable.c
index c23e257..94cfc9d 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -25,11 +25,13 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
-#include "hwaccess_x86_io.h"
-#include "hwaccess_x86_msr.h"
#include "platform/pci.h"

#if defined(__i386__) || defined(__x86_64__)
+
+#include "hwaccess_x86_io.h"
+#include "hwaccess_x86_msr.h"
+
/*
* Helper functions for many Winbond Super I/Os of the W836xx range.
*/
diff --git a/chipset_enable.c b/chipset_enable.c
index d72300e..fe7ec15 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -33,8 +33,6 @@
#include <errno.h>
#include "flash.h"
#include "programmer.h"
-#include "hwaccess_x86_io.h"
-#include "hwaccess_x86_msr.h"
#include "hwaccess_physmap.h"
#include "platform/pci.h"

@@ -42,6 +40,9 @@

#if defined(__i386__) || defined(__x86_64__)

+#include "hwaccess_x86_io.h"
+#include "hwaccess_x86_msr.h"
+
static int enable_flash_ali_m1533(struct pci_dev *dev, const char *name)
{
uint8_t tmp;
diff --git a/hwaccess_x86_io.c b/hwaccess_x86_io.c
index 3152bfe..fc6ee54 100644
--- a/hwaccess_x86_io.c
+++ b/hwaccess_x86_io.c
@@ -79,7 +79,6 @@
#else

/* DJGPP and libpayload environments have full PCI port I/O permissions by default. */
-/* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */
int rget_io_perms(void)
{
return 0;
diff --git a/internal.c b/internal.c
index bb606ca..b8e0564 100644
--- a/internal.c
+++ b/internal.c
@@ -19,10 +19,13 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
-#include "hwaccess_x86_io.h"
#include "hwaccess_physmap.h"
#include "platform/pci.h"

+#if defined(__i386__) || defined(__x86_64__)
+#include "hwaccess_x86_io.h"
+#endif
+
int is_laptop = 0;
int laptop_ok = 0;

@@ -241,11 +244,6 @@
}
free(arg);

- if (rget_io_perms()) {
- ret = 1;
- goto internal_init_exit;
- }
-
/* Default to Parallel/LPC/FWH flash devices. If a known host controller
* is found, the host controller init routine sets the
* internal_buses_supported bitfield.
@@ -271,6 +269,11 @@
}

#if defined(__i386__) || defined(__x86_64__)
+ if (rget_io_perms()) {
+ ret = 1;
+ goto internal_init_exit;
+ }
+
if ((cb_parse_table(&cb_vendor, &cb_model) == 0) && (board_vendor != NULL) && (board_model != NULL)) {
if (strcasecmp(board_vendor, cb_vendor) || strcasecmp(board_model, cb_model)) {
msg_pwarn("Warning: The mainboard IDs set by -p internal:mainboard (%s:%s) do not\n"

To view, visit change 61194. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I20f122679c30340b2c73afd7419e79644ddc3c4e
Gerrit-Change-Number: 61194
Gerrit-PatchSet: 9
Gerrit-Owner: Peter Marheine <pmarheine@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged