Commit bd50b743 authored by Alexander Gordeev's avatar Alexander Gordeev Committed by Heiko Carstens

s390/boot: detect and enable memory facilities

Detect and enable memory facilities which is a
prerequisite for pgtables setup in the decompressor.
Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent b2658540
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
struct machine_info {
unsigned char has_edat1 : 1;
unsigned char has_edat2 : 1;
unsigned char has_nx : 1;
};
struct vmlinux_info { struct vmlinux_info {
unsigned long default_lma; unsigned long default_lma;
void (*entry)(void); void (*entry)(void);
...@@ -38,6 +44,8 @@ unsigned long get_random_base(unsigned long safe_addr); ...@@ -38,6 +44,8 @@ unsigned long get_random_base(unsigned long safe_addr);
void __printf(1, 2) decompressor_printk(const char *fmt, ...); void __printf(1, 2) decompressor_printk(const char *fmt, ...);
void error(char *m); void error(char *m);
extern struct machine_info machine;
/* Symbols defined by linker scripts */ /* Symbols defined by linker scripts */
extern const char kernel_version[]; extern const char kernel_version[];
extern unsigned long memory_limit; extern unsigned long memory_limit;
......
...@@ -33,6 +33,8 @@ u64 __bootdata_preserved(stfle_fac_list[16]); ...@@ -33,6 +33,8 @@ u64 __bootdata_preserved(stfle_fac_list[16]);
u64 __bootdata_preserved(alt_stfle_fac_list[16]); u64 __bootdata_preserved(alt_stfle_fac_list[16]);
struct oldmem_data __bootdata_preserved(oldmem_data); struct oldmem_data __bootdata_preserved(oldmem_data);
struct machine_info machine;
void error(char *x) void error(char *x)
{ {
sclp_early_printk("\n\n"); sclp_early_printk("\n\n");
...@@ -42,6 +44,20 @@ void error(char *x) ...@@ -42,6 +44,20 @@ void error(char *x)
disabled_wait(); disabled_wait();
} }
static void detect_facilities(void)
{
if (test_facility(8)) {
machine.has_edat1 = 1;
__ctl_set_bit(0, 23);
}
if (test_facility(78))
machine.has_edat2 = 1;
if (!noexec_disabled && test_facility(130)) {
machine.has_nx = 1;
__ctl_set_bit(0, 20);
}
}
static void setup_lpp(void) static void setup_lpp(void)
{ {
S390_lowcore.current_pid = 0; S390_lowcore.current_pid = 0;
...@@ -254,6 +270,8 @@ void startup_kernel(void) ...@@ -254,6 +270,8 @@ void startup_kernel(void)
unsigned long safe_addr; unsigned long safe_addr;
void *img; void *img;
detect_facilities();
initrd_data.start = parmarea.initrd_start; initrd_data.start = parmarea.initrd_start;
initrd_data.size = parmarea.initrd_size; initrd_data.size = parmarea.initrd_size;
oldmem_data.start = parmarea.oldmem_base; oldmem_data.start = parmarea.oldmem_base;
......
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