From patchwork Wed Jun 28 11:16:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9813973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E7E30603D7 for ; Wed, 28 Jun 2017 11:19:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAE7F28469 for ; Wed, 28 Jun 2017 11:19:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF8DE284FC; Wed, 28 Jun 2017 11:19:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D950228469 for ; Wed, 28 Jun 2017 11:19:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQAxm-0001Do-2Q; Wed, 28 Jun 2017 11:16:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQAxk-0001CF-FW for xen-devel@lists.xen.org; Wed, 28 Jun 2017 11:16:48 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 96/67-02181-F1093595; Wed, 28 Jun 2017 11:16:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42JxWrrBXld+QnC kwdZnHBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0b79RMsBQejK248v8PewHjVtYuRk0NCwF/i UPcPFhCbTUBfYveLT0wgtoiAusTpjousXYwcHMwCfhKHHviChIUFjCQuLpnMCmKzCKhK9C1/w AZi8wp4Spz785MVYqScxPnjP5lBbE4BL4mdp9+AjRcCqrnX3cwEYatJXOu/xA7RKyhxcuYTsB pmAQmJgy9eME9g5J2FJDULSWoBI9MqRo3i1KKy1CJdQ1O9pKLM9IyS3MTMHF1DA2O93NTi4sT 01JzEpGK95PzcTYzA0GEAgh2Ma7Z7HmKU5GBSEuXd+yUoUogvKT+lMiOxOCO+qDQntfgQowwH h5IEr1x/cKSQYFFqempFWmYOMIhh0hIcPEoivN11QGne4oLE3OLMdIjUKUZFKXHeU31ACQGQR EZpHlwbLHIuMcpKCfMyAh0ixFOQWpSbWYIq/4pRnINRSZiXDWQ7T2ZeCdz0V0CLmYAWs8wLAF lckoiQkmpgZEubMYOJpe979KpZrtqifFK6FfUebjPVhfedbpS/+0tmg1i0s9D/h5n8yc9+LX3 M8OLgZDdDLyFNkW5P1lD5osvFfMwJ6mKhR8R+Xsw6vOX0KVfHb8f/7zAq3td03NKPb2684VH2 ItsbzcZzuhbdvHzIuT955e6ZWW691Zc23QsNjn/9ripQiaU4I9FQi7moOBEATAU8bpcCAAA= X-Env-Sender: prvs=345d76a6c=Andrew.Cooper3@citrix.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1498648604!96071680!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49972 invoked from network); 28 Jun 2017 11:16:46 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 28 Jun 2017 11:16:46 -0000 X-IronPort-AV: E=Sophos;i="5.40,275,1496102400"; d="scan'208";a="438109861" From: Andrew Cooper To: Xen-devel Date: Wed, 28 Jun 2017 12:16:21 +0100 Message-ID: <1498648582-15521-3-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1498648582-15521-1-git-send-email-andrew.cooper3@citrix.com> References: <1498648582-15521-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH 3/4] xen/efi: Switch to using bool X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich --- xen/arch/arm/efi/efi-boot.h | 7 +++--- xen/arch/x86/efi/efi-boot.h | 4 ++-- xen/arch/x86/efi/stub.c | 6 ++--- xen/common/efi/boot.c | 58 ++++++++++++++++++++++----------------------- xen/common/efi/runtime.c | 4 ++-- xen/include/xen/efi.h | 4 ++-- 6 files changed, 42 insertions(+), 41 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 2986c83..56de26e 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -559,7 +559,7 @@ static void __init efi_arch_load_addr_check(EFI_LOADED_IMAGE *loaded_image) blexit(L"Xen must be loaded at a 4 KByte boundary."); } -static bool_t __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) +static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) { /* * For arm, we may get a device tree from GRUB (or other bootloader) @@ -578,12 +578,13 @@ static bool_t __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) * We either have no FDT, or one without modules, so we must have a * Xen EFI configuration file to specify modules. (dom0 required) */ - return 1; + return true; } PrintStr(L"Using modules provided by bootloader in FDT\r\n"); /* We have modules already defined in fdt, just add space. */ fdt = fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); - return 0; + + return false; } static void __init efi_arch_console_init(UINTN cols, UINTN rows) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 34537d4..bedac5c 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -662,9 +662,9 @@ static void __init efi_arch_load_addr_check(EFI_LOADED_IMAGE *loaded_image) trampoline_xen_phys_start = xen_phys_start; } -static bool_t __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) +static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) { - return 1; /* x86 always uses a config file */ + return true; /* x86 always uses a config file */ } static void efi_arch_flush_dcache_area(const void *vaddr, UINTN size) { } diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub.c index 17da050..0c481e3 100644 --- a/xen/arch/x86/efi/stub.c +++ b/xen/arch/x86/efi/stub.c @@ -52,9 +52,9 @@ void __init efi_init_memory(void) { } void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { } -bool_t efi_rs_using_pgtables(void) +bool efi_rs_using_pgtables(void) { - return 0; + return false; } unsigned long efi_get_time(void) @@ -64,7 +64,7 @@ unsigned long efi_get_time(void) } void efi_halt_system(void) { } -void efi_reset_system(bool_t warm) { } +void efi_reset_system(bool warm) { } int efi_get_info(uint32_t idx, union xenpf_efi_info *info) { diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index daf0c80..11bdc7a 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -113,11 +113,11 @@ static char *get_value(const struct file *cfg, const char *section, static char *split_string(char *s); static CHAR16 *s2w(union string *str); static char *w2s(const union string *str); -static bool_t read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, - struct file *file, char *options); +static bool read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, + struct file *file, char *options); static size_t wstrlen(const CHAR16 * s); static int set_color(u32 mask, int bpp, u8 *pos, u8 *sz); -static bool_t match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2); +static bool match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2); static void efi_init(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); static void efi_console_set_mode(void); @@ -138,7 +138,7 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdOut; static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr; static UINT32 __initdata mdesc_ver; -static bool_t __initdata map_bs; +static bool __initdata map_bs; static struct file __initdata cfg; static struct file __initdata kernel; @@ -307,7 +307,7 @@ static char *__init w2s(const union string *str) return str->s; } -static bool_t __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2) +static bool __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2) { return guid1->Data1 == guid2->Data1 && guid1->Data2 == guid2->Data2 && @@ -378,12 +378,12 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv, CHAR16 **options) { CHAR16 *ptr = (CHAR16 *)(argv + argc + 1), *prev = NULL; - bool_t prev_sep = TRUE; + bool prev_sep = true; for ( ; cmdsize > sizeof(*cmdline) && *cmdline; cmdsize -= sizeof(*cmdline), ++cmdline ) { - bool_t cur_sep = *cmdline == L' ' || *cmdline == L'\t'; + bool cur_sep = *cmdline == L' ' || *cmdline == L'\t'; if ( !prev_sep ) { @@ -538,8 +538,8 @@ static char * __init split_string(char *s) return NULL; } -static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, - struct file *file, char *options) +static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, + struct file *file, char *options) { EFI_FILE_HANDLE FileHandle = NULL; UINT64 size; @@ -551,7 +551,7 @@ static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, ret = dir_handle->Open(dir_handle, &FileHandle, name, EFI_FILE_MODE_READ, 0); if ( file == &cfg && ret == EFI_NOT_FOUND ) - return 0; + return false; if ( EFI_ERROR(ret) ) what = L"Open"; else @@ -611,27 +611,27 @@ static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, efi_arch_flush_dcache_area(file->ptr, file->size); - return 1; + return true; } static void __init pre_parse(const struct file *cfg) { char *ptr = cfg->ptr, *end = ptr + cfg->size; - bool_t start = 1, comment = 0; + bool start = true, comment = false; for ( ; ptr < end; ++ptr ) { if ( iscntrl(*ptr) ) { - comment = 0; - start = 1; + comment = false; + start = true; *ptr = 0; } else if ( comment || (start && isspace(*ptr)) ) *ptr = 0; else if ( *ptr == '#' || (start && *ptr == ';') ) { - comment = 1; + comment = true; *ptr = 0; } else @@ -647,7 +647,7 @@ static char *__init get_value(const struct file *cfg, const char *section, { char *ptr = cfg->ptr, *end = ptr + cfg->size; size_t slen = section ? strlen(section) : 0, ilen = strlen(item); - bool_t match = !slen; + bool match = !slen; for ( ; ptr < end; ++ptr ) { @@ -1000,7 +1000,7 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste { EFI_STATUS status; UINTN info_size = 0, map_key; - bool_t retry; + bool retry; efi_bs->GetMemoryMap(&info_size, NULL, &map_key, &efi_mdesc_size, &mdesc_ver); @@ -1009,7 +1009,7 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste if ( !efi_memmap ) blexit(L"Unable to allocate memory for EFI memory map"); - for ( retry = 0; ; retry = 1 ) + for ( retry = false; ; retry = true ) { efi_memmap_size = info_size; status = SystemTable->BootServices->GetMemoryMap(&efi_memmap_size, @@ -1071,9 +1071,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) EFI_SHIM_LOCK_PROTOCOL *shim_lock; EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL; union string section = { NULL }, name; - bool_t base_video = 0; + bool base_video = false; char *option_str; - bool_t use_cfg_file; + bool use_cfg_file; __set_bit(EFI_BOOT, &efi_flags); __set_bit(EFI_LOADER, &efi_flags); @@ -1115,9 +1115,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) if ( *ptr == L'/' || *ptr == L'-' ) { if ( wstrcmp(ptr + 1, L"basevideo") == 0 ) - base_video = 1; + base_video = true; else if ( wstrcmp(ptr + 1, L"mapbs") == 0 ) - map_bs = 1; + map_bs = true; else if ( wstrncmp(ptr + 1, L"cfg=", 4) == 0 ) cfg_file_name = ptr + 5; else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") == 0 ) @@ -1304,14 +1304,14 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) #ifndef CONFIG_ARM /* TODO - runtime service support */ -static bool_t __initdata efi_map_uc; +static bool __initdata efi_map_uc; static void __init parse_efi_param(char *s) { char *ss; do { - bool_t val = !!strncmp(s, "no-", 3); + bool val = strncmp(s, "no-", 3); if ( !val ) s += 3; @@ -1337,8 +1337,8 @@ custom_param("efi", parse_efi_param); #ifndef USE_SET_VIRTUAL_ADDRESS_MAP static __init void copy_mapping(unsigned long mfn, unsigned long end, - bool_t (*is_valid)(unsigned long smfn, - unsigned long emfn)) + bool (*is_valid)(unsigned long smfn, + unsigned long emfn)) { unsigned long next; @@ -1366,7 +1366,7 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end, } } -static bool_t __init ram_range_valid(unsigned long smfn, unsigned long emfn) +static bool __init ram_range_valid(unsigned long smfn, unsigned long emfn) { unsigned long sz = pfn_to_pdx(emfn - 1) / PDX_GROUP_COUNT + 1; @@ -1375,9 +1375,9 @@ static bool_t __init ram_range_valid(unsigned long smfn, unsigned long emfn) pfn_to_pdx(smfn) / PDX_GROUP_COUNT) < sz; } -static bool_t __init rt_range_valid(unsigned long smfn, unsigned long emfn) +static bool __init rt_range_valid(unsigned long smfn, unsigned long emfn) { - return 1; + return true; } #endif diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c index 20bc532..c38f00a 100644 --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -136,7 +136,7 @@ void efi_rs_leave(struct efi_rs_state *state) stts(); } -bool_t efi_rs_using_pgtables(void) +bool efi_rs_using_pgtables(void) { return efi_l4_pgtable && (smp_processor_id() == efi_rs_on_cpu) && @@ -177,7 +177,7 @@ void efi_halt_system(void) printk(XENLOG_WARNING "EFI: could not halt system (%#lx)\n", status); } -void efi_reset_system(bool_t warm) +void efi_reset_system(bool warm) { EFI_STATUS status; struct efi_rs_state state = efi_rs_enter(); diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h index 68c68a8..44b7d3e 100644 --- a/xen/include/xen/efi.h +++ b/xen/include/xen/efi.h @@ -33,10 +33,10 @@ struct compat_pf_efi_runtime_call; bool efi_enabled(unsigned int feature); void efi_init_memory(void); -bool_t efi_rs_using_pgtables(void); +bool efi_rs_using_pgtables(void); unsigned long efi_get_time(void); void efi_halt_system(void); -void efi_reset_system(bool_t warm); +void efi_reset_system(bool warm); #ifndef COMPAT int efi_get_info(uint32_t idx, union xenpf_efi_info *); int efi_runtime_call(struct xenpf_efi_runtime_call *);