diff options
author | 2020-06-07 16:13:30 +0000 | |
---|---|---|
committer | 2020-06-07 16:13:30 +0000 | |
commit | 4b354dcd81f283629fce0d10e80c75cec2c3f8e4 (patch) | |
tree | 27c00f055decbc1cdd1dfba164489f8cd88c39a1 | |
parent | Add missing file. (diff) | |
download | wireguard-openbsd-4b354dcd81f283629fce0d10e80c75cec2c3f8e4.tar.xz wireguard-openbsd-4b354dcd81f283629fce0d10e80c75cec2c3f8e4.zip |
Add functions to read/write from/to PCI config space.
-rw-r--r-- | sys/arch/powerpc64/include/opal.h | 20 | ||||
-rw-r--r-- | sys/arch/powerpc64/powerpc64/locore.S | 8 |
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/arch/powerpc64/include/opal.h b/sys/arch/powerpc64/include/opal.h index 886cce8d8e2..11440489fcc 100644 --- a/sys/arch/powerpc64/include/opal.h +++ b/sys/arch/powerpc64/include/opal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: opal.h,v 1.2 2020/05/27 22:22:04 gkoehler Exp $ */ +/* $OpenBSD: opal.h,v 1.3 2020/06/07 16:13:30 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -19,12 +19,16 @@ #ifndef _MACHINE_OPAL_H_ #define _MACHINE_OPAL_H_ -#define OPAL_TEST 0 -#define OPAL_CONSOLE_WRITE 1 -#define OPAL_CONSOLE_READ 2 -#define OPAL_CEC_POWER_DOWN 5 -#define OPAL_CEC_REBOOT 6 -#define OPAL_POLL_EVENTS 10 +#define OPAL_TEST 0 +#define OPAL_CONSOLE_WRITE 1 +#define OPAL_CONSOLE_READ 2 +#define OPAL_CEC_POWER_DOWN 5 +#define OPAL_CEC_REBOOT 6 +#define OPAL_POLL_EVENTS 10 +#define OPAL_PCI_CONFIG_READ_WORD 15 +#define OPAL_PCI_CONFIG_WRITE_WORD 18 + +#define OPAL_SUCCESS 0 #ifndef _LOCORE int64_t opal_test(uint64_t); @@ -33,6 +37,8 @@ int64_t opal_console_read(int64_t, int64_t *, uint8_t *); int64_t opal_cec_power_down(uint64_t); int64_t opal_cec_reboot(void); int64_t opal_poll_events(uint64_t *); +int64_t opal_pci_config_read_word(uint64_t, uint64_t, uint64_t, uint32_t *); +int64_t opal_pci_config_write_word(uint64_t, uint64_t, uint64_t, uint32_t); void opal_printf(const char *fmt, ...); #endif diff --git a/sys/arch/powerpc64/powerpc64/locore.S b/sys/arch/powerpc64/powerpc64/locore.S index 41a5d760d42..518b849263d 100644 --- a/sys/arch/powerpc64/powerpc64/locore.S +++ b/sys/arch/powerpc64/powerpc64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.5 2020/06/06 22:33:02 kettenis Exp $ */ +/* $OpenBSD: locore.S,v 1.6 2020/06/07 16:13:30 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -83,8 +83,10 @@ OPAL_CALL(OPAL_CONSOLE_WRITE, opal_console_write) OPAL_CALL(OPAL_CONSOLE_READ, opal_console_read) OPAL_CALL(OPAL_CEC_POWER_DOWN, opal_cec_power_down) OPAL_CALL(OPAL_CEC_REBOOT, opal_cec_reboot) -OPAL_CALL(OPAL_POLL_EVENTS, opal_poll_events) - +OPAL_CALL(OPAL_POLL_EVENTS, opal_poll_events) +OPAL_CALL(OPAL_PCI_CONFIG_READ_WORD, opal_pci_config_read_word) +OPAL_CALL(OPAL_PCI_CONFIG_WRITE_WORD, opal_pci_config_write_word) + opal_call: mflr %r11 std %r11, 16(%r1) |