Commit 7d9aed26 authored by Aron Griffis's avatar Aron Griffis Committed by Tony Luck

[IA64] Make efi.c mostly fit in 80 columns

This patch is purely whitespace changes to make the code fit in 80
columns, plus fix some inconsistent indentation.  The efi_guidcmp()
tests remain wider than 80-columns since that seems to be the most
clear.
Signed-off-by: default avatarAron Griffis <aron@hp.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent cdef24c9
/* /*
* Extensible Firmware Interface * Extensible Firmware Interface
* *
* Based on Extensible Firmware Interface Specification version 0.9 April 30, 1999 * Based on Extensible Firmware Interface Specification version 0.9
* April 30, 1999
* *
* Copyright (C) 1999 VA Linux Systems * Copyright (C) 1999 VA Linux Systems
* Copyright (C) 1999 Walt Drummond <drummond@valinux.com> * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
...@@ -59,7 +60,8 @@ prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc) \ ...@@ -59,7 +60,8 @@ prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc) \
if (tc) \ if (tc) \
atc = adjust_arg(tc); \ atc = adjust_arg(tc); \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), adjust_arg(tm), atc); \ ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), \
adjust_arg(tm), atc); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
return ret; \ return ret; \
} }
...@@ -72,20 +74,23 @@ prefix##_set_time (efi_time_t *tm) \ ...@@ -72,20 +74,23 @@ prefix##_set_time (efi_time_t *tm) \
efi_status_t ret; \ efi_status_t ret; \
\ \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), adjust_arg(tm)); \ ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), \
adjust_arg(tm)); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
return ret; \ return ret; \
} }
#define STUB_GET_WAKEUP_TIME(prefix, adjust_arg) \ #define STUB_GET_WAKEUP_TIME(prefix, adjust_arg) \
static efi_status_t \ static efi_status_t \
prefix##_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, efi_time_t *tm) \ prefix##_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, \
efi_time_t *tm) \
{ \ { \
struct ia64_fpreg fr[6]; \ struct ia64_fpreg fr[6]; \
efi_status_t ret; \ efi_status_t ret; \
\ \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_get_wakeup_time_t *) __va(runtime->get_wakeup_time), \ ret = efi_call_##prefix( \
(efi_get_wakeup_time_t *) __va(runtime->get_wakeup_time), \
adjust_arg(enabled), adjust_arg(pending), adjust_arg(tm)); \ adjust_arg(enabled), adjust_arg(pending), adjust_arg(tm)); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
return ret; \ return ret; \
...@@ -102,7 +107,8 @@ prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm) \ ...@@ -102,7 +107,8 @@ prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm) \
if (tm) \ if (tm) \
atm = adjust_arg(tm); \ atm = adjust_arg(tm); \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_set_wakeup_time_t *) __va(runtime->set_wakeup_time), \ ret = efi_call_##prefix( \
(efi_set_wakeup_time_t *) __va(runtime->set_wakeup_time), \
enabled, atm); \ enabled, atm); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
return ret; \ return ret; \
...@@ -120,7 +126,8 @@ prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \ ...@@ -120,7 +126,8 @@ prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \
if (attr) \ if (attr) \
aattr = adjust_arg(attr); \ aattr = adjust_arg(attr); \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_get_variable_t *) __va(runtime->get_variable), \ ret = efi_call_##prefix( \
(efi_get_variable_t *) __va(runtime->get_variable), \
adjust_arg(name), adjust_arg(vendor), aattr, \ adjust_arg(name), adjust_arg(vendor), aattr, \
adjust_arg(data_size), adjust_arg(data)); \ adjust_arg(data_size), adjust_arg(data)); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
...@@ -129,13 +136,15 @@ prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \ ...@@ -129,13 +136,15 @@ prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \
#define STUB_GET_NEXT_VARIABLE(prefix, adjust_arg) \ #define STUB_GET_NEXT_VARIABLE(prefix, adjust_arg) \
static efi_status_t \ static efi_status_t \
prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, efi_guid_t *vendor) \ prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, \
efi_guid_t *vendor) \
{ \ { \
struct ia64_fpreg fr[6]; \ struct ia64_fpreg fr[6]; \
efi_status_t ret; \ efi_status_t ret; \
\ \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_get_next_variable_t *) __va(runtime->get_next_variable), \ ret = efi_call_##prefix( \
(efi_get_next_variable_t *) __va(runtime->get_next_variable), \
adjust_arg(name_size), adjust_arg(name), adjust_arg(vendor)); \ adjust_arg(name_size), adjust_arg(name), adjust_arg(vendor)); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
return ret; \ return ret; \
...@@ -143,14 +152,16 @@ prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, efi_gu ...@@ -143,14 +152,16 @@ prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, efi_gu
#define STUB_SET_VARIABLE(prefix, adjust_arg) \ #define STUB_SET_VARIABLE(prefix, adjust_arg) \
static efi_status_t \ static efi_status_t \
prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, unsigned long attr, \ prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, \
unsigned long data_size, void *data) \ unsigned long attr, unsigned long data_size, \
void *data) \
{ \ { \
struct ia64_fpreg fr[6]; \ struct ia64_fpreg fr[6]; \
efi_status_t ret; \ efi_status_t ret; \
\ \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_set_variable_t *) __va(runtime->set_variable), \ ret = efi_call_##prefix( \
(efi_set_variable_t *) __va(runtime->set_variable), \
adjust_arg(name), adjust_arg(vendor), attr, data_size, \ adjust_arg(name), adjust_arg(vendor), attr, data_size, \
adjust_arg(data)); \ adjust_arg(data)); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
...@@ -166,7 +177,8 @@ prefix##_get_next_high_mono_count (u32 *count) \ ...@@ -166,7 +177,8 @@ prefix##_get_next_high_mono_count (u32 *count) \
\ \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
ret = efi_call_##prefix((efi_get_next_high_mono_count_t *) \ ret = efi_call_##prefix((efi_get_next_high_mono_count_t *) \
__va(runtime->get_next_high_mono_count), adjust_arg(count)); \ __va(runtime->get_next_high_mono_count), \
adjust_arg(count)); \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
return ret; \ return ret; \
} }
...@@ -183,7 +195,8 @@ prefix##_reset_system (int reset_type, efi_status_t status, \ ...@@ -183,7 +195,8 @@ prefix##_reset_system (int reset_type, efi_status_t status, \
adata = adjust_arg(data); \ adata = adjust_arg(data); \
\ \
ia64_save_scratch_fpregs(fr); \ ia64_save_scratch_fpregs(fr); \
efi_call_##prefix((efi_reset_system_t *) __va(runtime->reset_system), \ efi_call_##prefix( \
(efi_reset_system_t *) __va(runtime->reset_system), \
reset_type, status, data_size, adata); \ reset_type, status, data_size, adata); \
/* should not return, but just in case... */ \ /* should not return, but just in case... */ \
ia64_load_scratch_fpregs(fr); \ ia64_load_scratch_fpregs(fr); \
...@@ -223,7 +236,8 @@ efi_gettimeofday (struct timespec *ts) ...@@ -223,7 +236,8 @@ efi_gettimeofday (struct timespec *ts)
return; return;
} }
ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); ts->tv_sec = mktime(tm.year, tm.month, tm.day,
tm.hour, tm.minute, tm.second);
ts->tv_nsec = tm.nanosecond; ts->tv_nsec = tm.nanosecond;
} }
...@@ -297,8 +311,8 @@ walk (efi_freemem_callback_t callback, void *arg, u64 attr) ...@@ -297,8 +311,8 @@ walk (efi_freemem_callback_t callback, void *arg, u64 attr)
} }
/* /*
* Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that * Walks the EFI memory map and calls CALLBACK once for each EFI memory
* has memory that is available for OS use. * descriptor that has memory that is available for OS use.
*/ */
void void
efi_memmap_walk (efi_freemem_callback_t callback, void *arg) efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
...@@ -307,8 +321,8 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg) ...@@ -307,8 +321,8 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
} }
/* /*
* Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that * Walks the EFI memory map and calls CALLBACK once for each EFI memory
* has memory that is available for uncached allocator. * descriptor that has memory that is available for uncached allocator.
*/ */
void void
efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg) efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
...@@ -321,7 +335,6 @@ efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg) ...@@ -321,7 +335,6 @@ efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
* ITR to enable safe PAL calls in virtual mode. See IA-64 Processor * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor
* Abstraction Layer chapter 11 in ADAG * Abstraction Layer chapter 11 in ADAG
*/ */
void * void *
efi_get_pal_addr (void) efi_get_pal_addr (void)
{ {
...@@ -341,32 +354,33 @@ efi_get_pal_addr (void) ...@@ -341,32 +354,33 @@ efi_get_pal_addr (void)
continue; continue;
if (++pal_code_count > 1) { if (++pal_code_count > 1) {
printk(KERN_ERR "Too many EFI Pal Code memory ranges, dropped @ %lx\n", printk(KERN_ERR "Too many EFI Pal Code memory ranges, "
md->phys_addr); "dropped @ %lx\n", md->phys_addr);
continue; continue;
} }
/* /*
* The only ITLB entry in region 7 that is used is the one installed by * The only ITLB entry in region 7 that is used is the one
* __start(). That entry covers a 64MB range. * installed by __start(). That entry covers a 64MB range.
*/ */
mask = ~((1 << KERNEL_TR_PAGE_SHIFT) - 1); mask = ~((1 << KERNEL_TR_PAGE_SHIFT) - 1);
vaddr = PAGE_OFFSET + md->phys_addr; vaddr = PAGE_OFFSET + md->phys_addr;
/* /*
* We must check that the PAL mapping won't overlap with the kernel * We must check that the PAL mapping won't overlap with the
* mapping. * kernel mapping.
* *
* PAL code is guaranteed to be aligned on a power of 2 between 4k and * PAL code is guaranteed to be aligned on a power of 2 between
* 256KB and that only one ITR is needed to map it. This implies that the * 4k and 256KB and that only one ITR is needed to map it. This
* PAL code is always aligned on its size, i.e., the closest matching page * implies that the PAL code is always aligned on its size,
* size supported by the TLB. Therefore PAL code is guaranteed never to * i.e., the closest matching page size supported by the TLB.
* cross a 64MB unless it is bigger than 64MB (very unlikely!). So for * Therefore PAL code is guaranteed never to cross a 64MB unless
* now the following test is enough to determine whether or not we need a * it is bigger than 64MB (very unlikely!). So for now the
* dedicated ITR for the PAL code. * following test is enough to determine whether or not we need
* a dedicated ITR for the PAL code.
*/ */
if ((vaddr & mask) == (KERNEL_START & mask)) { if ((vaddr & mask) == (KERNEL_START & mask)) {
printk(KERN_INFO "%s: no need to install ITR for PAL code\n", printk(KERN_INFO "%s: no need to install ITR for "
__FUNCTION__); "PAL code\n", __FUNCTION__);
continue; continue;
} }
...@@ -376,7 +390,8 @@ efi_get_pal_addr (void) ...@@ -376,7 +390,8 @@ efi_get_pal_addr (void)
#if EFI_DEBUG #if EFI_DEBUG
mask = ~((1 << IA64_GRANULE_SHIFT) - 1); mask = ~((1 << IA64_GRANULE_SHIFT) - 1);
printk(KERN_INFO "CPU %d: mapping PAL code [0x%lx-0x%lx) into [0x%lx-0x%lx)\n", printk(KERN_INFO "CPU %d: mapping PAL code "
"[0x%lx-0x%lx) into [0x%lx-0x%lx)\n",
smp_processor_id(), md->phys_addr, smp_processor_id(), md->phys_addr,
md->phys_addr + efi_md_size(md), md->phys_addr + efi_md_size(md),
vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE); vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE);
...@@ -401,7 +416,8 @@ efi_map_pal_code (void) ...@@ -401,7 +416,8 @@ efi_map_pal_code (void)
* Cannot write to CRx with PSR.ic=1 * Cannot write to CRx with PSR.ic=1
*/ */
psr = ia64_clear_ic(); psr = ia64_clear_ic();
ia64_itr(0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) pal_vaddr), ia64_itr(0x1, IA64_TR_PALCODE,
GRANULEROUNDDOWN((unsigned long) pal_vaddr),
pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)), pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
IA64_GRANULE_SHIFT); IA64_GRANULE_SHIFT);
ia64_set_psr(psr); /* restore psr */ ia64_set_psr(psr); /* restore psr */
...@@ -418,7 +434,10 @@ efi_init (void) ...@@ -418,7 +434,10 @@ efi_init (void)
char *cp, vendor[100] = "unknown"; char *cp, vendor[100] = "unknown";
int i; int i;
/* it's too early to be able to use the standard kernel command line support... */ /*
* it's too early to be able to use the standard kernel command line
* support...
*/
for (cp = boot_command_line; *cp; ) { for (cp = boot_command_line; *cp; ) {
if (memcmp(cp, "mem=", 4) == 0) { if (memcmp(cp, "mem=", 4) == 0) {
mem_limit = memparse(cp + 4, &cp); mem_limit = memparse(cp + 4, &cp);
...@@ -434,9 +453,11 @@ efi_init (void) ...@@ -434,9 +453,11 @@ efi_init (void)
} }
} }
if (min_addr != 0UL) if (min_addr != 0UL)
printk(KERN_INFO "Ignoring memory below %luMB\n", min_addr >> 20); printk(KERN_INFO "Ignoring memory below %luMB\n",
min_addr >> 20);
if (max_addr != ~0UL) if (max_addr != ~0UL)
printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20); printk(KERN_INFO "Ignoring memory above %luMB\n",
max_addr >> 20);
efi.systab = __va(ia64_boot_param->efi_systab); efi.systab = __va(ia64_boot_param->efi_systab);
...@@ -464,7 +485,8 @@ efi_init (void) ...@@ -464,7 +485,8 @@ efi_init (void)
} }
printk(KERN_INFO "EFI v%u.%.02u by %s:", printk(KERN_INFO "EFI v%u.%.02u by %s:",
efi.systab->hdr.revision >> 16, efi.systab->hdr.revision & 0xffff, vendor); efi.systab->hdr.revision >> 16,
efi.systab->hdr.revision & 0xffff, vendor);
efi.mps = EFI_INVALID_TABLE_ADDR; efi.mps = EFI_INVALID_TABLE_ADDR;
efi.acpi = EFI_INVALID_TABLE_ADDR; efi.acpi = EFI_INVALID_TABLE_ADDR;
...@@ -519,9 +541,12 @@ efi_init (void) ...@@ -519,9 +541,12 @@ efi_init (void)
efi_memory_desc_t *md; efi_memory_desc_t *md;
void *p; void *p;
for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) { for (i = 0, p = efi_map_start; p < efi_map_end;
++i, p += efi_desc_size)
{
md = p; md = p;
printk("mem%02u: type=%u, attr=0x%lx, range=[0x%016lx-0x%016lx) (%luMB)\n", printk("mem%02u: type=%u, attr=0x%lx, "
"range=[0x%016lx-0x%016lx) (%luMB)\n",
i, md->type, md->attribute, md->phys_addr, i, md->type, md->attribute, md->phys_addr,
md->phys_addr + efi_md_size(md), md->phys_addr + efi_md_size(md),
md->num_pages >> (20 - EFI_PAGE_SHIFT)); md->num_pages >> (20 - EFI_PAGE_SHIFT));
...@@ -549,8 +574,8 @@ efi_enter_virtual_mode (void) ...@@ -549,8 +574,8 @@ efi_enter_virtual_mode (void)
md = p; md = p;
if (md->attribute & EFI_MEMORY_RUNTIME) { if (md->attribute & EFI_MEMORY_RUNTIME) {
/* /*
* Some descriptors have multiple bits set, so the order of * Some descriptors have multiple bits set, so the
* the tests is relevant. * order of the tests is relevant.
*/ */
if (md->attribute & EFI_MEMORY_WB) { if (md->attribute & EFI_MEMORY_WB) {
md->virt_addr = (u64) __va(md->phys_addr); md->virt_addr = (u64) __va(md->phys_addr);
...@@ -558,21 +583,26 @@ efi_enter_virtual_mode (void) ...@@ -558,21 +583,26 @@ efi_enter_virtual_mode (void)
md->virt_addr = (u64) ioremap(md->phys_addr, 0); md->virt_addr = (u64) ioremap(md->phys_addr, 0);
} else if (md->attribute & EFI_MEMORY_WC) { } else if (md->attribute & EFI_MEMORY_WC) {
#if 0 #if 0
md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P md->virt_addr = ia64_remap(md->phys_addr,
| _PAGE_D (_PAGE_A |
| _PAGE_MA_WC _PAGE_P |
| _PAGE_PL_0 _PAGE_D |
| _PAGE_AR_RW)); _PAGE_MA_WC |
_PAGE_PL_0 |
_PAGE_AR_RW));
#else #else
printk(KERN_INFO "EFI_MEMORY_WC mapping\n"); printk(KERN_INFO "EFI_MEMORY_WC mapping\n");
md->virt_addr = (u64) ioremap(md->phys_addr, 0); md->virt_addr = (u64) ioremap(md->phys_addr, 0);
#endif #endif
} else if (md->attribute & EFI_MEMORY_WT) { } else if (md->attribute & EFI_MEMORY_WT) {
#if 0 #if 0
md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P md->virt_addr = ia64_remap(md->phys_addr,
| _PAGE_D | _PAGE_MA_WT (_PAGE_A |
| _PAGE_PL_0 _PAGE_P |
| _PAGE_AR_RW)); _PAGE_D |
_PAGE_MA_WT |
_PAGE_PL_0 |
_PAGE_AR_RW));
#else #else
printk(KERN_INFO "EFI_MEMORY_WT mapping\n"); printk(KERN_INFO "EFI_MEMORY_WT mapping\n");
md->virt_addr = (u64) ioremap(md->phys_addr, 0); md->virt_addr = (u64) ioremap(md->phys_addr, 0);
...@@ -583,16 +613,18 @@ efi_enter_virtual_mode (void) ...@@ -583,16 +613,18 @@ efi_enter_virtual_mode (void)
status = efi_call_phys(__va(runtime->set_virtual_address_map), status = efi_call_phys(__va(runtime->set_virtual_address_map),
ia64_boot_param->efi_memmap_size, ia64_boot_param->efi_memmap_size,
efi_desc_size, ia64_boot_param->efi_memdesc_version, efi_desc_size,
ia64_boot_param->efi_memdesc_version,
ia64_boot_param->efi_memmap); ia64_boot_param->efi_memmap);
if (status != EFI_SUCCESS) { if (status != EFI_SUCCESS) {
printk(KERN_WARNING "warning: unable to switch EFI into virtual mode " printk(KERN_WARNING "warning: unable to switch EFI into "
"(status=%lu)\n", status); "virtual mode (status=%lu)\n", status);
return; return;
} }
/* /*
* Now that EFI is in virtual mode, we call the EFI functions more efficiently: * Now that EFI is in virtual mode, we call the EFI functions more
* efficiently:
*/ */
efi.get_time = virt_get_time; efi.get_time = virt_get_time;
efi.set_time = virt_set_time; efi.set_time = virt_set_time;
...@@ -606,8 +638,8 @@ efi_enter_virtual_mode (void) ...@@ -606,8 +638,8 @@ efi_enter_virtual_mode (void)
} }
/* /*
* Walk the EFI memory map looking for the I/O port range. There can only be one entry of * Walk the EFI memory map looking for the I/O port range. There can only be
* this type, other I/O port ranges should be described via ACPI. * one entry of this type, other I/O port ranges should be described via ACPI.
*/ */
u64 u64
efi_get_iobase (void) efi_get_iobase (void)
...@@ -678,7 +710,6 @@ efi_memmap_intersects (unsigned long phys_addr, unsigned long size) ...@@ -678,7 +710,6 @@ efi_memmap_intersects (unsigned long phys_addr, unsigned long size)
for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
md = p; md = p;
if (md->phys_addr < end && efi_md_end(md) > phys_addr) if (md->phys_addr < end && efi_md_end(md) > phys_addr)
return 1; return 1;
} }
...@@ -883,7 +914,7 @@ efi_uart_console_only(void) ...@@ -883,7 +914,7 @@ efi_uart_console_only(void)
return 1; return 1;
uart = 0; uart = 0;
} }
hdr = (struct efi_generic_dev_path *) ((u8 *) hdr + hdr->length); hdr = (struct efi_generic_dev_path *)((u8 *) hdr + hdr->length);
} }
printk(KERN_ERR "Malformed %s value\n", name); printk(KERN_ERR "Malformed %s value\n", name);
return 0; return 0;
...@@ -921,10 +952,12 @@ find_memmap_space (void) ...@@ -921,10 +952,12 @@ find_memmap_space (void)
if (!efi_wb(md)) { if (!efi_wb(md)) {
continue; continue;
} }
if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) { if (pmd == NULL || !efi_wb(pmd) ||
efi_md_end(pmd) != md->phys_addr) {
contig_low = GRANULEROUNDUP(md->phys_addr); contig_low = GRANULEROUNDUP(md->phys_addr);
contig_high = efi_md_end(md); contig_high = efi_md_end(md);
for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) { for (q = p + efi_desc_size; q < efi_map_end;
q += efi_desc_size) {
check_md = q; check_md = q;
if (!efi_wb(check_md)) if (!efi_wb(check_md))
break; break;
...@@ -988,7 +1021,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e) ...@@ -988,7 +1021,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) { for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
md = p; md = p;
if (!efi_wb(md)) { if (!efi_wb(md)) {
if (efi_uc(md) && (md->type == EFI_CONVENTIONAL_MEMORY || if (efi_uc(md) &&
(md->type == EFI_CONVENTIONAL_MEMORY ||
md->type == EFI_BOOT_SERVICES_DATA)) { md->type == EFI_BOOT_SERVICES_DATA)) {
k->attribute = EFI_MEMORY_UC; k->attribute = EFI_MEMORY_UC;
k->start = md->phys_addr; k->start = md->phys_addr;
...@@ -997,10 +1031,12 @@ efi_memmap_init(unsigned long *s, unsigned long *e) ...@@ -997,10 +1031,12 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
} }
continue; continue;
} }
if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) { if (pmd == NULL || !efi_wb(pmd) ||
efi_md_end(pmd) != md->phys_addr) {
contig_low = GRANULEROUNDUP(md->phys_addr); contig_low = GRANULEROUNDUP(md->phys_addr);
contig_high = efi_md_end(md); contig_high = efi_md_end(md);
for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) { for (q = p + efi_desc_size; q < efi_map_end;
q += efi_desc_size) {
check_md = q; check_md = q;
if (!efi_wb(check_md)) if (!efi_wb(check_md))
break; break;
...@@ -1025,13 +1061,17 @@ efi_memmap_init(unsigned long *s, unsigned long *e) ...@@ -1025,13 +1061,17 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
if (md->phys_addr < contig_low) { if (md->phys_addr < contig_low) {
lim = min(efi_md_end(md), contig_low); lim = min(efi_md_end(md), contig_low);
if (efi_uc(md)) { if (efi_uc(md)) {
if (k > kern_memmap && (k-1)->attribute == EFI_MEMORY_UC && if (k > kern_memmap &&
(k-1)->attribute == EFI_MEMORY_UC &&
kmd_end(k-1) == md->phys_addr) { kmd_end(k-1) == md->phys_addr) {
(k-1)->num_pages += (lim - md->phys_addr) >> EFI_PAGE_SHIFT; (k-1)->num_pages +=
(lim - md->phys_addr)
>> EFI_PAGE_SHIFT;
} else { } else {
k->attribute = EFI_MEMORY_UC; k->attribute = EFI_MEMORY_UC;
k->start = md->phys_addr; k->start = md->phys_addr;
k->num_pages = (lim - md->phys_addr) >> EFI_PAGE_SHIFT; k->num_pages = (lim - md->phys_addr)
>> EFI_PAGE_SHIFT;
k++; k++;
} }
} }
...@@ -1049,7 +1089,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e) ...@@ -1049,7 +1089,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
} else { } else {
k->attribute = EFI_MEMORY_UC; k->attribute = EFI_MEMORY_UC;
k->start = lim; k->start = lim;
k->num_pages = (efi_md_end(md) - lim) >> EFI_PAGE_SHIFT; k->num_pages = (efi_md_end(md) - lim)
>> EFI_PAGE_SHIFT;
k++; k++;
} }
} }
...@@ -1151,8 +1192,10 @@ efi_initialize_iomem_resources(struct resource *code_resource, ...@@ -1151,8 +1192,10 @@ efi_initialize_iomem_resources(struct resource *code_resource,
break; break;
} }
if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { if ((res = kzalloc(sizeof(struct resource),
printk(KERN_ERR "failed to alocate resource for iomem\n"); GFP_KERNEL)) == NULL) {
printk(KERN_ERR
"failed to alocate resource for iomem\n");
return; return;
} }
...@@ -1187,8 +1230,7 @@ efi_initialize_iomem_resources(struct resource *code_resource, ...@@ -1187,8 +1230,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
rsvd_regions are sorted rsvd_regions are sorted
*/ */
unsigned long __init unsigned long __init
kdump_find_rsvd_region (unsigned long size, kdump_find_rsvd_region (unsigned long size, struct rsvd_region *r, int n)
struct rsvd_region *r, int n)
{ {
int i; int i;
u64 start, end; u64 start, end;
...@@ -1212,7 +1254,8 @@ kdump_find_rsvd_region (unsigned long size, ...@@ -1212,7 +1254,8 @@ kdump_find_rsvd_region (unsigned long size,
if (__pa(r[i].start) > start + size) if (__pa(r[i].start) > start + size)
return start; return start;
start = ALIGN(__pa(r[i].end), alignment); start = ALIGN(__pa(r[i].end), alignment);
if (i < n-1 && __pa(r[i+1].start) < start + size) if (i < n-1 &&
__pa(r[i+1].start) < start + size)
continue; continue;
else else
break; break;
...@@ -1222,8 +1265,8 @@ kdump_find_rsvd_region (unsigned long size, ...@@ -1222,8 +1265,8 @@ kdump_find_rsvd_region (unsigned long size,
return start; return start;
} }
printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n", printk(KERN_WARNING
size); "Cannot reserve 0x%lx byte of memory for crashdump\n", size);
return ~0UL; return ~0UL;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment