Commit 0788b35b authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds

[PATCH] ppc64: iSeries remove more Studly Caps from MF code

Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 35b5df41
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
* This is the structure layout for the Machine Facilites LPAR event * This is the structure layout for the Machine Facilites LPAR event
* flows. * flows.
*/ */
struct VspCmdData { struct vsp_cmd_data {
u64 token; u64 token;
u16 cmd; u16 cmd;
HvLpIndex lp_index; HvLpIndex lp_index;
...@@ -77,12 +77,12 @@ struct VspCmdData { ...@@ -77,12 +77,12 @@ struct VspCmdData {
} sub_data; } sub_data;
}; };
struct VspRspData { struct vsp_rsp_data {
struct completion com; struct completion com;
struct VspCmdData *response; struct vsp_cmd_data *response;
}; };
struct AllocData { struct alloc_data {
u16 size; u16 size;
u16 type; u16 type;
u32 count; u32 count;
...@@ -91,30 +91,30 @@ struct AllocData { ...@@ -91,30 +91,30 @@ struct AllocData {
HvLpIndex target_lp; HvLpIndex target_lp;
}; };
struct CeMsgData; struct ce_msg_data;
typedef void (*CeMsgCompleteHandler)(void *token, struct CeMsgData *vspCmdRsp); typedef void (*ce_msg_comp_hdlr)(void *token, struct ce_msg_data *vsp_cmd_rsp);
struct CeMsgCompleteData { struct ce_msg_comp_data {
CeMsgCompleteHandler handler; ce_msg_comp_hdlr handler;
void *token; void *token;
}; };
struct CeMsgData { struct ce_msg_data {
u8 ce_msg[12]; u8 ce_msg[12];
char reserved[4]; char reserved[4];
struct CeMsgCompleteData *completion; struct ce_msg_comp_data *completion;
}; };
struct IoMFLpEvent { struct io_mf_lp_event {
struct HvLpEvent hp_lp_event; struct HvLpEvent hp_lp_event;
u16 subtype_result_code; u16 subtype_result_code;
u16 reserved1; u16 reserved1;
u32 reserved2; u32 reserved2;
union { union {
struct AllocData alloc; struct alloc_data alloc;
struct CeMsgData ce_msg; struct ce_msg_data ce_msg;
struct VspCmdData vsp_cmd; struct vsp_cmd_data vsp_cmd;
} data; } data;
}; };
...@@ -130,7 +130,7 @@ struct IoMFLpEvent { ...@@ -130,7 +130,7 @@ struct IoMFLpEvent {
*/ */
struct pending_event { struct pending_event {
struct pending_event *next; struct pending_event *next;
struct IoMFLpEvent event; struct io_mf_lp_event event;
MFCompleteHandler hdlr; MFCompleteHandler hdlr;
char dma_data[72]; char dma_data[72];
unsigned dma_data_length; unsigned dma_data_length;
...@@ -168,7 +168,7 @@ static int signal_event(struct pending_event *ev) ...@@ -168,7 +168,7 @@ static int signal_event(struct pending_event *ev)
unsigned long flags; unsigned long flags;
int go = 1; int go = 1;
struct pending_event *ev1; struct pending_event *ev1;
HvLpEvent_Rc hvRc; HvLpEvent_Rc hv_rc;
/* enqueue the event */ /* enqueue the event */
if (ev != NULL) { if (ev != NULL) {
...@@ -195,11 +195,11 @@ static int signal_event(struct pending_event *ev) ...@@ -195,11 +195,11 @@ static int signal_event(struct pending_event *ev)
pending_event_head->dma_data_length, pending_event_head->dma_data_length,
HvLpDma_Direction_LocalToRemote); HvLpDma_Direction_LocalToRemote);
hvRc = HvCallEvent_signalLpEvent( hv_rc = HvCallEvent_signalLpEvent(
&pending_event_head->event.hp_lp_event); &pending_event_head->event.hp_lp_event);
if (hvRc != HvLpEvent_Rc_Good) { if (hv_rc != HvLpEvent_Rc_Good) {
printk(KERN_ERR "mf.c: HvCallEvent_signalLpEvent() failed with %d\n", printk(KERN_ERR "mf.c: HvCallEvent_signalLpEvent() failed with %d\n",
(int)hvRc); (int)hv_rc);
spin_lock_irqsave(&pending_event_spinlock, flags); spin_lock_irqsave(&pending_event_spinlock, flags);
ev1 = pending_event_head; ev1 = pending_event_head;
...@@ -228,7 +228,7 @@ static int signal_event(struct pending_event *ev) ...@@ -228,7 +228,7 @@ static int signal_event(struct pending_event *ev)
static struct pending_event *new_pending_event(void) static struct pending_event *new_pending_event(void)
{ {
struct pending_event *ev = NULL; struct pending_event *ev = NULL;
HvLpIndex primaryLp = HvLpConfig_getPrimaryLpIndex(); HvLpIndex primary_lp = HvLpConfig_getPrimaryLpIndex();
unsigned long flags; unsigned long flags;
struct HvLpEvent *hev; struct HvLpEvent *hev;
...@@ -253,38 +253,38 @@ static struct pending_event *new_pending_event(void) ...@@ -253,38 +253,38 @@ static struct pending_event *new_pending_event(void)
hev->xFlags.xFunction = HvLpEvent_Function_Int; hev->xFlags.xFunction = HvLpEvent_Function_Int;
hev->xType = HvLpEvent_Type_MachineFac; hev->xType = HvLpEvent_Type_MachineFac;
hev->xSourceLp = HvLpConfig_getLpIndex(); hev->xSourceLp = HvLpConfig_getLpIndex();
hev->xTargetLp = primaryLp; hev->xTargetLp = primary_lp;
hev->xSizeMinus1 = sizeof(ev->event)-1; hev->xSizeMinus1 = sizeof(ev->event)-1;
hev->xRc = HvLpEvent_Rc_Good; hev->xRc = HvLpEvent_Rc_Good;
hev->xSourceInstanceId = HvCallEvent_getSourceLpInstanceId(primaryLp, hev->xSourceInstanceId = HvCallEvent_getSourceLpInstanceId(primary_lp,
HvLpEvent_Type_MachineFac); HvLpEvent_Type_MachineFac);
hev->xTargetInstanceId = HvCallEvent_getTargetLpInstanceId(primaryLp, hev->xTargetInstanceId = HvCallEvent_getTargetLpInstanceId(primary_lp,
HvLpEvent_Type_MachineFac); HvLpEvent_Type_MachineFac);
return ev; return ev;
} }
static int signal_vsp_instruction(struct VspCmdData *vspCmd) static int signal_vsp_instruction(struct vsp_cmd_data *vsp_cmd)
{ {
struct pending_event *ev = new_pending_event(); struct pending_event *ev = new_pending_event();
int rc; int rc;
struct VspRspData response; struct vsp_rsp_data response;
if (ev == NULL) if (ev == NULL)
return -ENOMEM; return -ENOMEM;
init_completion(&response.com); init_completion(&response.com);
response.response = vspCmd; response.response = vsp_cmd;
ev->event.hp_lp_event.xSubtype = 6; ev->event.hp_lp_event.xSubtype = 6;
ev->event.hp_lp_event.x.xSubtypeData = ev->event.hp_lp_event.x.xSubtypeData =
subtype_data('M', 'F', 'V', 'I'); subtype_data('M', 'F', 'V', 'I');
ev->event.data.vsp_cmd.token = (u64)&response; ev->event.data.vsp_cmd.token = (u64)&response;
ev->event.data.vsp_cmd.cmd = vspCmd->cmd; ev->event.data.vsp_cmd.cmd = vsp_cmd->cmd;
ev->event.data.vsp_cmd.lp_index = HvLpConfig_getLpIndex(); ev->event.data.vsp_cmd.lp_index = HvLpConfig_getLpIndex();
ev->event.data.vsp_cmd.result_code = 0xFF; ev->event.data.vsp_cmd.result_code = 0xFF;
ev->event.data.vsp_cmd.reserved = 0; ev->event.data.vsp_cmd.reserved = 0;
memcpy(&(ev->event.data.vsp_cmd.sub_data), memcpy(&(ev->event.data.vsp_cmd.sub_data),
&(vspCmd->sub_data), sizeof(vspCmd->sub_data)); &(vsp_cmd->sub_data), sizeof(vsp_cmd->sub_data));
mb(); mb();
rc = signal_event(ev); rc = signal_event(ev);
...@@ -297,7 +297,7 @@ static int signal_vsp_instruction(struct VspCmdData *vspCmd) ...@@ -297,7 +297,7 @@ static int signal_vsp_instruction(struct VspCmdData *vspCmd)
/* /*
* Send a 12-byte CE message to the primary partition VSP object * Send a 12-byte CE message to the primary partition VSP object
*/ */
static int signal_ce_msg(char *ce_msg, struct CeMsgCompleteData *completion) static int signal_ce_msg(char *ce_msg, struct ce_msg_comp_data *completion)
{ {
struct pending_event *ev = new_pending_event(); struct pending_event *ev = new_pending_event();
...@@ -315,7 +315,7 @@ static int signal_ce_msg(char *ce_msg, struct CeMsgCompleteData *completion) ...@@ -315,7 +315,7 @@ static int signal_ce_msg(char *ce_msg, struct CeMsgCompleteData *completion)
/* /*
* Send a 12-byte CE message (with no data) to the primary partition VSP object * Send a 12-byte CE message (with no data) to the primary partition VSP object
*/ */
static int signal_ce_msg_simple(u8 ce_op, struct CeMsgCompleteData *completion) static int signal_ce_msg_simple(u8 ce_op, struct ce_msg_comp_data *completion)
{ {
u8 ce_msg[12]; u8 ce_msg[12];
...@@ -328,7 +328,7 @@ static int signal_ce_msg_simple(u8 ce_op, struct CeMsgCompleteData *completion) ...@@ -328,7 +328,7 @@ static int signal_ce_msg_simple(u8 ce_op, struct CeMsgCompleteData *completion)
* Send a 12-byte CE message and DMA data to the primary partition VSP object * Send a 12-byte CE message and DMA data to the primary partition VSP object
*/ */
static int dma_and_signal_ce_msg(char *ce_msg, static int dma_and_signal_ce_msg(char *ce_msg,
struct CeMsgCompleteData *completion, void *dma_data, struct ce_msg_comp_data *completion, void *dma_data,
unsigned dma_data_length, unsigned remote_address) unsigned dma_data_length, unsigned remote_address)
{ {
struct pending_event *ev = new_pending_event(); struct pending_event *ev = new_pending_event();
...@@ -371,9 +371,9 @@ static int shutdown(void) ...@@ -371,9 +371,9 @@ static int shutdown(void)
* The primary partition VSP object is sending us a new * The primary partition VSP object is sending us a new
* event flow. Handle it... * event flow. Handle it...
*/ */
static void intReceived(struct IoMFLpEvent *event) static void handle_int(struct io_mf_lp_event *event)
{ {
int freeIt = 0; int free_it = 0;
struct pending_event *two = NULL; struct pending_event *two = NULL;
/* ack the interrupt */ /* ack the interrupt */
...@@ -396,9 +396,9 @@ static void intReceived(struct IoMFLpEvent *event) ...@@ -396,9 +396,9 @@ static void intReceived(struct IoMFLpEvent *event)
(pending_event_head->event.data.ce_msg.ce_msg[3] (pending_event_head->event.data.ce_msg.ce_msg[3]
!= 0x40)) != 0x40))
break; break;
freeIt = 1; free_it = 1;
if (pending_event_head->event.data.ce_msg.completion != 0) { if (pending_event_head->event.data.ce_msg.completion != 0) {
CeMsgCompleteHandler handler = pending_event_head->event.data.ce_msg.completion->handler; ce_msg_comp_hdlr handler = pending_event_head->event.data.ce_msg.completion->handler;
void *token = pending_event_head->event.data.ce_msg.completion->token; void *token = pending_event_head->event.data.ce_msg.completion->token;
if (handler != NULL) if (handler != NULL)
...@@ -408,7 +408,7 @@ static void intReceived(struct IoMFLpEvent *event) ...@@ -408,7 +408,7 @@ static void intReceived(struct IoMFLpEvent *event)
} }
/* remove from queue */ /* remove from queue */
if (freeIt == 1) { if (free_it == 1) {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&pending_event_spinlock, flags); spin_lock_irqsave(&pending_event_spinlock, flags);
...@@ -439,11 +439,11 @@ static void intReceived(struct IoMFLpEvent *event) ...@@ -439,11 +439,11 @@ static void intReceived(struct IoMFLpEvent *event)
* of a flow we sent to them. If there are other flows queued * of a flow we sent to them. If there are other flows queued
* up, we must send another one now... * up, we must send another one now...
*/ */
static void ackReceived(struct IoMFLpEvent *event) static void handle_ack(struct io_mf_lp_event *event)
{ {
unsigned long flags; unsigned long flags;
struct pending_event * two = NULL; struct pending_event * two = NULL;
unsigned long freeIt = 0; unsigned long free_it = 0;
/* handle current event */ /* handle current event */
if (pending_event_head != NULL) { if (pending_event_head != NULL) {
...@@ -451,10 +451,10 @@ static void ackReceived(struct IoMFLpEvent *event) ...@@ -451,10 +451,10 @@ static void ackReceived(struct IoMFLpEvent *event)
case 0: /* CE msg */ case 0: /* CE msg */
if (event->data.ce_msg.ce_msg[3] == 0x40) { if (event->data.ce_msg.ce_msg[3] == 0x40) {
if (event->data.ce_msg.ce_msg[2] != 0) { if (event->data.ce_msg.ce_msg[2] != 0) {
freeIt = 1; free_it = 1;
if (pending_event_head->event.data.ce_msg.completion if (pending_event_head->event.data.ce_msg.completion
!= 0) { != 0) {
CeMsgCompleteHandler handler = pending_event_head->event.data.ce_msg.completion->handler; ce_msg_comp_hdlr handler = pending_event_head->event.data.ce_msg.completion->handler;
void *token = pending_event_head->event.data.ce_msg.completion->token; void *token = pending_event_head->event.data.ce_msg.completion->token;
if (handler != NULL) if (handler != NULL)
...@@ -462,18 +462,18 @@ static void ackReceived(struct IoMFLpEvent *event) ...@@ -462,18 +462,18 @@ static void ackReceived(struct IoMFLpEvent *event)
} }
} }
} else } else
freeIt = 1; free_it = 1;
break; break;
case 4: /* allocate */ case 4: /* allocate */
case 5: /* deallocate */ case 5: /* deallocate */
if (pending_event_head->hdlr != NULL) { if (pending_event_head->hdlr != NULL) {
(*pending_event_head->hdlr)((void *)event->hp_lp_event.xCorrelationToken, event->data.alloc.count); (*pending_event_head->hdlr)((void *)event->hp_lp_event.xCorrelationToken, event->data.alloc.count);
} }
freeIt = 1; free_it = 1;
break; break;
case 6: case 6:
{ {
struct VspRspData *rsp = (struct VspRspData *)event->data.vsp_cmd.token; struct vsp_rsp_data *rsp = (struct vsp_rsp_data *)event->data.vsp_cmd.token;
if (rsp != NULL) { if (rsp != NULL) {
if (rsp->response != NULL) if (rsp->response != NULL)
...@@ -481,7 +481,7 @@ static void ackReceived(struct IoMFLpEvent *event) ...@@ -481,7 +481,7 @@ static void ackReceived(struct IoMFLpEvent *event)
complete(&rsp->com); complete(&rsp->com);
} else } else
printk(KERN_ERR "mf.c: no rsp\n"); printk(KERN_ERR "mf.c: no rsp\n");
freeIt = 1; free_it = 1;
} }
break; break;
} }
...@@ -491,7 +491,7 @@ static void ackReceived(struct IoMFLpEvent *event) ...@@ -491,7 +491,7 @@ static void ackReceived(struct IoMFLpEvent *event)
/* remove from queue */ /* remove from queue */
spin_lock_irqsave(&pending_event_spinlock, flags); spin_lock_irqsave(&pending_event_spinlock, flags);
if ((pending_event_head != NULL) && (freeIt == 1)) { if ((pending_event_head != NULL) && (free_it == 1)) {
struct pending_event *oldHead = pending_event_head; struct pending_event *oldHead = pending_event_head;
pending_event_head = pending_event_head->next; pending_event_head = pending_event_head->next;
...@@ -511,15 +511,15 @@ static void ackReceived(struct IoMFLpEvent *event) ...@@ -511,15 +511,15 @@ static void ackReceived(struct IoMFLpEvent *event)
* parse it enough to know if it is an interrupt or an * parse it enough to know if it is an interrupt or an
* acknowledge. * acknowledge.
*/ */
static void hvHandler(struct HvLpEvent *event, struct pt_regs *regs) static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs)
{ {
if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) { if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) {
switch(event->xFlags.xFunction) { switch(event->xFlags.xFunction) {
case HvLpEvent_Function_Ack: case HvLpEvent_Function_Ack:
ackReceived((struct IoMFLpEvent *)event); handle_ack((struct io_mf_lp_event *)event);
break; break;
case HvLpEvent_Function_Int: case HvLpEvent_Function_Int:
intReceived((struct IoMFLpEvent *)event); handle_int((struct io_mf_lp_event *)event);
break; break;
default: default:
printk(KERN_ERR "mf.c: non ack/int event received\n"); printk(KERN_ERR "mf.c: non ack/int event received\n");
...@@ -533,9 +533,9 @@ static void hvHandler(struct HvLpEvent *event, struct pt_regs *regs) ...@@ -533,9 +533,9 @@ static void hvHandler(struct HvLpEvent *event, struct pt_regs *regs)
* Global kernel interface to allocate and seed events into the * Global kernel interface to allocate and seed events into the
* Hypervisor. * Hypervisor.
*/ */
void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, void mf_allocate_lp_events(HvLpIndex target_lp, HvLpEvent_Type type,
unsigned size, unsigned count, MFCompleteHandler hdlr, unsigned size, unsigned count, MFCompleteHandler hdlr,
void *userToken) void *user_token)
{ {
struct pending_event *ev = new_pending_event(); struct pending_event *ev = new_pending_event();
int rc; int rc;
...@@ -544,10 +544,10 @@ void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, ...@@ -544,10 +544,10 @@ void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
rc = -ENOMEM; rc = -ENOMEM;
} else { } else {
ev->event.hp_lp_event.xSubtype = 4; ev->event.hp_lp_event.xSubtype = 4;
ev->event.hp_lp_event.xCorrelationToken = (u64)userToken; ev->event.hp_lp_event.xCorrelationToken = (u64)user_token;
ev->event.hp_lp_event.x.xSubtypeData = ev->event.hp_lp_event.x.xSubtypeData =
subtype_data('M', 'F', 'M', 'A'); subtype_data('M', 'F', 'M', 'A');
ev->event.data.alloc.target_lp = targetLp; ev->event.data.alloc.target_lp = target_lp;
ev->event.data.alloc.type = type; ev->event.data.alloc.type = type;
ev->event.data.alloc.size = size; ev->event.data.alloc.size = size;
ev->event.data.alloc.count = count; ev->event.data.alloc.count = count;
...@@ -555,7 +555,7 @@ void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, ...@@ -555,7 +555,7 @@ void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
rc = signal_event(ev); rc = signal_event(ev);
} }
if ((rc != 0) && (hdlr != NULL)) if ((rc != 0) && (hdlr != NULL))
(*hdlr)(userToken, rc); (*hdlr)(user_token, rc);
} }
EXPORT_SYMBOL(mf_allocate_lp_events); EXPORT_SYMBOL(mf_allocate_lp_events);
...@@ -563,8 +563,8 @@ EXPORT_SYMBOL(mf_allocate_lp_events); ...@@ -563,8 +563,8 @@ EXPORT_SYMBOL(mf_allocate_lp_events);
* Global kernel interface to unseed and deallocate events already in * Global kernel interface to unseed and deallocate events already in
* Hypervisor. * Hypervisor.
*/ */
void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, void mf_deallocate_lp_events(HvLpIndex target_lp, HvLpEvent_Type type,
unsigned count, MFCompleteHandler hdlr, void *userToken) unsigned count, MFCompleteHandler hdlr, void *user_token)
{ {
struct pending_event *ev = new_pending_event(); struct pending_event *ev = new_pending_event();
int rc; int rc;
...@@ -573,17 +573,17 @@ void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, ...@@ -573,17 +573,17 @@ void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
rc = -ENOMEM; rc = -ENOMEM;
else { else {
ev->event.hp_lp_event.xSubtype = 5; ev->event.hp_lp_event.xSubtype = 5;
ev->event.hp_lp_event.xCorrelationToken = (u64)userToken; ev->event.hp_lp_event.xCorrelationToken = (u64)user_token;
ev->event.hp_lp_event.x.xSubtypeData = ev->event.hp_lp_event.x.xSubtypeData =
subtype_data('M', 'F', 'M', 'D'); subtype_data('M', 'F', 'M', 'D');
ev->event.data.alloc.target_lp = targetLp; ev->event.data.alloc.target_lp = target_lp;
ev->event.data.alloc.type = type; ev->event.data.alloc.type = type;
ev->event.data.alloc.count = count; ev->event.data.alloc.count = count;
ev->hdlr = hdlr; ev->hdlr = hdlr;
rc = signal_event(ev); rc = signal_event(ev);
} }
if ((rc != 0) && (hdlr != NULL)) if ((rc != 0) && (hdlr != NULL))
(*hdlr)(userToken, rc); (*hdlr)(user_token, rc);
} }
EXPORT_SYMBOL(mf_deallocate_lp_events); EXPORT_SYMBOL(mf_deallocate_lp_events);
...@@ -671,7 +671,7 @@ void mf_init(void) ...@@ -671,7 +671,7 @@ void mf_init(void)
i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc); i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc);
++i) ++i)
free_pending_event(&pending_event_prealloc[i]); free_pending_event(&pending_event_prealloc[i]);
HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hvHandler); HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler);
/* virtual continue ack */ /* virtual continue ack */
signal_ce_msg_simple(0x57, NULL); signal_ce_msg_simple(0x57, NULL);
...@@ -682,60 +682,60 @@ void mf_init(void) ...@@ -682,60 +682,60 @@ void mf_init(void)
void mf_setSide(char side) void mf_setSide(char side)
{ {
u64 newSide; u64 new_side;
struct VspCmdData myVspCmd; struct vsp_cmd_data vsp_cmd;
memset(&myVspCmd, 0, sizeof(myVspCmd)); memset(&vsp_cmd, 0, sizeof(vsp_cmd));
switch (side) { switch (side) {
case 'A': newSide = 0; case 'A': new_side = 0;
break; break;
case 'B': newSide = 1; case 'B': new_side = 1;
break; break;
case 'C': newSide = 2; case 'C': new_side = 2;
break; break;
default: newSide = 3; default: new_side = 3;
break; break;
} }
myVspCmd.sub_data.ipl_type = newSide; vsp_cmd.sub_data.ipl_type = new_side;
myVspCmd.cmd = 10; vsp_cmd.cmd = 10;
(void)signal_vsp_instruction(&myVspCmd); (void)signal_vsp_instruction(&vsp_cmd);
} }
char mf_getSide(void) char mf_getSide(void)
{ {
char returnValue = ' '; char return_value = ' ';
int rc = 0; int rc = 0;
struct VspCmdData myVspCmd; struct vsp_cmd_data vsp_cmd;
memset(&myVspCmd, 0, sizeof(myVspCmd)); memset(&vsp_cmd, 0, sizeof(vsp_cmd));
myVspCmd.cmd = 2; vsp_cmd.cmd = 2;
myVspCmd.sub_data.ipl_type = 0; vsp_cmd.sub_data.ipl_type = 0;
mb(); mb();
rc = signal_vsp_instruction(&myVspCmd); rc = signal_vsp_instruction(&vsp_cmd);
if (rc != 0) if (rc != 0)
return returnValue; return return_value;
if (myVspCmd.result_code == 0) { if (vsp_cmd.result_code == 0) {
switch (myVspCmd.sub_data.ipl_type) { switch (vsp_cmd.sub_data.ipl_type) {
case 0: returnValue = 'A'; case 0: return_value = 'A';
break; break;
case 1: returnValue = 'B'; case 1: return_value = 'B';
break; break;
case 2: returnValue = 'C'; case 2: return_value = 'C';
break; break;
default: returnValue = 'D'; default: return_value = 'D';
break; break;
} }
} }
return returnValue; return return_value;
} }
void mf_getSrcHistory(char *buffer, int size) void mf_getSrcHistory(char *buffer, int size)
{ {
#if 0 #if 0
struct IplTypeReturnStuff returnStuff; struct IplTypeReturnStuff return_stuff;
struct pending_event *ev = new_pending_event(); struct pending_event *ev = new_pending_event();
int rc = 0; int rc = 0;
char *pages[4]; char *pages[4];
...@@ -748,13 +748,13 @@ void mf_getSrcHistory(char *buffer, int size) ...@@ -748,13 +748,13 @@ void mf_getSrcHistory(char *buffer, int size)
|| (pages[2] == NULL) || (pages[3] == NULL)) || (pages[2] == NULL) || (pages[3] == NULL))
return -ENOMEM; return -ENOMEM;
returnStuff.xType = 0; return_stuff.xType = 0;
returnStuff.xRc = 0; return_stuff.xRc = 0;
returnStuff.xDone = 0; return_stuff.xDone = 0;
ev->event.hp_lp_event.xSubtype = 6; ev->event.hp_lp_event.xSubtype = 6;
ev->event.hp_lp_event.x.xSubtypeData = ev->event.hp_lp_event.x.xSubtypeData =
subtype_data('M', 'F', 'V', 'I'); subtype_data('M', 'F', 'V', 'I');
ev->event.data.vsp_cmd.xEvent = &returnStuff; ev->event.data.vsp_cmd.xEvent = &return_stuff;
ev->event.data.vsp_cmd.cmd = 4; ev->event.data.vsp_cmd.cmd = 4;
ev->event.data.vsp_cmd.lp_index = HvLpConfig_getLpIndex(); ev->event.data.vsp_cmd.lp_index = HvLpConfig_getLpIndex();
ev->event.data.vsp_cmd.result_code = 0xFF; ev->event.data.vsp_cmd.result_code = 0xFF;
...@@ -767,9 +767,9 @@ void mf_getSrcHistory(char *buffer, int size) ...@@ -767,9 +767,9 @@ void mf_getSrcHistory(char *buffer, int size)
if (signal_event(ev) != 0) if (signal_event(ev) != 0)
return; return;
while (returnStuff.xDone != 1) while (return_stuff.xDone != 1)
udelay(10); udelay(10);
if (returnStuff.xRc == 0) if (return_stuff.xRc == 0)
memcpy(buffer, pages[0], size); memcpy(buffer, pages[0], size);
kfree(pages[0]); kfree(pages[0]);
kfree(pages[1]); kfree(pages[1]);
...@@ -780,7 +780,7 @@ void mf_getSrcHistory(char *buffer, int size) ...@@ -780,7 +780,7 @@ void mf_getSrcHistory(char *buffer, int size)
void mf_setCmdLine(const char *cmdline, int size, u64 side) void mf_setCmdLine(const char *cmdline, int size, u64 side)
{ {
struct VspCmdData myVspCmd; struct vsp_cmd_data vsp_cmd;
dma_addr_t dma_addr = 0; dma_addr_t dma_addr = 0;
char *page = dma_alloc_coherent(iSeries_vio_dev, size, &dma_addr, char *page = dma_alloc_coherent(iSeries_vio_dev, size, &dma_addr,
GFP_ATOMIC); GFP_ATOMIC);
...@@ -792,21 +792,21 @@ void mf_setCmdLine(const char *cmdline, int size, u64 side) ...@@ -792,21 +792,21 @@ void mf_setCmdLine(const char *cmdline, int size, u64 side)
copy_from_user(page, cmdline, size); copy_from_user(page, cmdline, size);
memset(&myVspCmd, 0, sizeof(myVspCmd)); memset(&vsp_cmd, 0, sizeof(vsp_cmd));
myVspCmd.cmd = 31; vsp_cmd.cmd = 31;
myVspCmd.sub_data.kern.token = dma_addr; vsp_cmd.sub_data.kern.token = dma_addr;
myVspCmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex; vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
myVspCmd.sub_data.kern.side = side; vsp_cmd.sub_data.kern.side = side;
myVspCmd.sub_data.kern.length = size; vsp_cmd.sub_data.kern.length = size;
mb(); mb();
(void)signal_vsp_instruction(&myVspCmd); (void)signal_vsp_instruction(&vsp_cmd);
dma_free_coherent(iSeries_vio_dev, size, page, dma_addr); dma_free_coherent(iSeries_vio_dev, size, page, dma_addr);
} }
int mf_getCmdLine(char *cmdline, int *size, u64 side) int mf_getCmdLine(char *cmdline, int *size, u64 side)
{ {
struct VspCmdData myVspCmd; struct vsp_cmd_data vsp_cmd;
int rc; int rc;
int len = *size; int len = *size;
dma_addr_t dma_addr; dma_addr_t dma_addr;
...@@ -814,18 +814,18 @@ int mf_getCmdLine(char *cmdline, int *size, u64 side) ...@@ -814,18 +814,18 @@ int mf_getCmdLine(char *cmdline, int *size, u64 side)
dma_addr = dma_map_single(iSeries_vio_dev, cmdline, len, dma_addr = dma_map_single(iSeries_vio_dev, cmdline, len,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
memset(cmdline, 0, len); memset(cmdline, 0, len);
memset(&myVspCmd, 0, sizeof(myVspCmd)); memset(&vsp_cmd, 0, sizeof(vsp_cmd));
myVspCmd.cmd = 33; vsp_cmd.cmd = 33;
myVspCmd.sub_data.kern.token = dma_addr; vsp_cmd.sub_data.kern.token = dma_addr;
myVspCmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex; vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
myVspCmd.sub_data.kern.side = side; vsp_cmd.sub_data.kern.side = side;
myVspCmd.sub_data.kern.length = len; vsp_cmd.sub_data.kern.length = len;
mb(); mb();
rc = signal_vsp_instruction(&myVspCmd); rc = signal_vsp_instruction(&vsp_cmd);
if (rc == 0) { if (rc == 0) {
if (myVspCmd.result_code == 0) if (vsp_cmd.result_code == 0)
len = myVspCmd.sub_data.length_out; len = vsp_cmd.sub_data.length_out;
#if 0 #if 0
else else
memcpy(cmdline, "Bad cmdline", 11); memcpy(cmdline, "Bad cmdline", 11);
...@@ -840,7 +840,7 @@ int mf_getCmdLine(char *cmdline, int *size, u64 side) ...@@ -840,7 +840,7 @@ int mf_getCmdLine(char *cmdline, int *size, u64 side)
int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side) int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side)
{ {
struct VspCmdData myVspCmd; struct vsp_cmd_data vsp_cmd;
int rc; int rc;
dma_addr_t dma_addr = 0; dma_addr_t dma_addr = 0;
char *page = dma_alloc_coherent(iSeries_vio_dev, size, &dma_addr, char *page = dma_alloc_coherent(iSeries_vio_dev, size, &dma_addr,
...@@ -852,18 +852,18 @@ int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side) ...@@ -852,18 +852,18 @@ int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side)
} }
copy_from_user(page, buffer, size); copy_from_user(page, buffer, size);
memset(&myVspCmd, 0, sizeof(myVspCmd)); memset(&vsp_cmd, 0, sizeof(vsp_cmd));
myVspCmd.cmd = 30; vsp_cmd.cmd = 30;
myVspCmd.sub_data.kern.token = dma_addr; vsp_cmd.sub_data.kern.token = dma_addr;
myVspCmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex; vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
myVspCmd.sub_data.kern.side = side; vsp_cmd.sub_data.kern.side = side;
myVspCmd.sub_data.kern.offset = offset; vsp_cmd.sub_data.kern.offset = offset;
myVspCmd.sub_data.kern.length = size; vsp_cmd.sub_data.kern.length = size;
mb(); mb();
rc = signal_vsp_instruction(&myVspCmd); rc = signal_vsp_instruction(&vsp_cmd);
if (rc == 0) { if (rc == 0) {
if (myVspCmd.result_code == 0) if (vsp_cmd.result_code == 0)
rc = 0; rc = 0;
else else
rc = -ENOMEM; rc = -ENOMEM;
...@@ -876,7 +876,7 @@ int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side) ...@@ -876,7 +876,7 @@ int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side)
int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side) int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
{ {
struct VspCmdData myVspCmd; struct vsp_cmd_data vsp_cmd;
int rc; int rc;
int len = *size; int len = *size;
dma_addr_t dma_addr; dma_addr_t dma_addr;
...@@ -884,18 +884,18 @@ int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side) ...@@ -884,18 +884,18 @@ int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
dma_addr = dma_map_single(iSeries_vio_dev, buffer, len, dma_addr = dma_map_single(iSeries_vio_dev, buffer, len,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
memset(buffer, 0, len); memset(buffer, 0, len);
memset(&myVspCmd, 0, sizeof(myVspCmd)); memset(&vsp_cmd, 0, sizeof(vsp_cmd));
myVspCmd.cmd = 32; vsp_cmd.cmd = 32;
myVspCmd.sub_data.kern.token = dma_addr; vsp_cmd.sub_data.kern.token = dma_addr;
myVspCmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex; vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
myVspCmd.sub_data.kern.side = side; vsp_cmd.sub_data.kern.side = side;
myVspCmd.sub_data.kern.offset = offset; vsp_cmd.sub_data.kern.offset = offset;
myVspCmd.sub_data.kern.length = len; vsp_cmd.sub_data.kern.length = len;
mb(); mb();
rc = signal_vsp_instruction(&myVspCmd); rc = signal_vsp_instruction(&vsp_cmd);
if (rc == 0) { if (rc == 0) {
if (myVspCmd.result_code == 0) if (vsp_cmd.result_code == 0)
*size = myVspCmd.sub_data.length_out; *size = vsp_cmd.sub_data.length_out;
else else
rc = -ENOMEM; rc = -ENOMEM;
} }
...@@ -905,39 +905,39 @@ int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side) ...@@ -905,39 +905,39 @@ int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
return rc; return rc;
} }
struct RtcTimeData { struct rtc_time_data {
struct completion com; struct completion com;
struct CeMsgData xCeMsg; struct ce_msg_data ce_msg;
int xRc; int rc;
}; };
void getRtcTimeComplete(void * token, struct CeMsgData *ceMsg) static void get_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
{ {
struct RtcTimeData *rtc = (struct RtcTimeData *)token; struct rtc_time_data *rtc = token;
memcpy(&(rtc->xCeMsg), ceMsg, sizeof(rtc->xCeMsg)); memcpy(&rtc->ce_msg, ce_msg, sizeof(rtc->ce_msg));
rtc->xRc = 0; rtc->rc = 0;
complete(&rtc->com); complete(&rtc->com);
} }
int mf_get_rtc(struct rtc_time *tm) int mf_get_rtc(struct rtc_time *tm)
{ {
struct CeMsgCompleteData ceComplete; struct ce_msg_comp_data ce_complete;
struct RtcTimeData rtcData; struct rtc_time_data rtc_data;
int rc; int rc;
memset(&ceComplete, 0, sizeof(ceComplete)); memset(&ce_complete, 0, sizeof(ce_complete));
memset(&rtcData, 0, sizeof(rtcData)); memset(&rtc_data, 0, sizeof(rtc_data));
init_completion(&rtcData.com); init_completion(&rtc_data.com);
ceComplete.handler = &getRtcTimeComplete; ce_complete.handler = &get_rtc_time_complete;
ceComplete.token = (void *)&rtcData; ce_complete.token = &rtc_data;
rc = signal_ce_msg_simple(0x40, &ce_complete); rc = signal_ce_msg_simple(0x40, &ce_complete);
if (rc == 0) { if (rc == 0) {
wait_for_completion(&rtcData.com); wait_for_completion(&rtc_data.com);
if (rtcData.xRc == 0) { if (rtc_data.rc == 0) {
if ((rtcData.xCeMsg.ce_msg[2] == 0xa9) || if ((rtc_data.ce_msg.ce_msg[2] == 0xa9) ||
(rtcData.xCeMsg.ce_msg[2] == 0xaf)) { (rtc_data.ce_msg.ce_msg[2] == 0xaf)) {
/* TOD clock is not set */ /* TOD clock is not set */
tm->tm_sec = 1; tm->tm_sec = 1;
tm->tm_min = 1; tm->tm_min = 1;
...@@ -948,7 +948,7 @@ int mf_get_rtc(struct rtc_time *tm) ...@@ -948,7 +948,7 @@ int mf_get_rtc(struct rtc_time *tm)
mf_set_rtc(tm); mf_set_rtc(tm);
} }
{ {
u8 *ce_msg = rtcData.xCeMsg.ce_msg; u8 *ce_msg = rtc_data.ce_msg.ce_msg;
u8 year = ce_msg[5]; u8 year = ce_msg[5];
u8 sec = ce_msg[6]; u8 sec = ce_msg[6];
u8 min = ce_msg[7]; u8 min = ce_msg[7];
...@@ -974,7 +974,7 @@ int mf_get_rtc(struct rtc_time *tm) ...@@ -974,7 +974,7 @@ int mf_get_rtc(struct rtc_time *tm)
tm->tm_year = year; tm->tm_year = year;
} }
} else { } else {
rc = rtcData.xRc; rc = rtc_data.rc;
tm->tm_sec = 0; tm->tm_sec = 0;
tm->tm_min = 0; tm->tm_min = 0;
tm->tm_hour = 0; tm->tm_hour = 0;
...@@ -993,7 +993,7 @@ int mf_get_rtc(struct rtc_time *tm) ...@@ -993,7 +993,7 @@ int mf_get_rtc(struct rtc_time *tm)
int mf_set_rtc(struct rtc_time *tm) int mf_set_rtc(struct rtc_time *tm)
{ {
char ceTime[12] = "\x00\x00\x00\x41\x00\x00\x00\x00\x00\x00\x00\x00"; char ce_time[12] = "\x00\x00\x00\x41\x00\x00\x00\x00\x00\x00\x00\x00";
u8 day, mon, hour, min, sec, y1, y2; u8 day, mon, hour, min, sec, y1, y2;
unsigned year; unsigned year;
...@@ -1015,15 +1015,15 @@ int mf_set_rtc(struct rtc_time *tm) ...@@ -1015,15 +1015,15 @@ int mf_set_rtc(struct rtc_time *tm)
BIN_TO_BCD(y1); BIN_TO_BCD(y1);
BIN_TO_BCD(y2); BIN_TO_BCD(y2);
ceTime[4] = y1; ce_time[4] = y1;
ceTime[5] = y2; ce_time[5] = y2;
ceTime[6] = sec; ce_time[6] = sec;
ceTime[7] = min; ce_time[7] = min;
ceTime[8] = hour; ce_time[8] = hour;
ceTime[10] = day; ce_time[10] = day;
ceTime[11] = mon; ce_time[11] = mon;
return signal_ce_msg(ceTime, NULL); return signal_ce_msg(ce_time, NULL);
} }
static int proc_mf_dump_cmdline(char *page, char **start, off_t off, static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
......
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