Commit f6e0f291 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by David Mosberger

[PATCH] This patch against 2.4.18+ia64-020226 removes a legacy VGA

dependency.  Non-legacy systems may have system memory
at 0xA0000, and if that's the case, we don't want to install the
VGA console.

Restructured conswitchp init slightly so that if both
CONFIG_DUMMY_CONSOLE and CONFIG_VGA_CONSOLE
are defined, conswitchp is always set to something, even if we
don't find VGA at 0xA0000.

This work is due to Alex Williamson (alex_williamson@hp.com).
parent 101fc241
...@@ -155,10 +155,10 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg) ...@@ -155,10 +155,10 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
case EFI_CONVENTIONAL_MEMORY: case EFI_CONVENTIONAL_MEMORY:
if (!(md->attribute & EFI_MEMORY_WB)) if (!(md->attribute & EFI_MEMORY_WB))
continue; continue;
if (md->phys_addr + (md->num_pages << 12) > mem_limit) { if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
if (md->phys_addr > mem_limit) if (md->phys_addr > mem_limit)
continue; continue;
md->num_pages = (mem_limit - md->phys_addr) >> 12; md->num_pages = (mem_limit - md->phys_addr) >> EFI_PAGE_SHIFT;
} }
if (md->num_pages == 0) { if (md->num_pages == 0) {
printk("efi_memmap_walk: ignoring empty region at 0x%lx", printk("efi_memmap_walk: ignoring empty region at 0x%lx",
...@@ -167,7 +167,7 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg) ...@@ -167,7 +167,7 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
} }
curr.start = PAGE_OFFSET + md->phys_addr; curr.start = PAGE_OFFSET + md->phys_addr;
curr.end = curr.start + (md->num_pages << 12); curr.end = curr.start + (md->num_pages << EFI_PAGE_SHIFT);
if (!prev_valid) { if (!prev_valid) {
prev = curr; prev = curr;
...@@ -254,12 +254,12 @@ efi_map_pal_code (void) ...@@ -254,12 +254,12 @@ efi_map_pal_code (void)
continue; continue;
} }
if (md->num_pages << 12 > IA64_GRANULE_SIZE) if (md->num_pages << EFI_PAGE_SHIFT > IA64_GRANULE_SIZE)
panic("Woah! PAL code size bigger than a granule!"); panic("Woah! PAL code size bigger than a granule!");
mask = ~((1 << IA64_GRANULE_SHIFT) - 1); mask = ~((1 << IA64_GRANULE_SHIFT) - 1);
printk("CPU %d: mapping PAL code [0x%lx-0x%lx) into [0x%lx-0x%lx)\n", printk("CPU %d: mapping PAL code [0x%lx-0x%lx) into [0x%lx-0x%lx)\n",
smp_processor_id(), md->phys_addr, md->phys_addr + (md->num_pages << 12), smp_processor_id(), md->phys_addr, md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE); vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE);
/* /*
...@@ -375,7 +375,7 @@ efi_init (void) ...@@ -375,7 +375,7 @@ efi_init (void)
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 + (md->num_pages<<12) - 1, md->num_pages >> 8); md->phys_addr + (md->num_pages<<EFI_PAGE_SHIFT) - 1, md->num_pages >> 8);
} }
} }
#endif #endif
...@@ -482,6 +482,26 @@ efi_get_iobase (void) ...@@ -482,6 +482,26 @@ efi_get_iobase (void)
return 0; return 0;
} }
u32
efi_mem_type (u64 phys_addr)
{
void *efi_map_start, *efi_map_end, *p;
efi_memory_desc_t *md;
u64 efi_desc_size;
efi_map_start = __va(ia64_boot_param->efi_memmap);
efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
efi_desc_size = ia64_boot_param->efi_memdesc_size;
for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
md = p;
if ((md->phys_addr <= phys_addr) && (phys_addr <=
(md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1)))
return md->type;
}
return 0;
}
static void __exit static void __exit
efivars_exit(void) efivars_exit(void)
{ {
......
...@@ -351,11 +351,19 @@ setup_arch (char **cmdline_p) ...@@ -351,11 +351,19 @@ setup_arch (char **cmdline_p)
} }
#ifdef CONFIG_VT #ifdef CONFIG_VT
# if defined(CONFIG_VGA_CONSOLE) # if defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &vga_con;
# elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con; conswitchp = &dummy_con;
# endif # endif
# if defined(CONFIG_VGA_CONSOLE)
/*
* Non-legacy systems may route legacy VGA MMIO range to system
* memory. vga_con probes the MMIO hole, so memory looks like
* a VGA device to it. The EFI memory map can tell us if it's
* memory so we can avoid this problem.
*/
if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
conswitchp = &vga_con;
# endif
#endif #endif
#ifdef CONFIG_IA64_MCA #ifdef CONFIG_IA64_MCA
......
...@@ -87,6 +87,8 @@ typedef struct { ...@@ -87,6 +87,8 @@ typedef struct {
#define EFI_MEMORY_RUNTIME 0x8000000000000000 /* range requires runtime mapping */ #define EFI_MEMORY_RUNTIME 0x8000000000000000 /* range requires runtime mapping */
#define EFI_MEMORY_DESCRIPTOR_VERSION 1 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
#define EFI_PAGE_SHIFT 12
typedef struct { typedef struct {
u32 type; u32 type;
u32 pad; u32 pad;
...@@ -257,6 +259,7 @@ extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); ...@@ -257,6 +259,7 @@ extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
extern void efi_gettimeofday (struct timeval *tv); extern void efi_gettimeofday (struct timeval *tv);
extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
extern u64 efi_get_iobase (void); extern u64 efi_get_iobase (void);
extern u32 efi_mem_type (u64 phys_addr);
/* /*
* Variable Attributes * Variable Attributes
......
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