summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-09-29 12:58:23 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-01 08:12:43 +0200
commit2558532a3e993627fb35d087e50e8600053c6244 (patch)
tree5f013fcbe19c74ec1ff44edaa4910ec501a8d126 /arch
parent91be45ce27558bcad11376e8c5904529b085fec5 (diff)
downloadbarebox-2558532a3e993627fb35d087e50e8600053c6244.tar.gz
barebox-2558532a3e993627fb35d087e50e8600053c6244.tar.xz
sandbox: add dummy memory-mapped I/O port region
Super I/O devices on x86 have their base usually located at one of two I/O ports. They are probed by writing a "passcode" to the I/O port and then a value is read back. When COMPILE_TESTing these drivers and running them on sandbox, this fails with a segfault because all I/O port access lead to zero page dereference on that architecture. Even without running barebox, static analyzers correctly flag these accesses as invoking undefined behavior. Adding a dummy I/O region solves both issues. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/board/devices.c3
-rw-r--r--arch/sandbox/include/asm/io.h6
2 files changed, 8 insertions, 1 deletions
diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c
index 72e62552a3..1fd1913ae6 100644
--- a/arch/sandbox/board/devices.c
+++ b/arch/sandbox/board/devices.c
@@ -9,6 +9,9 @@
#include <mach/linux.h>
#include <init.h>
#include <mach/linux.h>
+#include <asm/io.h>
+
+unsigned char __pci_iobase[IO_SPACE_LIMIT];
static LIST_HEAD(sandbox_device_list);
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 6a0e77aead..9f9cd3a42a 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -1,7 +1,11 @@
#ifndef __ASM_SANDBOX_IO_H
#define __ASM_SANDBOX_IO_H
-#define IO_SPACE_LIMIT 0
+#define IO_SPACE_LIMIT 0xffff
+/* pacify static analyzers */
+#define PCI_IOBASE ((void __iomem *)__pci_iobase)
+
+extern unsigned char __pci_iobase[IO_SPACE_LIMIT];
#include <asm-generic/io.h>
#include <asm-generic/bitio.h>