summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2021-11-03 07:12:24 +0000
committerFelix Held <felix-coreboot@felixheld.de>2021-11-04 15:07:38 +0000
commit111de557ee5b76a867ab9e5abf02fe409e90db0d (patch)
tree587854ccd3db813d27b350fa622a6a3a815040fc
parent19b16a089eed87412028a8675af7132ef72a2903 (diff)
tests: Move x86 I/O functions to include/mock/arch/io.h
Move th x86 I/O functions declarations from tests mocks to the mock architecture io.h. This will make x86 I/O-dependent tests simpler, because the x86_io.h from mocks will not have to be included manually. Change-Id: Ie7f06c992be306d2523f2079bc90adf114b93946 Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58881 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
-rw-r--r--payloads/libpayload/include/mock/arch/io.h17
-rw-r--r--payloads/libpayload/tests/drivers/Makefile.inc1
-rw-r--r--payloads/libpayload/tests/drivers/speaker-test.c1
-rw-r--r--payloads/libpayload/tests/include/mocks/x86_io.h30
4 files changed, 17 insertions, 32 deletions
diff --git a/payloads/libpayload/include/mock/arch/io.h b/payloads/libpayload/include/mock/arch/io.h
index 2bb625562e..08c992f060 100644
--- a/payloads/libpayload/include/mock/arch/io.h
+++ b/payloads/libpayload/include/mock/arch/io.h
@@ -26,4 +26,21 @@ void write16(volatile void *addr, uint16_t val);
void write32(volatile void *addr, uint32_t val);
void write64(volatile void *addr, uint64_t val);
+/* x86 I/O functions */
+unsigned int inl(int port);
+unsigned short inw(int port);
+unsigned char inb(int port);
+
+void outl(unsigned int val, int port);
+void outw(unsigned short val, int port);
+void outb(unsigned char val, int port);
+
+void outsl(int port, const void *addr, unsigned long count);
+void outsw(int port, const void *addr, unsigned long count);
+void outsb(int port, const void *addr, unsigned long count);
+
+void insl(int port, void *addr, unsigned long count);
+void insw(int port, void *addr, unsigned long count);
+void insb(int port, void *addr, unsigned long count);
+
#endif /* _ARCH_IO_H */
diff --git a/payloads/libpayload/tests/drivers/Makefile.inc b/payloads/libpayload/tests/drivers/Makefile.inc
index e39921a33f..7705473ef7 100644
--- a/payloads/libpayload/tests/drivers/Makefile.inc
+++ b/payloads/libpayload/tests/drivers/Makefile.inc
@@ -6,4 +6,3 @@ speaker-test-srcs += tests/drivers/speaker-test.c
speaker-test-mocks += inb
speaker-test-mocks += outb
speaker-test-mocks += arch_ndelay
-speaker-test-cflags += -include $(testsrc)/include/mocks/x86_io.h
diff --git a/payloads/libpayload/tests/drivers/speaker-test.c b/payloads/libpayload/tests/drivers/speaker-test.c
index 199fa58864..a677fa46ca 100644
--- a/payloads/libpayload/tests/drivers/speaker-test.c
+++ b/payloads/libpayload/tests/drivers/speaker-test.c
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <libpayload.h>
-#include <mocks/x86_io.h>
/* Include source to gain access to private defines */
#include "../drivers/speaker.c"
diff --git a/payloads/libpayload/tests/include/mocks/x86_io.h b/payloads/libpayload/tests/include/mocks/x86_io.h
deleted file mode 100644
index c35a57263c..0000000000
--- a/payloads/libpayload/tests/include/mocks/x86_io.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef TESTS_MOCKS_X86_IO_H_
-#define TESTS_MOCKS_X86_IO_H_
-
-unsigned int inl(int port);
-
-unsigned short inw(int port);
-
-unsigned char inb(int port);
-
-void outl(unsigned int val, int port);
-
-void outw(unsigned short val, int port);
-
-void outb(unsigned char val, int port);
-
-void outsl(int port, const void *addr, unsigned long count);
-
-void outsw(int port, const void *addr, unsigned long count);
-
-void outsb(int port, const void *addr, unsigned long count);
-
-void insl(int port, void *addr, unsigned long count);
-
-void insw(int port, void *addr, unsigned long count);
-
-void insb(int port, void *addr, unsigned long count);
-
-#endif