diff options
| author | Michael Ellerman <michael@ellerman.id.au> | 2006-03-21 04:46:02 -0500 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2006-03-21 23:04:20 -0500 |
| commit | 260de22faac4d336ca122ebd0f1e59279d0b1dfd (patch) | |
| tree | be1c202f2bba96546ae2430d9433f7bd7d2a4783 | |
| parent | 57cfb814f698d30894bc28e22125550193ebe549 (diff) | |
[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: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
| -rw-r--r-- | arch/powerpc/platforms/iseries/mf.c | 32 | ||||
| -rw-r--r-- | arch/powerpc/platforms/iseries/setup.c | 11 | ||||
| -rw-r--r-- | include/asm-powerpc/iseries/mf.h | 1 |
3 files changed, 24 insertions, 20 deletions
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c index a41d8b78c0cd..97a26137cf40 100644 --- a/arch/powerpc/platforms/iseries/mf.c +++ b/arch/powerpc/platforms/iseries/mf.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include "setup.h" | 46 | #include "setup.h" |
| 47 | 47 | ||
| 48 | extern int piranha_simulator; | 48 | extern int piranha_simulator; |
| 49 | static int mf_initialized; | ||
| 49 | 50 | ||
| 50 | /* | 51 | /* |
| 51 | * This is the structure layout for the Machine Facilites LPAR event | 52 | * This is the structure layout for the Machine Facilites LPAR event |
| @@ -143,7 +144,8 @@ static spinlock_t pending_event_spinlock; | |||
| 143 | static struct pending_event *pending_event_head; | 144 | static struct pending_event *pending_event_head; |
| 144 | static struct pending_event *pending_event_tail; | 145 | static struct pending_event *pending_event_tail; |
| 145 | static struct pending_event *pending_event_avail; | 146 | static struct pending_event *pending_event_avail; |
| 146 | static struct pending_event pending_event_prealloc[16]; | 147 | #define PENDING_EVENT_PREALLOC_LEN 16 |
| 148 | static struct pending_event pending_event_prealloc[PENDING_EVENT_PREALLOC_LEN]; | ||
| 147 | 149 | ||
| 148 | /* | 150 | /* |
| 149 | * Put a pending event onto the available queue, so it can get reused. | 151 | * Put a pending event onto the available queue, so it can get reused. |
| @@ -625,7 +627,7 @@ void mf_display_src(u32 word) | |||
| 625 | /* | 627 | /* |
| 626 | * Display a single word SRC of the form "PROGXXXX" on the VSP control panel. | 628 | * Display a single word SRC of the form "PROGXXXX" on the VSP control panel. |
| 627 | */ | 629 | */ |
| 628 | void mf_display_progress(u16 value) | 630 | static __init void mf_display_progress_src(u16 value) |
| 629 | { | 631 | { |
| 630 | u8 ce[12]; | 632 | u8 ce[12]; |
| 631 | u8 src[72]; | 633 | u8 src[72]; |
| @@ -649,30 +651,42 @@ void mf_display_progress(u16 value) | |||
| 649 | * Clear the VSP control panel. Used to "erase" an SRC that was | 651 | * Clear the VSP control panel. Used to "erase" an SRC that was |
| 650 | * previously displayed. | 652 | * previously displayed. |
| 651 | */ | 653 | */ |
| 652 | void mf_clear_src(void) | 654 | static void mf_clear_src(void) |
| 653 | { | 655 | { |
| 654 | signal_ce_msg_simple(0x4b, NULL); | 656 | signal_ce_msg_simple(0x4b, NULL); |
| 655 | } | 657 | } |
| 656 | 658 | ||
| 659 | void __init mf_display_progress(u16 value) | ||
| 660 | { | ||
| 661 | if (piranha_simulator || !mf_initialized) | ||
| 662 | return; | ||
| 663 | |||
| 664 | if (0xFFFF == value) | ||
| 665 | mf_clear_src(); | ||
| 666 | else | ||
| 667 | mf_display_progress_src(value); | ||
| 668 | } | ||
| 669 | |||
| 657 | /* | 670 | /* |
| 658 | * Initialization code here. | 671 | * Initialization code here. |
| 659 | */ | 672 | */ |
| 660 | void mf_init(void) | 673 | void __init mf_init(void) |
| 661 | { | 674 | { |
| 662 | int i; | 675 | int i; |
| 663 | 676 | ||
| 664 | /* initialize */ | ||
| 665 | spin_lock_init(&pending_event_spinlock); | 677 | spin_lock_init(&pending_event_spinlock); |
| 666 | for (i = 0; | 678 | |
| 667 | i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc); | 679 | for (i = 0; i < PENDING_EVENT_PREALLOC_LEN; i++) |
| 668 | ++i) | ||
| 669 | free_pending_event(&pending_event_prealloc[i]); | 680 | free_pending_event(&pending_event_prealloc[i]); |
| 681 | |||
| 670 | HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler); | 682 | HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler); |
| 671 | 683 | ||
| 672 | /* virtual continue ack */ | 684 | /* virtual continue ack */ |
| 673 | signal_ce_msg_simple(0x57, NULL); | 685 | signal_ce_msg_simple(0x57, NULL); |
| 674 | 686 | ||
| 675 | /* initialization complete */ | 687 | mf_initialized = 1; |
| 688 | mb(); | ||
| 689 | |||
| 676 | printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities " | 690 | printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities " |
| 677 | "initialized\n"); | 691 | "initialized\n"); |
| 678 | } | 692 | } |
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index b08c3686f903..190891ce9cb4 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
| @@ -89,8 +89,6 @@ extern unsigned long embedded_sysmap_end; | |||
| 89 | extern unsigned long iSeries_recal_tb; | 89 | extern unsigned long iSeries_recal_tb; |
| 90 | extern unsigned long iSeries_recal_titan; | 90 | extern unsigned long iSeries_recal_titan; |
| 91 | 91 | ||
| 92 | static int mf_initialized; | ||
| 93 | |||
| 94 | static unsigned long cmd_mem_limit; | 92 | static unsigned long cmd_mem_limit; |
| 95 | 93 | ||
| 96 | struct MemoryBlock { | 94 | struct MemoryBlock { |
| @@ -347,8 +345,6 @@ static void __init iSeries_init_early(void) | |||
| 347 | HvCallEvent_setLpEventQueueInterruptProc(0, 0); | 345 | HvCallEvent_setLpEventQueueInterruptProc(0, 0); |
| 348 | 346 | ||
| 349 | mf_init(); | 347 | mf_init(); |
| 350 | mf_initialized = 1; | ||
| 351 | mb(); | ||
| 352 | 348 | ||
| 353 | /* If we were passed an initrd, set the ROOT_DEV properly if the values | 349 | /* If we were passed an initrd, set the ROOT_DEV properly if the values |
| 354 | * look sensible. If not, clear initrd reference. | 350 | * look sensible. If not, clear initrd reference. |
| @@ -585,12 +581,7 @@ static void iSeries_halt(void) | |||
| 585 | static void __init iSeries_progress(char * st, unsigned short code) | 581 | static void __init iSeries_progress(char * st, unsigned short code) |
| 586 | { | 582 | { |
| 587 | printk("Progress: [%04x] - %s\n", (unsigned)code, st); | 583 | printk("Progress: [%04x] - %s\n", (unsigned)code, st); |
| 588 | if (!piranha_simulator && mf_initialized) { | 584 | mf_display_progress(code); |
| 589 | if (code != 0xffff) | ||
| 590 | mf_display_progress(code); | ||
| 591 | else | ||
| 592 | mf_clear_src(); | ||
| 593 | } | ||
| 594 | } | 585 | } |
| 595 | 586 | ||
| 596 | static void __init iSeries_fixup_klimit(void) | 587 | static void __init iSeries_fixup_klimit(void) |
diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h index 857e5202fc78..335e163daaf3 100644 --- a/include/asm-powerpc/iseries/mf.h +++ b/include/asm-powerpc/iseries/mf.h | |||
| @@ -45,7 +45,6 @@ extern void mf_reboot(void); | |||
| 45 | 45 | ||
| 46 | extern void mf_display_src(u32 word); | 46 | extern void mf_display_src(u32 word); |
| 47 | extern void mf_display_progress(u16 value); | 47 | extern void mf_display_progress(u16 value); |
| 48 | extern void mf_clear_src(void); | ||
| 49 | 48 | ||
| 50 | extern void mf_init(void); | 49 | extern void mf_init(void); |
| 51 | 50 | ||
