diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 23 | ||||
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/console.c | 3 | ||||
-rw-r--r-- | common/efi-devicepath.c | 30 | ||||
-rw-r--r-- | common/efi-guid.c | 2 | ||||
-rw-r--r-- | common/startup.c | 18 | ||||
-rw-r--r-- | common/state.c | 6 | ||||
-rw-r--r-- | common/tlsf.c | 1 |
8 files changed, 62 insertions, 23 deletions
diff --git a/common/Kconfig b/common/Kconfig index 9c3628ed34..8c6ba7fd42 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -594,6 +594,17 @@ config CONSOLE_ACTIVATE_NONE endchoice +config PBL_CONSOLE + depends on PBL_IMAGE + depends on !CONSOLE_NONE + bool "Enable console support in PBL" + help + This enables printf/pr_* support in the PBL to get more + informational output earlier during startup. Note that + printf/pr_* need a valid C environment, so the binary + must be running at the address it's linked at and bss must + be cleared. On ARM that would be after setup_c(). + config PARTITION bool prompt "Enable Partitions" @@ -935,18 +946,6 @@ config DEBUG_INITCALLS help If enabled this will print initcall traces. -config PBL_CONSOLE - depends on PBL_IMAGE - depends on DEBUG_LL - depends on !CONSOLE_NONE - bool "Enable console support in PBL" - help - This enables printf/pr_* support in the PBL to get more - informational output earlier during startup. Note that - printf/pr_* need a valid C environment, so the binary - must be running at the address it's linked at and bss must - be cleared. On ARM that would be after setup_c(). - endmenu config HAS_DEBUG_LL diff --git a/common/Makefile b/common/Makefile index 74801f7e28..ed131c8c56 100644 --- a/common/Makefile +++ b/common/Makefile @@ -5,7 +5,7 @@ obj-y += clock.o obj-y += console_common.o obj-y += startup.o obj-y += misc.o -obj-y += memsize.o +obj-pbl-y += memsize.o obj-y += resource.o obj-y += bootsource.o obj-$(CONFIG_AUTO_COMPLETE) += complete.o diff --git a/common/console.c b/common/console.c index 0a6fc3e9bf..bf64c08b7c 100644 --- a/common/console.c +++ b/common/console.c @@ -73,6 +73,9 @@ int console_set_active(struct console_device *cdev, unsigned flag) cdev->setbrg(cdev, cdev->baudrate); } + if (!flag && cdev->f_active && cdev->flush) + cdev->flush(cdev); + if (cdev->set_active) { ret = cdev->set_active(cdev, flag); if (ret) diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c index a53c6d2e8b..54c2f4e3c5 100644 --- a/common/efi-devicepath.c +++ b/common/efi-devicepath.c @@ -1383,3 +1383,33 @@ u8 device_path_to_type(struct efi_device_path *dev_path) return device_path_type(dev_path); } + +char *device_path_to_partuuid(struct efi_device_path *dev_path) +{ + struct efi_device_path *dev_path_node; + struct harddrive_device_path *hd; + char *str = NULL;; + + dev_path = unpack_device_path(dev_path); + + for (dev_path_node = dev_path; !is_device_path_end(dev_path_node); + dev_path_node = next_device_path_node(dev_path_node)) { + + if (device_path_type(dev_path_node) != MEDIA_DEVICE_PATH) + continue; + + if (dev_path_node->sub_type != MEDIA_HARDDRIVE_DP) + continue; + + hd = (struct harddrive_device_path *)dev_path_node; + + if (hd->signature_type != SIGNATURE_TYPE_GUID) + continue; + + str = xasprintf("%pUl", (efi_guid_t *)&(hd->signature[0])); + break; + } + + return str; +} + diff --git a/common/efi-guid.c b/common/efi-guid.c index f6b0404105..64f3b1f65f 100644 --- a/common/efi-guid.c +++ b/common/efi-guid.c @@ -9,6 +9,8 @@ efi_guid_t efi_unknown_device_guid = EFI_UNKNOWN_DEVICE_GUID; efi_guid_t efi_null_guid = EFI_NULL_GUID; efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID; efi_guid_t efi_block_io_protocol_guid = EFI_BLOCK_IO_PROTOCOL_GUID; +efi_guid_t efi_barebox_vendor_guid = EFI_BAREBOX_VENDOR_GUID; +efi_guid_t efi_systemd_vendor_guid = EFI_SYSTEMD_VENDOR_GUID; #define EFI_GUID_STRING(guid, short, long) do { \ if (!efi_guidcmp(guid, *g)) \ diff --git a/common/startup.c b/common/startup.c index 6178fc5353..802b90e0e8 100644 --- a/common/startup.c +++ b/common/startup.c @@ -45,6 +45,9 @@ extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[], __barebox_initcalls_end[]; +extern exitcall_t __barebox_exitcalls_start[], __barebox_exitcalls_end[]; + + #if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS static int mount_root(void) { @@ -132,18 +135,17 @@ void __noreturn hang (void) for (;;); } -void (*board_shutdown)(void); - /* Everything needed to cleanly shutdown barebox. * Should be called before starting an OS to get * the devices into a clean state */ void shutdown_barebox(void) { - devices_shutdown(); -#ifdef ARCH_SHUTDOWN - arch_shutdown(); -#endif - if (board_shutdown) - board_shutdown(); + exitcall_t *exitcall; + + for (exitcall = __barebox_exitcalls_start; + exitcall < __barebox_exitcalls_end; exitcall++) { + pr_debug("exitcall-> %pS\n", *exitcall); + (*exitcall)(); + } } diff --git a/common/state.c b/common/state.c index 1243320226..aa436fcd9a 100644 --- a/common/state.c +++ b/common/state.c @@ -1279,7 +1279,7 @@ static int backend_raw_load_one(struct state_backend_raw *backend_raw, max_len -= sizeof(header); if (ret < 0) { dev_err(&state->dev, - "cannot read header from backend device"); + "cannot read header from backend device\n"); return ret; } @@ -1377,6 +1377,8 @@ static int backend_raw_save_one(struct state_backend_raw *backend_raw, if (ret < 0) return ret; + protect(fd, backend_raw->stride, offset, false); + if (backend_raw->need_erase) { ret = erase(fd, backend_raw->stride, offset); if (ret) @@ -1387,6 +1389,8 @@ static int backend_raw_save_one(struct state_backend_raw *backend_raw, if (ret < 0) return ret; + protect(fd, backend_raw->stride, offset, true); + return 0; } diff --git a/common/tlsf.c b/common/tlsf.c index 9515ac764c..984342e095 100644 --- a/common/tlsf.c +++ b/common/tlsf.c @@ -1,4 +1,3 @@ -#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> |