Commit 260de22f authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[PATCH] powerpc: iseries: mf related cleanups

Some cleanups in the iSeries code.
 - Make mf_display_progress() check mf_initialized rather than the caller.
 - Set mf_initialized in mf_init() rather than in setup.c
 - Then move mf_initialized into mf.c, the only place it's used.
 - Move the mf related logic from iSeries_progress() to mf_display_progress()
 - Use a #define to size the pending_event_prealloc array
 - Use that define in the initialsation loop rather than sizeof jiggery pokery
 - Remove stupid comment(s)
 - Mark stuff static and/or __init
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 57cfb814
......@@ -46,6 +46,7 @@
#include "setup.h"
extern int piranha_simulator;
static int mf_initialized;
/*
* This is the structure layout for the Machine Facilites LPAR event
......@@ -143,7 +144,8 @@ static spinlock_t pending_event_spinlock;
static struct pending_event *pending_event_head;
static struct pending_event *pending_event_tail;
static struct pending_event *pending_event_avail;
static struct pending_event pending_event_prealloc[16];
#define PENDING_EVENT_PREALLOC_LEN 16
static struct pending_event pending_event_prealloc[PENDING_EVENT_PREALLOC_LEN];
/*
* Put a pending event onto the available queue, so it can get reused.
......@@ -625,7 +627,7 @@ void mf_display_src(u32 word)
/*
* Display a single word SRC of the form "PROGXXXX" on the VSP control panel.
*/
void mf_display_progress(u16 value)
static __init void mf_display_progress_src(u16 value)
{
u8 ce[12];
u8 src[72];
......@@ -649,30 +651,42 @@ void mf_display_progress(u16 value)
* Clear the VSP control panel. Used to "erase" an SRC that was
* previously displayed.
*/
void mf_clear_src(void)
static void mf_clear_src(void)
{
signal_ce_msg_simple(0x4b, NULL);
}
void __init mf_display_progress(u16 value)
{
if (piranha_simulator || !mf_initialized)
return;
if (0xFFFF == value)
mf_clear_src();
else
mf_display_progress_src(value);
}
/*
* Initialization code here.
*/
void mf_init(void)
void __init mf_init(void)
{
int i;
/* initialize */
spin_lock_init(&pending_event_spinlock);
for (i = 0;
i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc);
++i)
for (i = 0; i < PENDING_EVENT_PREALLOC_LEN; i++)
free_pending_event(&pending_event_prealloc[i]);
HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler);
/* virtual continue ack */
signal_ce_msg_simple(0x57, NULL);
/* initialization complete */
mf_initialized = 1;
mb();
printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities "
"initialized\n");
}
......
......@@ -89,8 +89,6 @@ extern unsigned long embedded_sysmap_end;
extern unsigned long iSeries_recal_tb;
extern unsigned long iSeries_recal_titan;
static int mf_initialized;
static unsigned long cmd_mem_limit;
struct MemoryBlock {
......@@ -347,8 +345,6 @@ static void __init iSeries_init_early(void)
HvCallEvent_setLpEventQueueInterruptProc(0, 0);
mf_init();
mf_initialized = 1;
mb();
/* If we were passed an initrd, set the ROOT_DEV properly if the values
* look sensible. If not, clear initrd reference.
......@@ -585,12 +581,7 @@ static void iSeries_halt(void)
static void __init iSeries_progress(char * st, unsigned short code)
{
printk("Progress: [%04x] - %s\n", (unsigned)code, st);
if (!piranha_simulator && mf_initialized) {
if (code != 0xffff)
mf_display_progress(code);
else
mf_clear_src();
}
mf_display_progress(code);
}
static void __init iSeries_fixup_klimit(void)
......
......@@ -45,7 +45,6 @@ extern void mf_reboot(void);
extern void mf_display_src(u32 word);
extern void mf_display_progress(u16 value);
extern void mf_clear_src(void);
extern void mf_init(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