Commit 3f833b54 authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: refactor ultra_segment_state

Rename the struct to spar_segment_state and fix CamelCase names:

Enabled => enabled
Active => active
Alive => alive
Revoked => revoked
Allocated => allocated
Known => known
Ready => ready
Operating => operating

Fix all references to modified names to use the new names.
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 10c5ef69
...@@ -36,31 +36,34 @@ ...@@ -36,31 +36,34 @@
/* Define Ki scale page to be traditional 4KB page */ /* Define Ki scale page to be traditional 4KB page */
#define ULTRA_MEMORY_PAGE_Ki (ULTRA_MEMORY_PAGE_WORD * ULTRA_MEMORY_COUNT_Ki) #define ULTRA_MEMORY_PAGE_Ki (ULTRA_MEMORY_PAGE_WORD * ULTRA_MEMORY_COUNT_Ki)
struct ultra_segment_state { struct spar_segment_state {
u16 Enabled:1; /* Bit 0: May enter other states */ u16 enabled:1; /* Bit 0: May enter other states */
u16 Active:1; /* Bit 1: Assigned to active partition */ u16 active:1; /* Bit 1: Assigned to active partition */
u16 Alive:1; /* Bit 2: Configure message sent to u16 alive:1; /* Bit 2: Configure message sent to
* service/server */ * service/server */
u16 Revoked:1; /* Bit 3: similar to partition state u16 revoked:1; /* Bit 3: similar to partition state
* ShuttingDown */ * ShuttingDown */
u16 Allocated:1; /* Bit 4: memory (device/port number) u16 allocated:1; /* Bit 4: memory (device/port number)
* has been selected by Command */ * has been selected by Command */
u16 Known:1; /* Bit 5: has been introduced to the u16 known:1; /* Bit 5: has been introduced to the
* service/guest partition */ * service/guest partition */
u16 Ready:1; /* Bit 6: service/Guest partition has u16 ready:1; /* Bit 6: service/Guest partition has
* responded to introduction */ * responded to introduction */
u16 Operating:1; /* Bit 7: resource is configured and u16 operating:1; /* Bit 7: resource is configured and
* operating */ * operating */
/* Note: don't use high bit unless we need to switch to ushort /* Note: don't use high bit unless we need to switch to ushort
* which is non-compliant */ * which is non-compliant */
}; };
static const struct ultra_segment_state SegmentStateRunning = {
static const struct spar_segment_state SegmentStateRunning = {
1, 1, 1, 0, 1, 1, 1, 1 1, 1, 1, 0, 1, 1, 1, 1
}; };
static const struct ultra_segment_state SegmentStatePaused = {
static const struct spar_segment_state SegmentStatePaused = {
1, 1, 1, 0, 1, 1, 1, 0 1, 1, 1, 0, 1, 1, 1, 0
}; };
static const struct ultra_segment_state SegmentStateStandby = {
static const struct spar_segment_state SegmentStateStandby = {
1, 1, 0, 0, 1, 1, 1, 0 1, 1, 0, 0, 1, 1, 1, 0
}; };
......
...@@ -389,13 +389,13 @@ typedef struct _CONTROLVM_MESSAGE_PACKET { ...@@ -389,13 +389,13 @@ typedef struct _CONTROLVM_MESSAGE_PACKET {
} reconfigureDevice; /* for CONTROLVM_DEVICE_RECONFIGURE */ } reconfigureDevice; /* for CONTROLVM_DEVICE_RECONFIGURE */
struct { struct {
u32 busNo; u32 busNo;
struct ultra_segment_state state; struct spar_segment_state state;
u8 reserved[2]; /* Natural alignment purposes */ u8 reserved[2]; /* Natural alignment purposes */
} busChangeState; /* for CONTROLVM_BUS_CHANGESTATE */ } busChangeState; /* for CONTROLVM_BUS_CHANGESTATE */
struct { struct {
u32 busNo; u32 busNo;
u32 devNo; u32 devNo;
struct ultra_segment_state state; struct spar_segment_state state;
struct { struct {
u32 physicalDevice:1; /* =1 if message is for u32 physicalDevice:1; /* =1 if message is for
* a physical device */ * a physical device */
...@@ -406,7 +406,7 @@ typedef struct _CONTROLVM_MESSAGE_PACKET { ...@@ -406,7 +406,7 @@ typedef struct _CONTROLVM_MESSAGE_PACKET {
struct { struct {
u32 busNo; u32 busNo;
u32 devNo; u32 devNo;
struct ultra_segment_state state; struct spar_segment_state state;
u8 reserved[6]; /* Natural alignment purposes */ u8 reserved[6]; /* Natural alignment purposes */
} deviceChangeStateEvent; /* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */ } deviceChangeStateEvent; /* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */
struct { struct {
......
...@@ -348,9 +348,8 @@ static void controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response); ...@@ -348,9 +348,8 @@ static void controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response);
static void controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, static void controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr,
int response, int response,
ULTRA_CHIPSET_FEATURE features); ULTRA_CHIPSET_FEATURE features);
static void controlvm_respond_physdev_changestate( static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *
CONTROLVM_MESSAGE_HEADER *msgHdr, int response, msgHdr, int response, struct spar_segment_state state);
struct ultra_segment_state state);
static ssize_t toolaction_show(struct device *dev, static ssize_t toolaction_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -743,8 +742,7 @@ controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response, ...@@ -743,8 +742,7 @@ controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response,
static void static void
controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *msgHdr, controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *msgHdr,
int response, struct ultra_segment_state int response, struct spar_segment_state state)
state)
{ {
CONTROLVM_MESSAGE outmsg; CONTROLVM_MESSAGE outmsg;
...@@ -860,7 +858,7 @@ bus_responder(enum control_vm_id cmdId, ulong busNo, int response) ...@@ -860,7 +858,7 @@ bus_responder(enum control_vm_id cmdId, ulong busNo, int response)
static void static void
device_changestate_responder(enum control_vm_id cmdId, device_changestate_responder(enum control_vm_id cmdId,
ulong busNo, ulong devNo, int response, ulong busNo, ulong devNo, int response,
struct ultra_segment_state responseState) struct spar_segment_state responseState)
{ {
VISORCHIPSET_DEVICE_INFO *p = NULL; VISORCHIPSET_DEVICE_INFO *p = NULL;
CONTROLVM_MESSAGE outmsg; CONTROLVM_MESSAGE outmsg;
...@@ -994,7 +992,7 @@ bus_epilog(u32 busNo, ...@@ -994,7 +992,7 @@ bus_epilog(u32 busNo,
} }
static void static void
device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd, device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
CONTROLVM_MESSAGE_HEADER *msgHdr, int response, CONTROLVM_MESSAGE_HEADER *msgHdr, int response,
BOOL needResponse, BOOL for_visorbus) BOOL needResponse, BOOL for_visorbus)
{ {
...@@ -1033,8 +1031,8 @@ device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd, ...@@ -1033,8 +1031,8 @@ device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd,
break; break;
case CONTROLVM_DEVICE_CHANGESTATE: case CONTROLVM_DEVICE_CHANGESTATE:
/* ServerReady / ServerRunning / SegmentStateRunning */ /* ServerReady / ServerRunning / SegmentStateRunning */
if (state.Alive == SegmentStateRunning.Alive && if (state.alive == SegmentStateRunning.alive &&
state.Operating == SegmentStateRunning.Operating) { state.operating == SegmentStateRunning.operating) {
if (notifiers->device_resume) { if (notifiers->device_resume) {
(*notifiers->device_resume) (busNo, (*notifiers->device_resume) (busNo,
devNo); devNo);
...@@ -1042,9 +1040,9 @@ device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd, ...@@ -1042,9 +1040,9 @@ device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd,
} }
} }
/* ServerNotReady / ServerLost / SegmentStateStandby */ /* ServerNotReady / ServerLost / SegmentStateStandby */
else if (state.Alive == SegmentStateStandby.Alive && else if (state.alive == SegmentStateStandby.alive &&
state.Operating == state.operating ==
SegmentStateStandby.Operating) { SegmentStateStandby.operating) {
/* technically this is standby case /* technically this is standby case
* where server is lost * where server is lost
*/ */
...@@ -1053,9 +1051,9 @@ device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd, ...@@ -1053,9 +1051,9 @@ device_epilog(u32 busNo, u32 devNo, struct ultra_segment_state state, u32 cmd,
devNo); devNo);
notified = TRUE; notified = TRUE;
} }
} else if (state.Alive == SegmentStatePaused.Alive && } else if (state.alive == SegmentStatePaused.alive &&
state.Operating == state.operating ==
SegmentStatePaused.Operating) { SegmentStatePaused.operating) {
/* this is lite pause where channel is /* this is lite pause where channel is
* still valid just 'pause' of it * still valid just 'pause' of it
*/ */
...@@ -1306,7 +1304,7 @@ my_device_changestate(CONTROLVM_MESSAGE *inmsg) ...@@ -1306,7 +1304,7 @@ my_device_changestate(CONTROLVM_MESSAGE *inmsg)
CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd;
ulong busNo = cmd->deviceChangeState.busNo; ulong busNo = cmd->deviceChangeState.busNo;
ulong devNo = cmd->deviceChangeState.devNo; ulong devNo = cmd->deviceChangeState.devNo;
struct ultra_segment_state state = cmd->deviceChangeState.state; struct spar_segment_state state = cmd->deviceChangeState.state;
VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS; int rc = CONTROLVM_RESP_SUCCESS;
...@@ -1631,7 +1629,7 @@ parahotplug_request_kickoff(struct parahotplug_request *req) ...@@ -1631,7 +1629,7 @@ parahotplug_request_kickoff(struct parahotplug_request *req)
sprintf(env_cmd, "SPAR_PARAHOTPLUG=1"); sprintf(env_cmd, "SPAR_PARAHOTPLUG=1");
sprintf(env_id, "SPAR_PARAHOTPLUG_ID=%d", req->id); sprintf(env_id, "SPAR_PARAHOTPLUG_ID=%d", req->id);
sprintf(env_state, "SPAR_PARAHOTPLUG_STATE=%d", sprintf(env_state, "SPAR_PARAHOTPLUG_STATE=%d",
cmd->deviceChangeState.state.Active); cmd->deviceChangeState.state.active);
sprintf(env_bus, "SPAR_PARAHOTPLUG_BUS=%d", sprintf(env_bus, "SPAR_PARAHOTPLUG_BUS=%d",
cmd->deviceChangeState.busNo); cmd->deviceChangeState.busNo);
sprintf(env_dev, "SPAR_PARAHOTPLUG_DEVICE=%d", sprintf(env_dev, "SPAR_PARAHOTPLUG_DEVICE=%d",
...@@ -1640,7 +1638,7 @@ parahotplug_request_kickoff(struct parahotplug_request *req) ...@@ -1640,7 +1638,7 @@ parahotplug_request_kickoff(struct parahotplug_request *req)
cmd->deviceChangeState.devNo & 0x7); cmd->deviceChangeState.devNo & 0x7);
LOGINF("parahotplug_request_kickoff: state=%d, bdf=%d/%d/%d, id=%u\n", LOGINF("parahotplug_request_kickoff: state=%d, bdf=%d/%d/%d, id=%u\n",
cmd->deviceChangeState.state.Active, cmd->deviceChangeState.state.active,
cmd->deviceChangeState.busNo, cmd->deviceChangeState.devNo >> 3, cmd->deviceChangeState.busNo, cmd->deviceChangeState.devNo >> 3,
cmd->deviceChangeState.devNo & 7, req->id); cmd->deviceChangeState.devNo & 7, req->id);
...@@ -1700,7 +1698,7 @@ parahotplug_request_complete(int id, u16 active) ...@@ -1700,7 +1698,7 @@ parahotplug_request_complete(int id, u16 active)
*/ */
list_del(pos); list_del(pos);
spin_unlock(&Parahotplug_request_list_lock); spin_unlock(&Parahotplug_request_list_lock);
req->msg.cmd.deviceChangeState.state.Active = active; req->msg.cmd.deviceChangeState.state.active = active;
if (req->msg.hdr.Flags.responseExpected) if (req->msg.hdr.Flags.responseExpected)
controlvm_respond_physdev_changestate( controlvm_respond_physdev_changestate(
&req->msg.hdr, CONTROLVM_RESP_SUCCESS, &req->msg.hdr, CONTROLVM_RESP_SUCCESS,
...@@ -1729,7 +1727,7 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg) ...@@ -1729,7 +1727,7 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg)
return; return;
} }
if (inmsg->cmd.deviceChangeState.state.Active) { if (inmsg->cmd.deviceChangeState.state.active) {
/* For enable messages, just respond with success /* For enable messages, just respond with success
* right away. This is a bit of a hack, but there are * right away. This is a bit of a hack, but there are
* issues with the early enable messages we get (with * issues with the early enable messages we get (with
...@@ -1853,13 +1851,13 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1853,13 +1851,13 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
LOGINF("DEVICE_CHANGESTATE for physical device (%lu,%lu, active=%lu)", LOGINF("DEVICE_CHANGESTATE for physical device (%lu,%lu, active=%lu)",
(ulong) cmd->deviceChangeState.busNo, (ulong) cmd->deviceChangeState.busNo,
(ulong) cmd->deviceChangeState.devNo, (ulong) cmd->deviceChangeState.devNo,
(ulong) cmd->deviceChangeState.state.Active); (ulong) cmd->deviceChangeState.state.active);
parahotplug_process_message(&inmsg); parahotplug_process_message(&inmsg);
} else { } else {
LOGINF("DEVICE_CHANGESTATE for virtual device (%lu,%lu, state.Alive=0x%lx)", LOGINF("DEVICE_CHANGESTATE for virtual device (%lu,%lu, state.Alive=0x%lx)",
(ulong) cmd->deviceChangeState.busNo, (ulong) cmd->deviceChangeState.busNo,
(ulong) cmd->deviceChangeState.devNo, (ulong) cmd->deviceChangeState.devNo,
(ulong) cmd->deviceChangeState.state.Alive); (ulong) cmd->deviceChangeState.state.alive);
/* save the hdr and cmd structures for later use */ /* save the hdr and cmd structures for later use */
/* when sending back the response to Command */ /* when sending back the response to Command */
my_device_changestate(&inmsg); my_device_changestate(&inmsg);
......
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