Commit 5bf74b44 authored by Sameer Wadgaonkar's avatar Sameer Wadgaonkar Committed by Greg Kroah-Hartman

staging: unisys: include: channel.h: fixed comment formatting issues

Removed comments from the right side of the lines.

Added kernel-doc like comments and cleaned up the inline comments in the
structures.
Signed-off-by: default avatarSameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ac0aba67
/* Copyright (C) 2010 - 2013 UNISYS CORPORATION /*
* Copyright (C) 2010 - 2013 UNISYS CORPORATION
* All rights reserved. * All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -34,52 +35,61 @@ ...@@ -34,52 +35,61 @@
#define VISOR_CHANNEL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L') #define VISOR_CHANNEL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L')
/*
* enum channel_serverstate
* @CHANNELSRV_UNINITIALIZED: Channel is in an undefined state.
* @CHANNELSRV_READY: Channel has been initialized by server.
*/
enum channel_serverstate { enum channel_serverstate {
CHANNELSRV_UNINITIALIZED = 0, /* channel is in an undefined state */ CHANNELSRV_UNINITIALIZED = 0,
CHANNELSRV_READY = 1 /* channel has been initialized by server */ CHANNELSRV_READY = 1
}; };
/*
* enum channel_clientstate
* @CHANNELCLI_DETACHED:
* @CHANNELCLI_DISABLED: Client can see channel but is NOT allowed to use it
* unless given TBD* explicit request
* (should actually be < DETACHED).
* @CHANNELCLI_ATTACHING: Legacy EFI client request for EFI server to attach.
* @CHANNELCLI_ATTACHED: Idle, but client may want to use channel any time.
* @CHANNELCLI_BUSY: Client either wants to use or is using channel.
* @CHANNELCLI_OWNED: "No worries" state - client can access channel
* anytime.
*/
enum channel_clientstate { enum channel_clientstate {
CHANNELCLI_DETACHED = 0, CHANNELCLI_DETACHED = 0,
CHANNELCLI_DISABLED = 1, /* client can see channel but is NOT CHANNELCLI_DISABLED = 1,
* allowed to use it unless given TBD CHANNELCLI_ATTACHING = 2,
* explicit request (should actually be CHANNELCLI_ATTACHED = 3,
* < DETACHED) CHANNELCLI_BUSY = 4,
*/ CHANNELCLI_OWNED = 5
CHANNELCLI_ATTACHING = 2, /* legacy EFI client request
* for EFI server to attach
*/
CHANNELCLI_ATTACHED = 3, /* idle, but client may want
* to use channel any time
*/
CHANNELCLI_BUSY = 4, /* client either wants to use or is
* using channel
*/
CHANNELCLI_OWNED = 5 /* "no worries" state - client can */
/* access channel anytime */
}; };
/* Values for VISORA_CHANNEL_PROTOCOL.CliErrorBoot: */ /* Values for VISORA_CHANNEL_PROTOCOL.CliErrorBoot: */
/* throttling invalid boot channel statetransition error due to client
* disabled /*
* Throttling invalid boot channel statetransition error due to client
* disabled.
*/ */
#define VISOR_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01 #define VISOR_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01
/* throttling invalid boot channel statetransition error due to client /*
* not attached * Throttling invalid boot channel statetransition error due to client
* not attached.
*/ */
#define VISOR_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02 #define VISOR_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02
/* throttling invalid boot channel statetransition error due to busy channel */ /* Throttling invalid boot channel statetransition error due to busy channel */
#define VISOR_CLIERRORBOOT_THROTTLEMSG_BUSY 0x04 #define VISOR_CLIERRORBOOT_THROTTLEMSG_BUSY 0x04
/* Values for VISOR_CHANNEL_PROTOCOL.Features: This define exists so /*
* that windows guest can look at the FeatureFlags in the io channel, * Values for VISOR_CHANNEL_PROTOCOL.Features: This define exists so that
* and configure the windows driver to use interrupts or not based on * windows guest can look at the FeatureFlags in the io channel, and configure
* this setting. This flag is set in uislib after the * the windows driver to use interrupts or not based on this setting. This flag
* VISOR_VHBA_init_channel is called. All feature bits for all * is set in uislib after the VISOR_VHBA_init_channel is called. All feature
* channels should be defined here. The io channel feature bits are * bits for all channels should be defined here. The io channel feature bits
* defined right here * are defined right here
*/ */
#define VISOR_DRIVER_ENABLES_INTS (0x1ULL << 1) #define VISOR_DRIVER_ENABLES_INTS (0x1ULL << 1)
#define VISOR_CHANNEL_IS_POLLING (0x1ULL << 3) #define VISOR_CHANNEL_IS_POLLING (0x1ULL << 3)
...@@ -87,97 +97,121 @@ enum channel_clientstate { ...@@ -87,97 +97,121 @@ enum channel_clientstate {
#define VISOR_DRIVER_DISABLES_INTS (0x1ULL << 5) #define VISOR_DRIVER_DISABLES_INTS (0x1ULL << 5)
#define VISOR_DRIVER_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6) #define VISOR_DRIVER_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6)
/* Common Channel Header */ /*
* struct channel_header - Common Channel Header
* @signature: Signature.
* @legacy_state: DEPRECATED - being replaced by.
* @header_size: sizeof(struct channel_header).
* @size: Total size of this channel in bytes.
* @features: Flags to modify behavior.
* @chtype: Channel type: data, bus, control, etc..
* @partition_handle: ID of guest partition.
* @handle: Device number of this channel in client.
* @ch_space_offset: Offset in bytes to channel specific area.
* @version_id: Struct channel_header Version ID.
* @partition_index: Index of guest partition.
* @zone_uuid: Guid of Channel's zone.
* @cli_str_offset: Offset from channel header to null-terminated
* ClientString (0 if ClientString not present).
* @cli_state_boot: CHANNEL_CLIENTSTATE of pre-boot EFI client of this
* channel.
* @cmd_state_cli: CHANNEL_COMMANDSTATE (overloaded in Windows drivers, see
* ServerStateUp, ServerStateDown, etc).
* @cli_state_os: CHANNEL_CLIENTSTATE of Guest OS client of this channel.
* @ch_characteristic: CHANNEL_CHARACTERISTIC_<xxx>.
* @cmd_state_srv: CHANNEL_COMMANDSTATE (overloaded in Windows drivers, see
* ServerStateUp, ServerStateDown, etc).
* @srv_state: CHANNEL_SERVERSTATE.
* @cli_error_boot: Bits to indicate err states for boot clients, so err
* messages can be throttled.
* @cli_error_os: Bits to indicate err states for OS clients, so err
* messages can be throttled.
* @filler: Pad out to 128 byte cacheline.
* @recover_channel: Please add all new single-byte values below here.
*/
struct channel_header { struct channel_header {
u64 signature; /* Signature */ u64 signature;
u32 legacy_state; /* DEPRECATED - being replaced by */ u32 legacy_state;
/* SrvState, CliStateBoot, and CliStateOS below */ /* SrvState, CliStateBoot, and CliStateOS below */
u32 header_size; /* sizeof(struct channel_header) */ u32 header_size;
u64 size; /* Total size of this channel in bytes */ u64 size;
u64 features; /* Flags to modify behavior */ u64 features;
uuid_le chtype; /* Channel type: data, bus, control, etc. */ uuid_le chtype;
u64 partition_handle; /* ID of guest partition */ u64 partition_handle;
u64 handle; /* Device number of this channel in client */ u64 handle;
u64 ch_space_offset; /* Offset in bytes to channel specific area */ u64 ch_space_offset;
u32 version_id; /* struct channel_header Version ID */ u32 version_id;
u32 partition_index; /* Index of guest partition */ u32 partition_index;
uuid_le zone_uuid; /* Guid of Channel's zone */ uuid_le zone_uuid;
u32 cli_str_offset; /* offset from channel header to u32 cli_str_offset;
* nul-terminated ClientString (0 if u32 cli_state_boot;
* ClientString not present) u32 cmd_state_cli;
*/ u32 cli_state_os;
u32 cli_state_boot; /* CHANNEL_CLIENTSTATE of pre-boot u32 ch_characteristic;
* EFI client of this channel u32 cmd_state_srv;
*/ u32 srv_state;
u32 cmd_state_cli; /* CHANNEL_COMMANDSTATE (overloaded in u8 cli_error_boot;
* Windows drivers, see ServerStateUp, u8 cli_error_os;
* ServerStateDown, etc) u8 filler[1];
*/
u32 cli_state_os; /* CHANNEL_CLIENTSTATE of Guest OS
* client of this channel
*/
u32 ch_characteristic; /* CHANNEL_CHARACTERISTIC_<xxx> */
u32 cmd_state_srv; /* CHANNEL_COMMANDSTATE (overloaded in
* Windows drivers, see ServerStateUp,
* ServerStateDown, etc)
*/
u32 srv_state; /* CHANNEL_SERVERSTATE */
u8 cli_error_boot; /* bits to indicate err states for
* boot clients, so err messages can
* be throttled
*/
u8 cli_error_os; /* bits to indicate err states for OS
* clients, so err messages can be
* throttled
*/
u8 filler[1]; /* Pad out to 128 byte cacheline */
/* Please add all new single-byte values below here */
u8 recover_channel; u8 recover_channel;
} __packed; } __packed;
#define VISOR_CHANNEL_ENABLE_INTS (0x1ULL << 0) #define VISOR_CHANNEL_ENABLE_INTS (0x1ULL << 0)
/* Subheader for the Signal Type variation of the Common Channel */ /*
* struct signal_queue_header - Subheader for the Signal Type variation of the
* Common Channel.
* @version: SIGNAL_QUEUE_HEADER Version ID.
* @chtype: Queue type: storage, network.
* @size: Total size of this queue in bytes.
* @sig_base_offset: Offset to signal queue area.
* @features: Flags to modify behavior.
* @num_sent: Total # of signals placed in this queue.
* @num_overflows: Total # of inserts failed due to full queue.
* @signal_size: Total size of a signal for this queue.
* @max_slots: Max # of slots in queue, 1 slot is always empty.
* @max_signals: Max # of signals in queue (MaxSignalSlots-1).
* @head: Queue head signal #.
* @num_received: Total # of signals removed from this queue.
* @tail: Queue tail signal.
* @reserved1: Reserved field.
* @reserved2: Reserved field.
* @client_queue:
* @num_irq_received: Total # of Interrupts received. This is incremented by the
* ISR in the guest windows driver.
* @num_empty: Number of times that visor_signal_remove is called and
* returned Empty Status.
* @errorflags: Error bits set during SignalReinit to denote trouble with
* client's fields.
* @filler: Pad out to 64 byte cacheline.
*/
struct signal_queue_header { struct signal_queue_header {
/* 1st cache line */ /* 1st cache line */
u32 version; /* SIGNAL_QUEUE_HEADER Version ID */ u32 version;
u32 chtype; /* Queue type: storage, network */ u32 chtype;
u64 size; /* Total size of this queue in bytes */ u64 size;
u64 sig_base_offset; /* Offset to signal queue area */ u64 sig_base_offset;
u64 features; /* Flags to modify behavior */ u64 features;
u64 num_sent; /* Total # of signals placed in this queue */ u64 num_sent;
u64 num_overflows; /* Total # of inserts failed due to u64 num_overflows;
* full queue u32 signal_size;
*/ u32 max_slots;
u32 signal_size; /* Total size of a signal for this queue */ u32 max_signals;
u32 max_slots; /* Max # of slots in queue, 1 slot is u32 head;
* always empty
*/
u32 max_signals; /* Max # of signals in queue
* (MaxSignalSlots-1)
*/
u32 head; /* Queue head signal # */
/* 2nd cache line */ /* 2nd cache line */
u64 num_received; /* Total # of signals removed from this queue */ u64 num_received;
u32 tail; /* Queue tail signal */ u32 tail;
u32 reserved1; /* Reserved field */ u32 reserved1;
u64 reserved2; /* Reserved field */ u64 reserved2;
u64 client_queue; u64 client_queue;
u64 num_irq_received; /* Total # of Interrupts received. This u64 num_irq_received;
* is incremented by the ISR in the u64 num_empty;
* guest windows driver u32 errorflags;
*/ u8 filler[12];
u64 num_empty; /* Number of times that visor_signal_remove
* is called and returned Empty Status.
*/
u32 errorflags; /* Error bits set during SignalReinit
* to denote trouble with client's
* fields
*/
u8 filler[12]; /* Pad out to 64 byte cacheline */
} __packed; } __packed;
/* Generic function useful for validating any type of channel when it is /*
* Generic function useful for validating any type of channel when it is
* received by the client that will be accessing the channel. * received by the client that will be accessing the channel.
* Note that <logCtx> is only needed for callers in the EFI environment, and * Note that <logCtx> is only needed for callers in the EFI environment, and
* is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
...@@ -199,7 +233,8 @@ visor_check_channel(struct channel_header *ch, ...@@ -199,7 +233,8 @@ visor_check_channel(struct channel_header *ch,
return 0; return 0;
} }
} }
if (expected_min_bytes > 0) { /* verify channel size */ /* verify channel size */
if (expected_min_bytes > 0) {
if (ch->size < expected_min_bytes) { if (ch->size < expected_min_bytes) {
pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
chname, &expected_uuid, chname, &expected_uuid,
...@@ -208,7 +243,8 @@ visor_check_channel(struct channel_header *ch, ...@@ -208,7 +243,8 @@ visor_check_channel(struct channel_header *ch,
return 0; return 0;
} }
} }
if (expected_version > 0) { /* verify channel version */ /* verify channel version */
if (expected_version > 0) {
if (ch->version_id != expected_version) { if (ch->version_id != expected_version) {
pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n", pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n",
chname, &expected_uuid, chname, &expected_uuid,
...@@ -217,7 +253,8 @@ visor_check_channel(struct channel_header *ch, ...@@ -217,7 +253,8 @@ visor_check_channel(struct channel_header *ch,
return 0; return 0;
} }
} }
if (expected_signature > 0) { /* verify channel signature */ /* verify channel signature */
if (expected_signature > 0) {
if (ch->signature != expected_signature) { if (ch->signature != expected_signature) {
pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n", pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
chname, &expected_uuid, chname, &expected_uuid,
......
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