From 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 25 Mar 2016 03:53:42 -0300 Subject: Linux-libre 4.5-gnu --- drivers/staging/unisys/include/channel.h | 114 +++++++++++--------- drivers/staging/unisys/include/iochannel.h | 157 ++++++++++++---------------- drivers/staging/unisys/include/vbushelper.h | 3 +- drivers/staging/unisys/include/visorbus.h | 4 +- 4 files changed, 135 insertions(+), 143 deletions(-) (limited to 'drivers/staging/unisys/include') diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index c6c24423a..5af59a5fc 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -60,15 +60,19 @@ enum channel_clientstate { CHANNELCLI_DISABLED = 1, /* client can see channel but is NOT * allowed to use it unless given TBD * explicit request (should actually be - * < DETACHED) */ + * < DETACHED) + */ CHANNELCLI_ATTACHING = 2, /* legacy EFI client request - * for EFI server to attach */ + * for EFI server to attach + */ CHANNELCLI_ATTACHED = 3, /* idle, but client may want - * to use channel any time */ + * 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 */ + * using channel + */ + CHANNELCLI_OWNED = 5 /* "no worries" state - client can */ + /* access channel anytime */ }; static inline const u8 * @@ -116,11 +120,13 @@ ULTRA_CHANNELCLI_STRING(u32 v) /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */ /* throttling invalid boot channel statetransition error due to client - * disabled */ + * disabled + */ #define ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01 /* throttling invalid boot channel statetransition error due to client - * not attached */ + * not attached + */ #define ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02 /* throttling invalid boot channel statetransition error due to busy channel */ @@ -128,24 +134,28 @@ ULTRA_CHANNELCLI_STRING(u32 v) /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorOS: */ /* throttling invalid guest OS channel statetransition error due to - * client disabled */ + * client disabled + */ #define ULTRA_CLIERROROS_THROTTLEMSG_DISABLED 0x01 /* throttling invalid guest OS channel statetransition error due to - * client not attached */ + * client not attached + */ #define ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED 0x02 /* throttling invalid guest OS channel statetransition error due to - * busy channel */ + * busy channel + */ #define ULTRA_CLIERROROS_THROTTLEMSG_BUSY 0x04 /* Values for ULTRA_CHANNEL_PROTOCOL.Features: This define exists so -* that windows guest can look at the FeatureFlags in the io channel, -* and configure the windows driver to use interrupts or not based on -* this setting. This flag is set in uislib after the -* ULTRA_VHBA_init_channel is called. All feature bits for all -* channels should be defined here. The io channel feature bits are -* defined right here */ + * that windows guest can look at the FeatureFlags in the io channel, + * and configure the windows driver to use interrupts or not based on + * this setting. This flag is set in uislib after the + * ULTRA_VHBA_init_channel is called. All feature bits for all + * channels should be defined here. The io channel feature bits are + * defined right here + */ #define ULTRA_IO_DRIVER_ENABLES_INTS (0x1ULL << 1) #define ULTRA_IO_CHANNEL_IS_POLLING (0x1ULL << 3) #define ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS (0x1ULL << 4) @@ -156,7 +166,7 @@ ULTRA_CHANNELCLI_STRING(u32 v) struct channel_header { u64 signature; /* Signature */ u32 legacy_state; /* DEPRECATED - being replaced by */ - /* / SrvState, CliStateBoot, and CliStateOS below */ + /* SrvState, CliStateBoot, and CliStateOS below */ u32 header_size; /* sizeof(struct channel_header) */ u64 size; /* Total size of this channel in bytes */ u64 features; /* Flags to modify behavior */ @@ -169,25 +179,32 @@ struct channel_header { uuid_le zone_uuid; /* Guid of Channel's zone */ u32 cli_str_offset; /* offset from channel header to * nul-terminated ClientString (0 if - * ClientString not present) */ + * ClientString not present) + */ u32 cli_state_boot; /* CHANNEL_CLIENTSTATE of pre-boot - * EFI client of this channel */ + * EFI client of this channel + */ u32 cmd_state_cli; /* CHANNEL_COMMANDSTATE (overloaded in * Windows drivers, see ServerStateUp, - * ServerStateDown, etc) */ + * ServerStateDown, etc) + */ u32 cli_state_os; /* CHANNEL_CLIENTSTATE of Guest OS - * client of this channel */ + * client of this channel + */ u32 ch_characteristic; /* CHANNEL_CHARACTERISTIC_ */ u32 cmd_state_srv; /* CHANNEL_COMMANDSTATE (overloaded in * Windows drivers, see ServerStateUp, - * ServerStateDown, etc) */ + * 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 */ + * be throttled + */ u8 cli_error_os; /* bits to indicate err states for OS * clients, so err messages can be - * throttled */ + * throttled + */ u8 filler[1]; /* Pad out to 128 byte cacheline */ /* Please add all new single-byte values below here */ u8 recover_channel; @@ -205,29 +222,33 @@ struct signal_queue_header { u64 features; /* Flags to modify behavior */ u64 num_sent; /* Total # of signals placed in this queue */ u64 num_overflows; /* Total # of inserts failed due to - * full queue */ + * full queue + */ u32 signal_size; /* Total size of a signal for this queue */ u32 max_slots; /* Max # of slots in queue, 1 slot is - * always empty */ + * always empty + */ u32 max_signals; /* Max # of signals in queue - * (MaxSignalSlots-1) */ + * (MaxSignalSlots-1) + */ u32 head; /* Queue head signal # */ /* 2nd cache line */ u64 num_received; /* Total # of signals removed from this queue */ - u32 tail; /* Queue tail signal # (on separate - * cache line) */ + u32 tail; /* Queue tail signal */ u32 reserved1; /* Reserved field */ u64 reserved2; /* Reserved field */ u64 client_queue; u64 num_irq_received; /* Total # of Interrupts received. This - * is incremented by the ISR in the - * guest windows driver */ + * is incremented by the ISR in the + * guest windows driver + */ u64 num_empty; /* Number of times that visor_signal_remove - * is called and returned Empty - * Status. */ + * is called and returned Empty Status. + */ u32 errorflags; /* Error bits set during SignalReinit * to denote trouble with client's - * fields */ + * fields + */ u8 filler[12]; /* Pad out to 64 byte cacheline */ } __packed; @@ -272,8 +293,7 @@ spar_check_channel_client(void __iomem *ch, return 0; } } - if (expected_min_bytes > 0) { /* caller wants us to verify - * channel size */ + if (expected_min_bytes > 0) { /* verify channel size */ unsigned long long bytes = readq(&((struct channel_header __iomem *) (ch))->size); @@ -284,8 +304,7 @@ spar_check_channel_client(void __iomem *ch, return 0; } } - if (expected_version > 0) { /* caller wants us to verify - * channel version */ + if (expected_version > 0) { /* verify channel version */ unsigned long ver = readl(&((struct channel_header __iomem *) (ch))->version_id); if (ver != expected_version) { @@ -295,8 +314,7 @@ spar_check_channel_client(void __iomem *ch, return 0; } } - if (expected_signature > 0) { /* caller wants us to verify - * channel signature */ + if (expected_signature > 0) { /* verify channel signature */ unsigned long long sig = readq(&((struct channel_header __iomem *) (ch))->signature); @@ -319,8 +337,7 @@ static inline int spar_check_channel_server(uuid_le typeuuid, char *name, u64 expected_min_bytes, u64 actual_bytes) { - if (expected_min_bytes > 0) /* caller wants us to verify - * channel size */ + if (expected_min_bytes > 0) /* verify channel size */ if (actual_bytes < expected_min_bytes) { pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8llx actual=0x%-8.8llx\n", name, &typeuuid, expected_min_bytes, @@ -354,7 +371,8 @@ pathname_last_n_nodes(u8 *s, unsigned int n) if (p == s) break; /* should never happen, unless someone * is changing the string while we are - * looking at it!! */ + * looking at it!! + */ if ((*p == '/') || (*p == '\\')) n--; } @@ -395,7 +413,8 @@ spar_channel_client_acquire_os(void __iomem *ch, u8 *id) if (readl(&hdr->cli_state_os) == CHANNELCLI_OWNED) { if (readb(&hdr->cli_error_os) != 0) { /* we are in an error msg throttling state; - * come out of it */ + * come out of it + */ pr_info("%s Channel OS client acquire now successful\n", id); writeb(0, &hdr->cli_error_os); @@ -404,8 +423,9 @@ spar_channel_client_acquire_os(void __iomem *ch, u8 *id) } /* We have to do it the "hard way". We transition to BUSY, - * and can use the channel iff our competitor has not also - * transitioned to BUSY. */ + * and can use the channel iff our competitor has not also + * transitioned to BUSY. + */ if (readl(&hdr->cli_state_os) != CHANNELCLI_ATTACHED) { if ((readb(&hdr->cli_error_os) & ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) == 0) { diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 14e656ff7..162ca187a 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -6,7 +6,8 @@ /* * Everything needed for IOPart-GuestPart communication is define in * this file. Note: Everything is OS-independent because this file is - * used by Windows, Linux and possible EFI drivers. */ + * used by Windows, Linux and possible EFI drivers. + */ /* * Communication flow between the IOPart and GuestPart uses the channel headers @@ -66,21 +67,15 @@ * IO Partition is defined below. */ -/* - * Defines and enums. - */ - +/* Defines and enums. */ #define MINNUM(a, b) (((a) < (b)) ? (a) : (b)) #define MAXNUM(a, b) (((a) > (b)) ? (a) : (b)) -/* these define the two queues per data channel between iopart and - * ioguestparts - */ -#define IOCHAN_TO_IOPART 0 /* used by ioguestpart to 'insert' signals to - * iopart */ - -#define IOCHAN_FROM_IOPART 1 /* used by ioguestpart to 'remove' signals from - * iopart - same queue as previous queue */ +/* define the two queues per data channel between iopart and ioguestparts */ +/* used by ioguestpart to 'insert' signals to iopart */ +#define IOCHAN_TO_IOPART 0 +/* used by ioguestpart to 'remove' signals from iopart, same previous queue */ +#define IOCHAN_FROM_IOPART 1 /* size of cdb - i.e., scsi cmnd */ #define MAX_CMND_SIZE 16 @@ -92,26 +87,29 @@ /* various types of network packets that can be sent in cmdrsp */ enum net_types { NET_RCV_POST = 0, /* submit buffer to hold receiving - * incoming packet */ + * incoming packet + */ /* virtnic -> uisnic */ NET_RCV, /* incoming packet received */ /* uisnic -> virtpci */ - NET_XMIT, /* for outgoing net packets */ + NET_XMIT, /* for outgoing net packets */ /* virtnic -> uisnic */ NET_XMIT_DONE, /* outgoing packet xmitted */ /* uisnic -> virtpci */ NET_RCV_ENBDIS, /* enable/disable packet reception */ /* virtnic -> uisnic */ - NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet - * reception */ + NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet */ + /* reception */ /* uisnic -> virtnic */ NET_RCV_PROMISC, /* enable/disable promiscuous mode */ /* virtnic -> uisnic */ NET_CONNECT_STATUS, /* indicate the loss or restoration of a network - * connection */ + * connection + */ /* uisnic -> virtnic */ NET_MACADDR, /* indicates the client has requested to update - * its MAC addr */ + * its MAC addr + */ NET_MACADDR_ACK, /* MAC address */ }; @@ -170,51 +168,43 @@ struct vhba_wwnn { } __packed; /* WARNING: Values stired in this structure must contain maximum counts (not - * maximum values). */ -struct vhba_config_max { /* 20 bytes */ - u32 max_channel; /* maximum channel for devices attached to this - * bus */ - u32 max_id; /* maximum SCSI ID for devices attached to this - * bus */ - u32 max_lun; /* maximum SCSI LUN for devices attached to this - * bus */ - u32 cmd_per_lun; /* maximum number of outstanding commands per - * lun that are allowed at one time */ - u32 max_io_size; /* maximum io size for devices attached to this - * bus */ + * maximum values). + */ +struct vhba_config_max {/* 20 bytes */ + u32 max_channel;/* maximum channel for devices attached to this bus */ + u32 max_id; /* maximum SCSI ID for devices attached to bus */ + u32 max_lun; /* maximum SCSI LUN for devices attached to bus */ + u32 cmd_per_lun;/* maximum number of outstanding commands per LUN */ + u32 max_io_size;/* maximum io size for devices attached to this bus */ /* max io size is often determined by the resource of the hba. e.g */ /* max scatter gather list length * page size / sector size */ } __packed; struct uiscmdrsp_scsi { - u64 handle; /* the handle to the cmd that was received - - * send it back as is in the rsp packet. */ + u64 handle; /* the handle to the cmd that was received */ + /* send it back as is in the rsp packet. */ u8 cmnd[MAX_CMND_SIZE]; /* the cdb for the command */ u32 bufflen; /* length of data to be transferred out or in */ - u16 guest_phys_entries; /* Number of entries in scatter-gather (sg) - * list */ + u16 guest_phys_entries; /* Number of entries in scatter-gather list */ struct guest_phys_info gpi_list[MAX_PHYS_INFO]; /* physical address * information for each - * fragment */ + * fragment + */ enum dma_data_direction data_dir; /* direction of the data, if any */ - struct uisscsi_dest vdest; /* identifies the virtual hba, id, - * channel, lun to which cmd was sent */ + struct uisscsi_dest vdest; /* identifies the virtual hba, id, */ + /* channel, lun to which cmd was sent */ - /* the following fields are needed to queue the rsp back to cmd - * originator */ - int linuxstat; /* the original Linux status - for use by linux - * vdisk code */ + /* Needed to queue the rsp back to cmd originator */ + int linuxstat; /* original Linux status used by linux vdisk */ u8 scsistat; /* the scsi status */ - u8 addlstat; /* non-scsi status - covers cases like timeout - * needed by windows guests */ + u8 addlstat; /* non-scsi status */ #define ADDL_SEL_TIMEOUT 4 /* the following fields are need to determine the result of command */ u8 sensebuf[MAX_SENSE_SIZE]; /* sense info in case cmd failed; */ /* it holds the sense_data struct; */ /* see that struct for details. */ - void *vdisk; /* contains pointer to the vdisk so that we can clean up - * when the IO completes. */ + void *vdisk; /* pointer to the vdisk to clean up when IO completes. */ int no_disk_result; /* used to return no disk inquiry result * when no_disk_result is set to 1, @@ -258,15 +248,15 @@ struct uiscmdrsp_scsi { */ #define NO_DISK_INQUIRY_RESULT_LEN 36 -#define MIN_INQUIRY_RESULT_LEN 5 /* we need at least 5 bytes minimum for inquiry - * result */ +#define MIN_INQUIRY_RESULT_LEN 5 /* 5 bytes minimum for inquiry result */ /* SCSI device version for no disk inquiry result */ #define SCSI_SPC2_VER 4 /* indicates SCSI SPC2 (SPC3 is 5) */ /* Windows and Linux want different things for a non-existent lun. So, we'll let * caller pass in the peripheral qualifier and type. - * NOTE:[4] SCSI returns (n-4); so we return length-1-4 or length-5. */ + * NOTE:[4] SCSI returns (n-4); so we return length-1-4 or length-5. + */ #define SET_NO_DISK_INQUIRY_RESULT(buf, len, lun, lun0notpresent, notpresent) \ do { \ @@ -305,9 +295,7 @@ struct uiscmdrsp_scsi { } \ } while (0) -/* - * Struct & Defines to support sense information. - */ +/* Struct & Defines to support sense information. */ /* The following struct is returned in sensebuf field in uiscmdrsp_scsi. It is * initialized in exactly the manner that is recommended in Windows (hence the @@ -342,13 +330,11 @@ struct sense_data { struct net_pkt_xmt { int len; /* full length of data in the packet */ int num_frags; /* number of fragments in frags containing data */ - struct phys_info frags[MAX_PHYS_INFO]; /* physical page information for - * each fragment */ + struct phys_info frags[MAX_PHYS_INFO]; /* physical page information */ char ethhdr[ETH_HEADER_SIZE]; /* the ethernet header */ struct { - /* these are needed for csum at uisnic end */ - u8 valid; /* 1 = rest of this struct is valid - else - * ignore */ + /* these are needed for csum at uisnic end */ + u8 valid; /* 1 = struct is valid - else ignore */ u8 hrawoffv; /* 1 = hwrafoff is valid */ u8 nhrawoffv; /* 1 = nhwrafoff is valid */ u16 protocol; /* specifies packet protocol */ @@ -380,16 +366,18 @@ struct net_pkt_xmtdone { */ #define RCVPOST_BUF_SIZE 4032 #define MAX_NET_RCV_CHAIN \ - ((ETH_MAX_MTU+ETH_HEADER_SIZE + RCVPOST_BUF_SIZE-1) / RCVPOST_BUF_SIZE) + ((ETH_MAX_MTU + ETH_HEADER_SIZE + RCVPOST_BUF_SIZE - 1) \ + / RCVPOST_BUF_SIZE) struct net_pkt_rcvpost { /* rcv buf size must be large enough to include ethernet data len + * ethernet header len - we are choosing 2K because it is guaranteed - * to be describable */ - struct phys_info frag; /* physical page information for the - * single fragment 2K rcv buf */ - u64 unique_num; /* This is used to make sure that - * receive posts are returned to */ + * to be describable + */ + struct phys_info frag; /* physical page information for the */ + /* single fragment 2K rcv buf */ + u64 unique_num; + /* unique_num ensure that receive posts are returned to */ /* the Adapter which we sent them originally. */ } __packed; @@ -399,8 +387,7 @@ struct net_pkt_rcv { u32 rcv_done_len; /* length of received data */ u8 numrcvbufs; /* number of receive buffers that contain the */ /* incoming data; guest end MUST chain these together. */ - void *rcvbuf[MAX_NET_RCV_CHAIN]; /* the list of receive buffers - * that must be chained; */ + void *rcvbuf[MAX_NET_RCV_CHAIN]; /* list of chained rcvbufs */ /* each entry is a receive buffer provided by NET_RCV_POST. */ /* NOTE: first rcvbuf in the chain will also be provided in net.buf. */ u64 unique_num; @@ -469,18 +456,17 @@ struct uiscmdrsp_scsitaskmgmt { #define TASK_MGMT_FAILED 0 } __packed; -/* The following is used by uissd to send disk add/remove notifications to - * Guest */ +/* Used by uissd to send disk add/remove notifications to Guest */ /* Note that the vHba pointer is not used by the Client/Guest side. */ struct uiscmdrsp_disknotify { u8 add; /* 0-remove, 1-add */ - void *v_hba; /* Pointer to vhba_info for channel info to - * route msg */ + void *v_hba; /* channel info to route msg */ u32 channel, id, lun; /* SCSI Path of Disk to added or removed */ } __packed; /* The following is used by virthba/vSCSI to send the Acquire/Release commands - * to the IOVM. */ + * to the IOVM. + */ struct uiscmdrsp_vdiskmgmt { enum vdisk_mgmt_types vdisktype; @@ -533,8 +519,8 @@ struct uiscmdrsp { struct uiscmdrsp_disknotify disknotify; struct uiscmdrsp_vdiskmgmt vdiskmgmt; }; - void *private_data; /* used to send the response when the cmd is - * done (scsi & scsittaskmgmt). */ + void *private_data; /* send the response when the cmd is */ + /* done (scsi & scsittaskmgmt). */ struct uiscmdrsp *next; /* General Purpose Queue Link */ struct uiscmdrsp *activeQ_next; /* Used to track active commands */ struct uiscmdrsp *activeQ_prev; /* Used to track active commands */ @@ -564,15 +550,11 @@ struct spar_io_channel_protocol { } __packed; #define MAX_CLIENTSTRING_LEN 1024 - u8 client_string[MAX_CLIENTSTRING_LEN];/* NULL terminated - so holds - * max - 1 bytes */ + /* client_string is NULL termimated so holds max -1 bytes */ + u8 client_string[MAX_CLIENTSTRING_LEN]; } __packed; - -/* - * INLINE functions for initializing and accessing I/O data channels - */ - +/* INLINE functions for initializing and accessing I/O data channels */ #define SIZEOF_PROTOCOL (COVER(sizeof(struct spar_io_channel_protocol), 64)) #define SIZEOF_CMDRSP (COVER(sizeof(struct uiscmdrsp), 64)) @@ -584,8 +566,7 @@ struct spar_io_channel_protocol { * pfn-off-size entires. */ -/* we deal with 4K page sizes when we it comes to passing page information - * between */ +/* use 4K page sizes when we it comes to passing page information between */ /* Guest and IOPartition. */ #define PI_PAGE_SIZE 0x1000 #define PI_PAGE_MASK 0x0FFF @@ -594,18 +575,8 @@ struct spar_io_channel_protocol { * room) */ static inline u16 -add_physinfo_entries(u32 inp_pfn, /* input - specifies the pfn to be used - * to add entries */ - u16 inp_off, /* input - specifies the off to be used - * to add entries */ - u32 inp_len, /* input - specifies the len to be used - * to add entries */ - u16 index, /* input - index in array at which new - * entries are added */ - u16 max_pi_arr_entries, /* input - specifies the maximum - * entries pi_arr can hold */ - struct phys_info pi_arr[]) /* input & output - array to - * which entries are added */ +add_physinfo_entries(u32 inp_pfn, u16 inp_off, u32 inp_len, u16 index, + u16 max_pi_arr_entries, struct phys_info pi_arr[]) { u32 len; u16 i, firstlen; diff --git a/drivers/staging/unisys/include/vbushelper.h b/drivers/staging/unisys/include/vbushelper.h index f272975b2..f1b6aacb7 100644 --- a/drivers/staging/unisys/include/vbushelper.h +++ b/drivers/staging/unisys/include/vbushelper.h @@ -19,7 +19,8 @@ #define __VBUSHELPER_H__ /* TARGET_HOSTNAME specified as -DTARGET_HOSTNAME=\"thename\" on the - * command line */ + * command line + */ #define TARGET_HOSTNAME "linuxguest" diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 9235536fa..2a64a9ce0 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -140,8 +140,8 @@ struct visor_device { struct { int major, minor; void *attr; /* private use by devmajorminor_attr.c you can - * change this constant to whatever you - * want; */ + * change this constant to whatever you want + */ } devnodes[5]; /* the code will detect and behave appropriately) */ struct semaphore visordriver_callback_lock; -- cgit v1.2.3-54-g00ecf