Commit 6fc321fd authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] cio/ipl: Clean interface between cio and ipl code.

Clean interface between cio and ipl code, so Peter stops complaining.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 29c380f5
...@@ -47,7 +47,7 @@ enum ipl_type { ...@@ -47,7 +47,7 @@ enum ipl_type {
* Must be in data section since the bss section * Must be in data section since the bss section
* is not cleared when these are accessed. * is not cleared when these are accessed.
*/ */
u16 ipl_devno __attribute__((__section__(".data"))) = 0; static u16 ipl_devno __attribute__((__section__(".data"))) = 0;
u32 ipl_flags __attribute__((__section__(".data"))) = 0; u32 ipl_flags __attribute__((__section__(".data"))) = 0;
static char *ipl_type_str(enum ipl_type type) static char *ipl_type_str(enum ipl_type type)
...@@ -1038,6 +1038,27 @@ static int __init s390_ipl_init(void) ...@@ -1038,6 +1038,27 @@ static int __init s390_ipl_init(void)
__initcall(s390_ipl_init); __initcall(s390_ipl_init);
void __init ipl_save_parameters(void)
{
struct cio_iplinfo iplinfo;
unsigned int *ipl_ptr;
void *src, *dst;
if (cio_get_iplinfo(&iplinfo))
return;
ipl_devno = iplinfo.devno;
ipl_flags |= IPL_DEVNO_VALID;
if (!iplinfo.is_qdio)
return;
ipl_flags |= IPL_PARMBLOCK_VALID;
ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR;
src = (void *)(unsigned long)*ipl_ptr;
dst = (void *)IPL_PARMBLOCK_ORIGIN;
memmove(dst, src, PAGE_SIZE);
*ipl_ptr = IPL_PARMBLOCK_ORIGIN;
}
static LIST_HEAD(rcall); static LIST_HEAD(rcall);
static DEFINE_MUTEX(rcall_mutex); static DEFINE_MUTEX(rcall_mutex);
......
...@@ -1048,37 +1048,19 @@ void reipl_ccw_dev(struct ccw_dev_id *devid) ...@@ -1048,37 +1048,19 @@ void reipl_ccw_dev(struct ccw_dev_id *devid)
do_reipl_asm(*((__u32*)&schid)); do_reipl_asm(*((__u32*)&schid));
} }
static struct schib __initdata ipl_schib; int __init cio_get_iplinfo(struct cio_iplinfo *iplinfo)
/*
* ipl_save_parameters gets called very early. It is not allowed to access
* anything in the bss section at all. The bss section is not cleared yet,
* but may contain some ipl parameters written by the firmware.
* These parameters (if present) are copied to 0x2000.
* To avoid corruption of the ipl parameters, all variables used by this
* function must reside on the stack or in the data section.
*/
void ipl_save_parameters(void)
{ {
struct subchannel_id schid; struct subchannel_id schid;
unsigned int *ipl_ptr; struct schib schib;
void *src, *dst;
schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID; schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID;
if (!schid.one) if (!schid.one)
return; return -ENODEV;
if (stsch(schid, &ipl_schib)) if (stsch(schid, &schib))
return; return -ENODEV;
if (!ipl_schib.pmcw.dnv) if (!schib.pmcw.dnv)
return; return -ENODEV;
ipl_devno = ipl_schib.pmcw.dev; iplinfo->devno = schib.pmcw.dev;
ipl_flags |= IPL_DEVNO_VALID; iplinfo->is_qdio = schib.pmcw.qf;
if (!ipl_schib.pmcw.qf) return 0;
return;
ipl_flags |= IPL_PARMBLOCK_VALID;
ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR;
src = (void *)(unsigned long)*ipl_ptr;
dst = (void *)IPL_PARMBLOCK_ORIGIN;
memmove(dst, src, PAGE_SIZE);
*ipl_ptr = IPL_PARMBLOCK_ORIGIN;
} }
...@@ -292,6 +292,13 @@ extern void css_schedule_reprobe(void); ...@@ -292,6 +292,13 @@ extern void css_schedule_reprobe(void);
extern void reipl_ccw_dev(struct ccw_dev_id *id); extern void reipl_ccw_dev(struct ccw_dev_id *id);
struct cio_iplinfo {
u16 devno;
int is_qdio;
};
extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
#endif #endif
#endif #endif
...@@ -74,10 +74,9 @@ struct ipl_parameter_block { ...@@ -74,10 +74,9 @@ struct ipl_parameter_block {
} __attribute__((packed)); } __attribute__((packed));
/* /*
* IPL validity flags and parameters as detected in head.S * IPL validity flags
*/ */
extern u32 ipl_flags; extern u32 ipl_flags;
extern u16 ipl_devno;
extern u32 dump_prefix_page; extern u32 dump_prefix_page;
extern void do_reipl(void); extern void do_reipl(void);
......
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