
On 1/28/19 4:42 PM, Alexander Graf wrote:
Our selftest will soon test the actual runtime reset function rather than the boot time one. For this, we need to ensure that the runtime version actually succeeds on x86 to keep our travis tests work.
So this patch implements an x86 runtime reset function. It is missing shutdown functionality today, but OSs usually implement that via ACPI and this function does more than the stub from before, so it's at least an improvement.
Signed-off-by: Alexander Graf agraf@suse.de
drivers/sysreset/sysreset_x86.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c index 20b958cfd4..efed45ccb7 100644 --- a/drivers/sysreset/sysreset_x86.c +++ b/drivers/sysreset/sysreset_x86.c @@ -10,6 +10,29 @@ #include <sysreset.h> #include <asm/io.h> #include <asm/processor.h> +#include <efi_loader.h>
+#ifdef CONFIG_EFI_LOADER +void __efi_runtime EFIAPI efi_reset_system(
enum efi_reset_type reset_type,
efi_status_t reset_status,
unsigned long data_size, void *reset_data)
+{
- u32 value = 0;
- if (reset_type == EFI_RESET_COLD)
value = SYS_RST | RST_CPU | FULL_RST;
- else if (reset_type == EFI_RESET_WARM)
value = SYS_RST | RST_CPU;
It would preferable to do a reset for EFI_RESET_PLATFORM_SPECIFIC instead of falling in to a loop.
For EFI_RESET_SHUTDOWN this patch only puts a single CPU core into an endless loop but does not do anything for the remaining cores. Resetting the whole CPU would be an alternative.
- /* TODO EFI_RESET_PLATFORM_SPECIFIC and EFI_RESET_SHUTDOWN */
- if (value)
outb(value, IO_PORT_RESET);
Best regards
Heinrich
- while (1) { }
+} +#endif
static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type) {