This patch removes the GUID type from the s-Par modules and replaces it with the standard uuid_le type. guidutils.h was removed entirely, and references to it were replaced with linux/uuid.h. In some cases, includes were also rearranged for better readability. All references to the GUID type were corrected to use uuid_le. Comparisons between UUIDs were corrected to use uuid_le_cmp(), printing was corrected to use %pUL instead of strings from formatting macros, and uses of a local copy of the null UUID were corrected to use NULL_UUID_LE. In commontypes.h, redundant macro definitions were removed to simplify the file since many of these macros used UUIDs. Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx> --- .../unisys/common-spar/include/channels/channel.h | 29 +-- .../common-spar/include/channels/channel_guid.h | 29 ++- .../include/channels/controlvmchannel.h | 16 +- .../common-spar/include/channels/diagchannel.h | 8 +- .../common-spar/include/channels/iochannel.h | 8 +- .../common-spar/include/channels/vbuschannel.h | 8 +- drivers/staging/unisys/include/commontypes.h | 96 +--------- drivers/staging/unisys/include/guidutils.h | 203 --------------------- drivers/staging/unisys/include/uisqueue.h | 12 +- drivers/staging/unisys/include/uisutils.h | 20 +- drivers/staging/unisys/uislib/uislib.c | 55 +++--- drivers/staging/unisys/uislib/uisutils.c | 58 +++--- drivers/staging/unisys/virtpci/virtpci.c | 14 +- drivers/staging/unisys/virtpci/virtpci.h | 2 +- drivers/staging/unisys/visorchannel/visorchannel.h | 12 +- .../unisys/visorchannel/visorchannel_funcs.c | 30 +-- .../unisys/visorchannel/visorchannel_main.c | 3 +- drivers/staging/unisys/visorchipset/parser.c | 4 +- drivers/staging/unisys/visorchipset/parser.h | 2 +- drivers/staging/unisys/visorchipset/testing.h | 4 +- drivers/staging/unisys/visorchipset/visorchipset.h | 14 +- .../unisys/visorchipset/visorchipset_main.c | 21 +-- 22 files changed, 163 insertions(+), 485 deletions(-) delete mode 100644 drivers/staging/unisys/include/guidutils.h diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h b/drivers/staging/unisys/common-spar/include/channels/channel.h index aee2041..c480a8d 100644 --- a/drivers/staging/unisys/common-spar/include/channels/channel.h +++ b/drivers/staging/unisys/common-spar/include/channels/channel.h @@ -28,6 +28,8 @@ */ #define __SUPERVISOR_CHANNEL_H__ +#include <linux/uuid.h> + #include "commontypes.h" #define SIGNATURE_16(A, B) ((A) | (B<<8)) @@ -46,19 +48,6 @@ #define COVER(v, d) ((d)*COVERQ(v, d)) #endif -#ifndef GUID0 -#define GUID0 {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} } -#endif - -/* The C language is inconsistent with respect to where it allows literal - * constants, especially literal constant structs. Literal constant structs - * are allowed for initialization only, whereas other types of literal - * constants are allowed anywhere. We get around this inconsistency by - * declaring a "static const" variable for each GUID. This variable can be - * used in expressions where the literal constant would not be allowed. - */ -static const GUID Guid0 = GUID0; - #define ULTRA_CHANNEL_PROTOCOL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L') typedef enum { @@ -226,13 +215,13 @@ typedef struct _CHANNEL_HEADER { U32 HeaderSize; /* sizeof(CHANNEL_HEADER) */ U64 Size; /* Total size of this channel in bytes */ U64 Features; /* Flags to modify behavior */ - GUID Type; /* Channel type: data, bus, control, etc. */ + uuid_le Type; /* Channel type: data, bus, control, etc. */ U64 PartitionHandle; /* ID of guest partition */ U64 Handle; /* Device number of this channel in client */ U64 oChannelSpace; /* Offset in bytes to channel specific area */ U32 VersionId; /* CHANNEL_HEADER Version ID */ U32 PartitionIndex; /* Index of guest partition */ - GUID ZoneGuid; /* Guid of Channel's zone */ + uuid_le ZoneGuid; /* Guid of Channel's zone */ U32 oClientString; /* offset from channel header to * nul-terminated ClientString (0 if * ClientString not present) */ @@ -320,17 +309,17 @@ typedef struct _SIGNAL_QUEUE_HEADER { */ static inline int ULTRA_check_channel_client(void __iomem *pChannel, - GUID expectedTypeGuid, + uuid_le expectedTypeGuid, char *channelName, U64 expectedMinBytes, U32 expectedVersionId, U64 expectedSignature, char *fileName, int lineNumber, void *logCtx) { - if (MEMCMP(&expectedTypeGuid, &Guid0, sizeof(GUID)) != 0) + if ( uuid_le_cmp( expectedTypeGuid, NULL_UUID_LE ) != 0) /* caller wants us to verify type GUID */ - if (MEMCMP_IO(&(((CHANNEL_HEADER __iomem *) (pChannel))->Type), - &expectedTypeGuid, sizeof(GUID)) != 0) { + if ( uuid_le_cmp( ((CHANNEL_HEADER __iomem *)(pChannel))->Type, + expectedTypeGuid ) != 0) { CHANNEL_GUID_MISMATCH(expectedTypeGuid, channelName, "type", expectedTypeGuid, ((CHANNEL_HEADER __iomem *) @@ -380,7 +369,7 @@ ULTRA_check_channel_client(void __iomem *pChannel, * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ static inline int -ULTRA_check_channel_server(GUID typeGuid, +ULTRA_check_channel_server(uuid_le typeGuid, char *channelName, U64 expectedMinBytes, U64 actualBytes, diff --git a/drivers/staging/unisys/common-spar/include/channels/channel_guid.h b/drivers/staging/unisys/common-spar/include/channels/channel_guid.h index ae0dc2b..8e094ae 100644 --- a/drivers/staging/unisys/common-spar/include/channels/channel_guid.h +++ b/drivers/staging/unisys/common-spar/include/channels/channel_guid.h @@ -21,44 +21,43 @@ * {414815ed-c58c-11da-95a9-00e08161165f} */ #define ULTRA_VHBA_CHANNEL_PROTOCOL_GUID \ - { 0x414815ed, 0xc58c, 0x11da, \ - { 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } } -static const GUID UltraVhbaChannelProtocolGuid = + UUID_LE( 0x414815ed, 0xc58c, 0x11da, \ + 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f ) +static const uuid_le UltraVhbaChannelProtocolGuid = ULTRA_VHBA_CHANNEL_PROTOCOL_GUID; /* Used in IOChannel * {8cd5994d-c58e-11da-95a9-00e08161165f} */ #define ULTRA_VNIC_CHANNEL_PROTOCOL_GUID \ - { 0x8cd5994d, 0xc58e, 0x11da, \ - { 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } } -static const GUID UltraVnicChannelProtocolGuid = + UUID_LE( 0x8cd5994d, 0xc58e, 0x11da, \ + 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f ) +static const uuid_le UltraVnicChannelProtocolGuid = ULTRA_VNIC_CHANNEL_PROTOCOL_GUID; /* Used in IOChannel * {72120008-4AAB-11DC-8530-444553544200} */ #define ULTRA_SIOVM_GUID \ - { 0x72120008, 0x4AAB, 0x11DC, \ - { 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00 } } -static const GUID UltraSIOVMGuid = ULTRA_SIOVM_GUID; + UUID_LE( 0x72120008, 0x4AAB, 0x11DC, \ + 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00 ) +static const uuid_le UltraSIOVMGuid = ULTRA_SIOVM_GUID; /* Used in visornoop/visornoop_main.c * {5b52c5ac-e5f5-4d42-8dff-429eaecd221f} */ #define ULTRA_CONTROLDIRECTOR_CHANNEL_PROTOCOL_GUID \ - { 0x5b52c5ac, 0xe5f5, 0x4d42, \ - { 0x8d, 0xff, 0x42, 0x9e, 0xae, 0xcd, 0x22, 0x1f } } - -static const GUID UltraControlDirectorChannelProtocolGuid = + UUID_LE( 0x5b52c5ac, 0xe5f5, 0x4d42, \ + 0x8d, 0xff, 0x42, 0x9e, 0xae, 0xcd, 0x22, 0x1f ) +static const uuid_le UltraControlDirectorChannelProtocolGuid = ULTRA_CONTROLDIRECTOR_CHANNEL_PROTOCOL_GUID; /* Used in visorchipset/visorchipset_main.c * {B4E79625-AEDE-4EAA-9E11-D3EDDCD4504C} */ #define ULTRA_DIAG_POOL_CHANNEL_PROTOCOL_GUID \ - {0xb4e79625, 0xaede, 0x4eaa, \ - { 0x9e, 0x11, 0xd3, 0xed, 0xdc, 0xd4, 0x50, 0x4c } } + UUID_LE( 0xb4e79625, 0xaede, 0x4eaa, \ + 0x9e, 0x11, 0xd3, 0xed, 0xdc, 0xd4, 0x50, 0x4c ) diff --git a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h index 47f1c4f..27df3b6 100644 --- a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h @@ -25,10 +25,10 @@ enum { INVALID_GUEST_FIRMWARE, SAMPLE_GUEST_FIRMWARE, /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */ #define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_GUID \ - {0x2b3c2d10, 0x7ef5, 0x4ad8, \ - {0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d} } + UUID_LE (0x2b3c2d10, 0x7ef5, 0x4ad8, \ + 0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d ) -static const GUID UltraControlvmChannelProtocolGuid = +static const uuid_le UltraControlvmChannelProtocolGuid = ULTRA_CONTROLVM_CHANNEL_PROTOCOL_GUID; #define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE \ @@ -293,8 +293,8 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CREATE { * can be dereferenced by the receiver * of this ControlVm command */ U64 channelBytes; /**< specifies size of the channel in bytes */ - GUID dataTypeGuid;/**< specifies format of data in channel */ - GUID devInstGuid; /**< instance guid for the device */ + uuid_le dataTypeGuid;/**< specifies format of data in channel */ + uuid_le devInstGuid; /**< instance guid for the device */ struct InterruptInfo intr; /**< specifies interrupt information */ } CONTROLVM_PACKET_DEVICE_CREATE; /* for CONTROLVM_DEVICE_CREATE */ @@ -333,9 +333,9 @@ typedef struct _CONTROLVM_MESSAGE_PACKET { * dereferenced by the receiver * of this ControlVm command */ U64 channelBytes; /*< size of the channel in bytes */ - GUID busDataTypeGuid;/*< indicates format of data in bus + uuid_le busDataTypeGuid;/*< indicates format of data in bus * channel */ - GUID busInstGuid; /*< instance guid for the bus */ + uuid_le busInstGuid; /*< instance guid for the bus */ } createBus; /* for CONTROLVM_BUS_CREATE */ struct { U32 busNo; /*< bus # (0..n-1) from the msg @@ -611,7 +611,7 @@ typedef struct _ULTRA_CONTROLVM_PARAMETERS_HEADER { U32 ClientLength; U32 NameOffset; U32 NameLength; - GUID Id; + uuid_le Id; U32 Revision; U32 Reserved; /* Natural alignment */ } ULTRA_CONTROLVM_PARAMETERS_HEADER; diff --git a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h index c93515e..cee1346 100644 --- a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h @@ -33,15 +33,17 @@ #ifndef _DIAG_CHANNEL_H_ #define _DIAG_CHANNEL_H_ +#include <linux/uuid.h> + #include "commontypes.h" #include "channel.h" /* {EEA7A573-DB82-447c-8716-EFBEAAAE4858} */ #define ULTRA_DIAG_CHANNEL_PROTOCOL_GUID \ - {0xeea7a573, 0xdb82, 0x447c, \ - {0x87, 0x16, 0xef, 0xbe, 0xaa, 0xae, 0x48, 0x58} } + UUID_LE( 0xeea7a573, 0xdb82, 0x447c, \ + 0x87, 0x16, 0xef, 0xbe, 0xaa, 0xae, 0x48, 0x58 ) -static const GUID UltraDiagChannelProtocolGuid = +static const uuid_le UltraDiagChannelProtocolGuid = ULTRA_DIAG_CHANNEL_PROTOCOL_GUID; /* {E850F968-3263-4484-8CA5-2A35D087A5A8} */ diff --git a/drivers/staging/unisys/common-spar/include/channels/iochannel.h b/drivers/staging/unisys/common-spar/include/channels/iochannel.h index 8de1d24..31ff9e5 100644 --- a/drivers/staging/unisys/common-spar/include/channels/iochannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/iochannel.h @@ -696,7 +696,7 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL { U8 macaddr[MAX_MACADDR_LEN]; /* 6 bytes */ U32 num_rcv_bufs; /* 4 */ U32 mtu; /* 4 */ - GUID zoneGuid; /* 16 */ + uuid_le zoneGuid; /* 16 */ } vnic; /* total 30 */ }; @@ -807,7 +807,7 @@ static inline int ULTRA_VHBA_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x, x->ChannelHeader.HeaderSize = sizeof(x->ChannelHeader); x->ChannelHeader.Size = COVER(bytes, 4096); x->ChannelHeader.Type = UltraVhbaChannelProtocolGuid; - x->ChannelHeader.ZoneGuid = Guid0; + x->ChannelHeader.ZoneGuid = NULL_UUID_LE; x->vhba.wwnn = *wwnn; x->vhba.max = *max; INIT_CLIENTSTRING(x, ULTRA_IO_CHANNEL_PROTOCOL, clientStr, @@ -832,7 +832,7 @@ static inline void ULTRA_VHBA_set_max(ULTRA_IO_CHANNEL_PROTOCOL *x, static inline int ULTRA_VNIC_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x, unsigned char *macaddr, U32 num_rcv_bufs, U32 mtu, - GUID zoneGuid, + uuid_le zoneGuid, unsigned char *clientStr, U32 clientStrLen, U64 bytes) { @@ -843,7 +843,7 @@ static inline int ULTRA_VNIC_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x, x->ChannelHeader.HeaderSize = sizeof(x->ChannelHeader); x->ChannelHeader.Size = COVER(bytes, 4096); x->ChannelHeader.Type = UltraVnicChannelProtocolGuid; - x->ChannelHeader.ZoneGuid = Guid0; + x->ChannelHeader.ZoneGuid = NULL_UUID_LE; MEMCPY(x->vnic.macaddr, macaddr, MAX_MACADDR_LEN); x->vnic.num_rcv_bufs = num_rcv_bufs; x->vnic.mtu = mtu; diff --git a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h index 99dbbcf..bf03715 100644 --- a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h @@ -29,9 +29,9 @@ /* {193b331b-c58f-11da-95a9-00e08161165f} */ #define ULTRA_VBUS_CHANNEL_PROTOCOL_GUID \ - {0x193b331b, 0xc58f, 0x11da, \ - {0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f} } -static const GUID UltraVbusChannelProtocolGuid = + UUID_LE( 0x193b331b, 0xc58f, 0x11da, \ + 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f ) +static const uuid_le UltraVbusChannelProtocolGuid = ULTRA_VBUS_CHANNEL_PROTOCOL_GUID; #define ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE @@ -112,7 +112,7 @@ ULTRA_VBUS_init_channel(ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *x, writeq(bytesAllocated, &x->ChannelHeader.Size); memcpy_toio(&x->ChannelHeader.Type, &UltraVbusChannelProtocolGuid, sizeof(x->ChannelHeader.Type)); - memcpy_toio(&x->ChannelHeader.ZoneGuid, &Guid0, + memcpy_toio(&x->ChannelHeader.ZoneGuid, (void*)&NULL_UUID_LE, sizeof(x->ChannelHeader.ZoneGuid)); writel(sizeof(ULTRA_VBUS_HEADERINFO), &x->HdrInfo.structBytes); writel(sizeof(ULTRA_VBUS_HEADERINFO), &x->HdrInfo.chpInfoByteOffset); diff --git a/drivers/staging/unisys/include/commontypes.h b/drivers/staging/unisys/include/commontypes.h index ef12af4..d8b5825 100644 --- a/drivers/staging/unisys/include/commontypes.h +++ b/drivers/staging/unisys/include/commontypes.h @@ -20,14 +20,9 @@ * similar abreviated content */ #define _SUPERVISOR_COMMONTYPES_H_ -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/version.h> #include <linux/io.h> -#else -#include <stdint.h> -#include <syslog.h> -#endif #define U8 uint8_t #define U16 uint16_t @@ -38,37 +33,12 @@ #define S32 int32_t #define S64 int64_t -#ifdef __KERNEL__ - #ifdef CONFIG_X86_32 #define UINTN U32 #else #define UINTN U64 #endif -#else - -#include <stdint.h> -#if __WORDSIZE == 32 -#define UINTN U32 -#elif __WORDSIZE == 64 -#define UINTN U64 -#else -#error Unsupported __WORDSIZE -#endif - -#endif - -typedef struct { - U32 data1; - U16 data2; - U16 data3; - U8 data4[8]; -} __attribute__ ((__packed__)) GUID; - -#ifndef GUID0 -#define GUID0 {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} } -#endif typedef U64 GUEST_PHYSICAL_ADDRESS; #define MEMSET(ptr, val, len) memset(ptr, val, len) @@ -80,7 +50,6 @@ typedef U64 GUEST_PHYSICAL_ADDRESS; #define INLINE inline #define OFFSETOF offsetof -#ifdef __KERNEL__ #define MEMORYBARRIER mb() #define MEMCPY(dest, src, len) memcpy(dest, src, len) #define MEMCPY_TOIO(dest, src, len) memcpy_toio(dest, src, len) @@ -88,19 +57,17 @@ typedef U64 GUEST_PHYSICAL_ADDRESS; #define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \ lin, logCtx) \ - do { \ - char s1[50], s2[50], s3[50]; \ - pr_err("Channel mismatch on channel=%s(%s) field=%s expected=%s actual=%s @%s:%d\n", \ - chName, GUID_format2(&chType, s1), field, \ - GUID_format2(&expected, s2), GUID_format2(&actual, s3), \ + do { \ + pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=%pUL actual=%pUL @%s:%d\n", \ + chName, &(chType), field, \ + &(expected), &(actual), \ fil, lin); \ } while (0) #define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \ lin, logCtx) \ do { \ - char s1[50]; \ - pr_err("Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \ - chName, GUID_format2(&chType, s1), field, \ + pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \ + chName, &(chType), field, \ (unsigned long)expected, (unsigned long)actual, \ fil, lin); \ } while (0) @@ -108,9 +75,8 @@ typedef U64 GUEST_PHYSICAL_ADDRESS; #define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \ lin, logCtx) \ do { \ - char s1[50]; \ - pr_err("Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \ - chName, GUID_format2(&chType, s1), field, \ + pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \ + chName, &(chType), field, \ (unsigned long long)expected, \ (unsigned long long)actual, \ fil, lin); \ @@ -120,51 +86,7 @@ typedef U64 GUEST_PHYSICAL_ADDRESS; LineNumber, Str, args...) \ pr_info(Str, ## args) -#else -#define MEMCPY(dest, src, len) memcpy(dest, src, len) - -#define MEMORYBARRIER mb() - -#define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \ - lin, logCtx) \ - do { \ - char s1[50], s2[50], s3[50]; \ - syslog(LOG_USER | LOG_ERR, \ - "Channel mismatch on channel=%s(%s) field=%s expected=%s actual=%s @%s:%d", \ - chName, GUID_format2(&chType, s1), field, \ - GUID_format2(&expected, s2), GUID_format2(&actual, s3), \ - fil, lin); \ - } while (0) - -#define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \ - lin, logCtx) \ - do { \ - char s1[50]; \ - syslog(LOG_USER | LOG_ERR, \ - "Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d", \ - chName, GUID_format2(&chType, s1), field, \ - (unsigned long)expected, (unsigned long)actual, \ - fil, lin); \ - } while (0) - -#define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \ - lin, logCtx) \ - do { \ - char s1[50]; \ - syslog(LOG_USER | LOG_ERR, \ - "Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d", \ - chName, GUID_format2(&chType, s1), field, \ - (unsigned long long)expected, \ - (unsigned long long)actual, \ - fil, lin); \ - } while (0) - -#define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \ - LineNumber, Str, args...) \ - syslog(LOG_USER | LOG_INFO, Str, ## args) -#endif - #define VolatileBarrier() MEMORYBARRIER #endif -#include "guidutils.h" + diff --git a/drivers/staging/unisys/include/guidutils.h b/drivers/staging/unisys/include/guidutils.h deleted file mode 100644 index 75caf92..0000000 --- a/drivers/staging/unisys/include/guidutils.h +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright © 2010 - 2013 UNISYS CORPORATION - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - */ - -/* guidutils.h - * - * These are GUID manipulation inlines that can be used from either - * kernel-mode or user-mode. - * - */ -#ifndef __GUIDUTILS_H__ -#define __GUIDUTILS_H__ - -#ifdef __KERNEL__ -#include <linux/kernel.h> -#include <linux/string.h> -#include <linux/ctype.h> -#define GUID_STRTOUL kstrtoul -#else -#include <stdio.h> -#include <ctype.h> -#include <string.h> -#include <stdlib.h> - -#define GUID_STRTOUL strtoul -#endif - -static inline char * -GUID_format1(const GUID *guid, char *s) -{ - sprintf(s, "{%-8.8lx-%-4.4x-%-4.4x-%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x}", - (ulong) guid->data1, - guid->data2, - guid->data3, - guid->data4[0], - guid->data4[1], - guid->data4[2], - guid->data4[3], - guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); - return s; -} - -/** Format a GUID in Microsoft's 'what in the world were they thinking' - * format. - */ -static inline char * -GUID_format2(const GUID *guid, char *s) -{ - sprintf(s, "{%-8.8lx-%-4.4x-%-4.4x-%-2.2x%-2.2x-%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x}", - (ulong) guid->data1, - guid->data2, - guid->data3, - guid->data4[0], - guid->data4[1], - guid->data4[2], - guid->data4[3], - guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); - return s; -} - -/** - * Like GUID_format2 but without the curly braces and the - * hex digits in upper case - */ -static inline char * -GUID_format3(const GUID *guid, char *s) -{ - sprintf(s, "%-8.8lX-%-4.4X-%-4.4X-%-2.2X%-2.2X-%-2.2X%-2.2X%-2.2X%-2.2X%-2.2X%-2.2X", - (ulong) guid->data1, - guid->data2, - guid->data3, - guid->data4[0], - guid->data4[1], - guid->data4[2], - guid->data4[3], - guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); - return s; -} - -/** Parse a guid string in any of these forms: - * {11111111-2222-3333-4455-66778899aabb} - * {11111111-2222-3333-445566778899aabb} - * 11111111-2222-3333-4455-66778899aabb - * 11111111-2222-3333-445566778899aabb - */ -static inline GUID -GUID_scan(U8 *p) -{ - GUID guid = GUID0; - U8 x[33]; - int count = 0; - int c, i = 0; - U8 cdata1[9]; - U8 cdata2[5]; - U8 cdata3[5]; - U8 cdata4[3]; - int dashcount = 0; - int brace = 0; - unsigned long uldata; - - if (!p) - return guid; - if (*p == '{') { - p++; - brace = 1; - } - while (count < 32) { - if (*p == '}') - return guid; - if (*p == '\0') - return guid; - c = toupper(*p); - p++; - if (c == '-') { - switch (dashcount) { - case 0: - if (i != 8) - return guid; - break; - case 1: - if (i != 4) - return guid; - break; - case 2: - if (i != 4) - return guid; - break; - case 3: - if (i != 4) - return guid; - break; - default: - return guid; - } - dashcount++; - i = 0; - continue; - } - if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) - i++; - else - return guid; - x[count++] = c; - } - x[count] = '\0'; - if (brace) { - if (*p == '}') - p++; - else - return guid; - } - if (dashcount == 3 || dashcount == 4) - ; - else - return guid; - memset(cdata1, 0, sizeof(cdata1)); - memset(cdata2, 0, sizeof(cdata2)); - memset(cdata3, 0, sizeof(cdata3)); - memset(cdata4, 0, sizeof(cdata4)); - memcpy(cdata1, x + 0, 8); - memcpy(cdata2, x + 8, 4); - memcpy(cdata3, x + 12, 4); - - if (GUID_STRTOUL((char *) cdata1, 16, &uldata) == 0) - guid.data1 = (U32)uldata; - if (GUID_STRTOUL((char *) cdata2, 16, &uldata) == 0) - guid.data2 = (U16)uldata; - if (GUID_STRTOUL((char *) cdata3, 16, &uldata) == 0) - guid.data3 = (U16)uldata; - - for (i = 0; i < 8; i++) { - memcpy(cdata4, x + 16 + (i * 2), 2); - if (GUID_STRTOUL((char *) cdata4, 16, &uldata) == 0) - guid.data4[i] = (U8) uldata; - } - - return guid; -} - -static inline char * -GUID_sanitize(char *inputGuidStr, char *outputGuidStr) -{ - GUID g; - GUID guid0 = GUID0; - *outputGuidStr = '\0'; - g = GUID_scan((U8 *) inputGuidStr); - if (memcmp(&g, &guid0, sizeof(GUID)) == 0) - return outputGuidStr; /* bad GUID format */ - return GUID_format1(&g, outputGuidStr); -} - -#endif diff --git a/drivers/staging/unisys/include/uisqueue.h b/drivers/staging/unisys/include/uisqueue.h index 6dab390..31aa9da 100644 --- a/drivers/staging/unisys/include/uisqueue.h +++ b/drivers/staging/unisys/include/uisqueue.h @@ -136,8 +136,8 @@ struct device_info { void __iomem *chanptr; U64 channelAddr; U64 channelBytes; - GUID channelTypeGuid; - GUID devInstGuid; + uuid_le channelTypeGuid; + uuid_le devInstGuid; struct InterruptInfo intr; struct switch_info *swtch; char devid[30]; /* "vbus<busno>:dev<devno>" */ @@ -163,7 +163,7 @@ struct bus_info { U32 busNo, deviceCount; struct device_info **device; U64 guestHandle, recvBusInterruptHandle; - GUID busInstGuid; + uuid_le busInstGuid; ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *pBusChannel; int busChannelBytes; struct proc_dir_entry *proc_dir; /* proc/uislib/vbus/<x> */ @@ -356,8 +356,8 @@ struct add_vbus_guestpart { * NOT YET USED */ U32 busNo; /* bus number to be created/deleted */ U32 deviceCount; /* max num of devices on bus */ - GUID busTypeGuid; /* indicates type of bus */ - GUID busInstGuid; /* instance guid for device */ + uuid_le busTypeGuid; /* indicates type of bus */ + uuid_le busInstGuid; /* instance guid for device */ }; struct del_vbus_guestpart { @@ -371,7 +371,7 @@ struct add_virt_guestpart { void __iomem *chanptr; /* pointer to data channel */ U32 busNo; /* bus number for the operation */ U32 deviceNo; /* number of device on the bus */ - GUID devInstGuid; /* instance guid for device */ + uuid_le devInstGuid; /* instance guid for device */ struct InterruptInfo intr; /* recv/send interrupt info */ /* recvInterruptHandle contains info needed in order to * register to receive interrupts on the data channel. diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h index 5fdab3a..e374537 100644 --- a/drivers/staging/unisys/include/uisutils.h +++ b/drivers/staging/unisys/include/uisutils.h @@ -54,7 +54,7 @@ extern atomic_t UisUtils_Registered_Services; typedef unsigned int MACARRAY[MAX_MACADDR_LEN]; typedef struct ReqHandlerInfo_struct { - GUID switchTypeGuid; + uuid_le switchTypeGuid; int (*controlfunc)(struct io_msgs *); unsigned long min_channel_bytes; int (*Server_Channel_Ok)(unsigned long channelBytes); @@ -64,7 +64,7 @@ typedef struct ReqHandlerInfo_struct { struct list_head list_link; /* links into ReqHandlerInfo_list */ } ReqHandlerInfo_t; -ReqHandlerInfo_t *ReqHandlerAdd(GUID switchTypeGuid, +ReqHandlerInfo_t *ReqHandlerAdd( uuid_le switchTypeGuid, const char *switch_type_name, int (*controlfunc)(struct io_msgs *), unsigned long min_channel_bytes, @@ -73,8 +73,8 @@ ReqHandlerInfo_t *ReqHandlerAdd(GUID switchTypeGuid, int (*Server_Channel_Init) (void *x, unsigned char *clientStr, U32 clientStrLen, U64 bytes)); -ReqHandlerInfo_t *ReqHandlerFind(GUID switchTypeGuid); -int ReqHandlerDel(GUID switchTypeGuid); +ReqHandlerInfo_t *ReqHandlerFind(uuid_le switchTypeGuid); +int ReqHandlerDel(uuid_le switchTypeGuid); #define uislib_ioremap_cache(addr, size) \ dbg_ioremap_cache(addr, size, __FILE__, __LINE__) @@ -112,7 +112,7 @@ int uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, int uisctrl_register_req_handler(int type, void *fptr, ULTRA_VBUS_DEVICEINFO *chipset_DriverInfo); -int uisctrl_register_req_handler_ex(GUID switchTypeGuid, +int uisctrl_register_req_handler_ex(uuid_le switchTypeGuid, const char *switch_type_name, int (*fptr)(struct io_msgs *), unsigned long min_channel_bytes, @@ -123,7 +123,7 @@ int uisctrl_register_req_handler_ex(GUID switchTypeGuid, U32 clientStrLen, U64 bytes), ULTRA_VBUS_DEVICEINFO *chipset_DriverInfo); -int uisctrl_unregister_req_handler_ex(GUID switchTypeGuid); +int uisctrl_unregister_req_handler_ex(uuid_le switchTypeGuid); unsigned char *util_map_virt(struct phys_info *sg); void util_unmap_virt(struct phys_info *sg); unsigned char *util_map_virt_atomic(struct phys_info *sg); @@ -133,20 +133,20 @@ int uislib_server_inject_add_vnic(U32 switchNo, U32 BusNo, U32 numIntPorts, pCHANNEL_HEADER **chan); void uislib_server_inject_del_vnic(U32 switchNo, U32 busNo, U32 numIntPorts, U32 numExtPorts); -int uislib_client_inject_add_bus(U32 busNo, GUID instGuid, +int uislib_client_inject_add_bus(U32 busNo, uuid_le instGuid, U64 channelAddr, ulong nChannelBytes); int uislib_client_inject_del_bus(U32 busNo); int uislib_client_inject_add_vhba(U32 busNo, U32 devNo, U64 phys_chan_addr, U32 chan_bytes, - int is_test_addr, GUID instGuid, + int is_test_addr, uuid_le instGuid, struct InterruptInfo *intr); int uislib_client_inject_pause_vhba(U32 busNo, U32 devNo); int uislib_client_inject_resume_vhba(U32 busNo, U32 devNo); int uislib_client_inject_del_vhba(U32 busNo, U32 devNo); int uislib_client_inject_add_vnic(U32 busNo, U32 devNo, U64 phys_chan_addr, U32 chan_bytes, - int is_test_addr, GUID instGuid, + int is_test_addr, uuid_le instGuid, struct InterruptInfo *intr); int uislib_client_inject_pause_vnic(U32 busNo, U32 devNo); int uislib_client_inject_resume_vnic(U32 busNo, U32 devNo); @@ -195,7 +195,7 @@ struct chaninfo { */ #define WAIT_FOR_VALID_GUID(guid) \ do { \ - while (MEMCMP_IO(&guid, &Guid0, sizeof(Guid0)) == 0) { \ + while ( uuid_le_cmp( guid, NULL_UUID_LE ) == 0) { \ LOGERR("Waiting for non-0 GUID (why???)...\n"); \ UIS_THREAD_WAIT_SEC(5); \ } \ diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 8ea9c46..9f51bfd 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -587,10 +587,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) */ if (!msg->hdr.Flags.server) { struct guest_msgs cmd; - if (!memcmp - (&dev->channelTypeGuid, - &UltraVhbaChannelProtocolGuid, - sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVhbaChannelProtocolGuid ) ) { WAIT_FOR_VALID_GUID(((CHANNEL_HEADER __iomem *) (dev-> chanptr))-> @@ -614,10 +612,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) dev->devInstGuid; cmd.add_vhba.intr = dev->intr; } else - if (!memcmp - (&dev->channelTypeGuid, - &UltraVnicChannelProtocolGuid, - sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVnicChannelProtocolGuid ) ) { WAIT_FOR_VALID_GUID(((CHANNEL_HEADER __iomem *) (dev-> chanptr))-> @@ -723,16 +719,13 @@ pause_device(CONTROLVM_MESSAGE *msg) /* the msg is bound for virtpci; send * guest_msgs struct to callback */ - if (!memcmp - (&dev->channelTypeGuid, - &UltraVhbaChannelProtocolGuid, sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVhbaChannelProtocolGuid ) ) { cmd.msgtype = GUEST_PAUSE_VHBA; cmd.pause_vhba.chanptr = dev->chanptr; } else - if (!memcmp - (&dev->channelTypeGuid, - &UltraVnicChannelProtocolGuid, - sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVnicChannelProtocolGuid ) ) { cmd.msgtype = GUEST_PAUSE_VNIC; cmd.pause_vnic.chanptr = dev->chanptr; } else { @@ -798,15 +791,13 @@ resume_device(CONTROLVM_MESSAGE *msg) /* the msg is bound for virtpci; send * guest_msgs struct to callback */ - if (!memcmp(&dev->channelTypeGuid, - &UltraVhbaChannelProtocolGuid, - sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVhbaChannelProtocolGuid ) ) { cmd.msgtype = GUEST_RESUME_VHBA; cmd.resume_vhba.chanptr = dev->chanptr; } else - if (!memcmp(&dev->channelTypeGuid, - &UltraVnicChannelProtocolGuid, - sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVnicChannelProtocolGuid ) ) { cmd.msgtype = GUEST_RESUME_VNIC; cmd.resume_vnic.chanptr = dev->chanptr; } else { @@ -873,16 +864,13 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) /* the msg is bound for virtpci; send * guest_msgs struct to callback */ - if (!memcmp - (&dev->channelTypeGuid, - &UltraVhbaChannelProtocolGuid, sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVhbaChannelProtocolGuid ) ) { cmd.msgtype = GUEST_DEL_VHBA; cmd.del_vhba.chanptr = dev->chanptr; } else - if (!memcmp - (&dev->channelTypeGuid, - &UltraVnicChannelProtocolGuid, - sizeof(GUID))) { + if (!uuid_le_cmp( dev->channelTypeGuid, + UltraVnicChannelProtocolGuid ) ) { cmd.msgtype = GUEST_DEL_VNIC; cmd.del_vnic.chanptr = dev->chanptr; } else { @@ -1008,7 +996,7 @@ delete_device_glue(U32 busNo, U32 devNo) } int -uislib_client_inject_add_bus(U32 busNo, GUID instGuid, +uislib_client_inject_add_bus(U32 busNo, uuid_le instGuid, U64 channelAddr, ulong nChannelBytes) { CONTROLVM_MESSAGE msg; @@ -1109,7 +1097,7 @@ EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba); int uislib_client_inject_add_vhba(U32 busNo, U32 devNo, U64 phys_chan_addr, U32 chan_bytes, - int is_test_addr, GUID instGuid, + int is_test_addr, uuid_le instGuid, struct InterruptInfo *intr) { CONTROLVM_MESSAGE msg; @@ -1168,7 +1156,7 @@ EXPORT_SYMBOL_GPL(uislib_client_inject_del_vhba); int uislib_client_inject_add_vnic(U32 busNo, U32 devNo, U64 phys_chan_addr, U32 chan_bytes, - int is_test_addr, GUID instGuid, + int is_test_addr, uuid_le instGuid, struct InterruptInfo *intr) { CONTROLVM_MESSAGE msg; @@ -1272,7 +1260,6 @@ uislib_client_add_vnic(U32 busNo) BOOL busCreated = FALSE; int devNo = 0; /* Default to 0, since only one device * will be created for this bus... */ - GUID dummyGuid = GUID0; CONTROLVM_MESSAGE msg; init_msg_header(&msg, CONTROLVM_BUS_CREATE, 0, 0); @@ -1291,7 +1278,7 @@ uislib_client_add_vnic(U32 busNo) msg.hdr.Flags.testMessage = 1; msg.cmd.createDevice.busNo = busNo; msg.cmd.createDevice.devNo = devNo; - msg.cmd.createDevice.devInstGuid = dummyGuid; + msg.cmd.createDevice.devInstGuid = NULL_UUID_LE; memset(&msg.cmd.createDevice.intr, 0, sizeof(struct InterruptInfo)); msg.cmd.createDevice.channelAddr = PhysicalDataChan; msg.cmd.createDevice.channelBytes = MIN_IO_CHANNEL_SIZE; @@ -1383,7 +1370,7 @@ vnic_proc_write(struct file *file, const char __user *buffer, int action = 0xffff, busNo = 0, i, result = 0; char buf[4]; char direction; -/* GUID guid; */ + if (count >= ARRAY_SIZE(buf)) return -EINVAL; diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 3178f75..8141cb2 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -18,17 +18,19 @@ #include <linux/string.h> #include <linux/slab.h> #include <commontypes.h> +#include <linux/skbuff.h> #include <linux/spinlock.h> #include <linux/list.h> +#include <linux/uuid.h> + +#ifdef CONFIG_HIGHMEM +#include <linux/highmem.h> +#endif + #include "uniklog.h" #include "uisutils.h" #include "version.h" #include "vbushelper.h" -#include "guidutils.h" -#include <linux/skbuff.h> -#ifdef CONFIG_HIGHMEM -#include <linux/highmem.h> -#endif /* this is shorter than using __FILE__ (full path name) in * debug/info/error messages @@ -104,7 +106,7 @@ uisctrl_register_req_handler(int type, void *fptr, EXPORT_SYMBOL_GPL(uisctrl_register_req_handler); int -uisctrl_register_req_handler_ex(GUID switchTypeGuid, +uisctrl_register_req_handler_ex(uuid_le switchTypeGuid, const char *switch_type_name, int (*controlfunc)(struct io_msgs *), unsigned long min_channel_bytes, @@ -115,24 +117,19 @@ uisctrl_register_req_handler_ex(GUID switchTypeGuid, U32 clientStrLen, U64 bytes), ULTRA_VBUS_DEVICEINFO *chipset_DriverInfo) { - char s[99]; ReqHandlerInfo_t *pReqHandlerInfo; int rc = 0; /* assume failure */ - LOGINF("type=%s, controlfunc=0x%p.\n", - GUID_format1(&switchTypeGuid, s), controlfunc); + LOGINF("type=%pUL, controlfunc=0x%p.\n", &switchTypeGuid, controlfunc); if (!controlfunc) { - LOGERR("%s: controlfunc must be supplied\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("%pUL: controlfunc must be supplied\n", &switchTypeGuid); goto Away; } if (!Server_Channel_Ok) { - LOGERR("%s: Server_Channel_Ok must be supplied\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("%pUL: Server_Channel_Ok must be supplied\n", &switchTypeGuid); goto Away; } if (!Server_Channel_Init) { - LOGERR("%s: Server_Channel_Init must be supplied\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("%pUL: Server_Channel_Init must be supplied\n", &switchTypeGuid); goto Away; } pReqHandlerInfo = ReqHandlerAdd(switchTypeGuid, @@ -141,8 +138,7 @@ uisctrl_register_req_handler_ex(GUID switchTypeGuid, min_channel_bytes, Server_Channel_Ok, Server_Channel_Init); if (!pReqHandlerInfo) { - LOGERR("failed to add %s to server list\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("failed to add %pUL to server list\n", &switchTypeGuid); goto Away; } @@ -156,30 +152,26 @@ Away: VERSION, NULL, __DATE__, __TIME__); } else - LOGERR("failed to register type %s.\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("failed to register type %pUL.\n", &switchTypeGuid); return rc; } EXPORT_SYMBOL_GPL(uisctrl_register_req_handler_ex); int -uisctrl_unregister_req_handler_ex(GUID switchTypeGuid) +uisctrl_unregister_req_handler_ex(uuid_le switchTypeGuid) { - char s[99]; int rc = 0; /* assume failure */ - LOGINF("type=%s.\n", GUID_format1(&switchTypeGuid, s)); + LOGINF("type=%pUL.\n", &switchTypeGuid ); if (ReqHandlerDel(switchTypeGuid) < 0) { - LOGERR("failed to remove %s from server list\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("failed to remove %pUL from server list\n", &switchTypeGuid); goto Away; } atomic_dec(&UisUtils_Registered_Services); rc = 1; /* success */ Away: if (!rc) - LOGERR("failed to unregister type %s.\n", - GUID_format1(&switchTypeGuid, s)); + LOGERR("failed to unregister type %pUL.\n", &switchTypeGuid); return rc; } EXPORT_SYMBOL_GPL(uisctrl_unregister_req_handler_ex); @@ -281,7 +273,7 @@ static LIST_HEAD(ReqHandlerInfo_list); /* list of ReqHandlerInfo_t */ static DEFINE_SPINLOCK(ReqHandlerInfo_list_lock); ReqHandlerInfo_t * -ReqHandlerAdd(GUID switchTypeGuid, +ReqHandlerAdd( uuid_le switchTypeGuid, const char *switch_type_name, int (*controlfunc)(struct io_msgs *), unsigned long min_channel_bytes, @@ -310,16 +302,14 @@ ReqHandlerAdd(GUID switchTypeGuid, } ReqHandlerInfo_t * -ReqHandlerFind(GUID switchTypeGuid) +ReqHandlerFind( uuid_le switchTypeGuid ) { struct list_head *lelt, *tmp; ReqHandlerInfo_t *entry = NULL; spin_lock(&ReqHandlerInfo_list_lock); list_for_each_safe(lelt, tmp, &ReqHandlerInfo_list) { entry = list_entry(lelt, ReqHandlerInfo_t, list_link); - if (memcmp - (&entry->switchTypeGuid, &switchTypeGuid, - sizeof(GUID)) == 0) { + if (uuid_le_cmp( entry->switchTypeGuid, switchTypeGuid ) == 0) { spin_unlock(&ReqHandlerInfo_list_lock); return entry; } @@ -329,7 +319,7 @@ ReqHandlerFind(GUID switchTypeGuid) } int -ReqHandlerDel(GUID switchTypeGuid) +ReqHandlerDel( uuid_le switchTypeGuid ) { struct list_head *lelt, *tmp; ReqHandlerInfo_t *entry = NULL; @@ -337,9 +327,7 @@ ReqHandlerDel(GUID switchTypeGuid) spin_lock(&ReqHandlerInfo_list_lock); list_for_each_safe(lelt, tmp, &ReqHandlerInfo_list) { entry = list_entry(lelt, ReqHandlerInfo_t, list_link); - if (memcmp - (&entry->switchTypeGuid, &switchTypeGuid, - sizeof(GUID)) == 0) { + if (uuid_le_cmp( entry->switchTypeGuid, switchTypeGuid ) == 0) { list_del(lelt); kfree(entry); rc++; diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 8e34650..025fa86 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -364,7 +364,7 @@ static int add_vhba(struct add_virt_guestpart *addparams) memcpy_fromio(&net.zoneGuid, \ &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ chanptr)->vnic.zoneGuid, \ - sizeof(GUID)); \ + sizeof(uuid_le)); \ } /* adds a vnic @@ -390,14 +390,10 @@ add_vnic(struct add_virt_guestpart *addparams) GET_BUS_DEV(addparams->busNo); - LOGINF("Adding vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x rcvbufs:%d mtu:%d chanptr:%p{%-8.8lx-%-4.4x-%-4.4x-%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x}\n", + LOGINF("Adding vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x rcvbufs:%d mtu:%d chanptr:%p%pUL\n", net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], net.mac_addr[3], net.mac_addr[4], net.mac_addr[5], net.num_rcv_bufs, net.mtu, - addparams->chanptr, (ulong) net.zoneGuid.data1, net.zoneGuid.data2, - net.zoneGuid.data3, net.zoneGuid.data4[0], net.zoneGuid.data4[1], - net.zoneGuid.data4[2], net.zoneGuid.data4[3], - net.zoneGuid.data4[4], net.zoneGuid.data4[5], - net.zoneGuid.data4[6], net.zoneGuid.data4[7]); + addparams->chanptr, &(net.zoneGuid) ); i = virtpci_device_add(vbus, VIRTNIC_TYPE, addparams, NULL, &net); if (i) { LOGINF("Added vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", @@ -1509,7 +1505,7 @@ static ssize_t virt_proc_write(struct file *file, const char __user *buffer, struct add_virt_guestpart addparams; struct del_vbus_guestpart busdelparams; struct del_virt_guestpart delparams; - GUID dummyGuid = GUID0; + #ifdef STORAGE_CHANNEL U64 storagechannel; #endif @@ -1560,7 +1556,7 @@ static ssize_t virt_proc_write(struct file *file, const char __user *buffer, __pa(chanptr), MIN_IO_CHANNEL_SIZE, 1, /* test msg */ - dummyGuid, /* inst guid */ + NULL_UUID_LE, /* inst guid */ NULL)) { /*interrupt info */ LOGERR("FAILED to inject add vnic\n"); return -EFAULT; diff --git a/drivers/staging/unisys/virtpci/virtpci.h b/drivers/staging/unisys/virtpci/virtpci.h index b8fd07b..70646b2 100644 --- a/drivers/staging/unisys/virtpci/virtpci.h +++ b/drivers/staging/unisys/virtpci/virtpci.h @@ -41,7 +41,7 @@ struct net_adap_info { u8 mac_addr[MAX_MACADDR_LEN]; int num_rcv_bufs; unsigned mtu; - GUID zoneGuid; + uuid_le zoneGuid; }; typedef enum { diff --git a/drivers/staging/unisys/visorchannel/visorchannel.h b/drivers/staging/unisys/visorchannel/visorchannel.h index 62d29a2..7daba2a 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel.h +++ b/drivers/staging/unisys/visorchannel/visorchannel.h @@ -38,15 +38,15 @@ typedef struct VISORCHANNEL_Tag VISORCHANNEL; * In this case, the values can simply be read from the channel header. */ VISORCHANNEL *visorchannel_create(HOSTADDRESS physaddr, - ulong channelBytes, GUID guid); + ulong channelBytes, uuid_le guid); VISORCHANNEL *visorchannel_create_overlapped(ulong channelBytes, VISORCHANNEL *parent, ulong off, - GUID guid); + uuid_le guid); VISORCHANNEL *visorchannel_create_with_lock(HOSTADDRESS physaddr, - ulong channelBytes, GUID guid); + ulong channelBytes, uuid_le guid); VISORCHANNEL *visorchannel_create_overlapped_with_lock(ulong channelBytes, VISORCHANNEL *parent, - ulong off, GUID guid); + ulong off, uuid_le guid); void visorchannel_destroy(VISORCHANNEL *channel); int visorchannel_read(VISORCHANNEL *channel, ulong offset, void *local, ulong nbytes); @@ -64,9 +64,9 @@ ulong visorchannel_get_nbytes(VISORCHANNEL *channel); char *visorchannel_id(VISORCHANNEL *channel, char *s); char *visorchannel_zoneid(VISORCHANNEL *channel, char *s); U64 visorchannel_get_clientpartition(VISORCHANNEL *channel); -GUID visorchannel_get_GUID(VISORCHANNEL *channel); +uuid_le visorchannel_get_GUID(VISORCHANNEL *channel); MEMREGION *visorchannel_get_memregion(VISORCHANNEL *channel); -char *visorchannel_GUID_id(GUID *guid, char *s); +char *visorchannel_GUID_id(uuid_le *guid, char *s); void visorchannel_debug(VISORCHANNEL *channel, int nQueues, struct seq_file *seq, U32 off); void visorchannel_dump_section(VISORCHANNEL *chan, char *s, diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 0536816..38b123f 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -22,16 +22,17 @@ * a CM2 implementation and a direct memory implementation.) */ +#include <linux/uuid.h> + #include "globals.h" #include "visorchannel.h" -#include "guidutils.h" #define MYDRVNAME "visorchannel" struct VISORCHANNEL_Tag { MEMREGION *memregion; /* from visor_memregion_create() */ CHANNEL_HEADER chan_hdr; - GUID guid; + uuid_le guid; ulong size; BOOL needs_lock; spinlock_t insert_lock; @@ -50,7 +51,7 @@ struct VISORCHANNEL_Tag { */ static VISORCHANNEL * visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, - VISORCHANNEL *parent, ulong off, GUID guid, + VISORCHANNEL *parent, ulong off, uuid_le guid, BOOL needs_lock) { VISORCHANNEL *p = NULL; @@ -90,7 +91,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, if (channelBytes == 0) /* we had better be a CLIENT of this channel */ channelBytes = (ulong) p->chan_hdr.Size; - if (STRUCTSEQUAL(guid, Guid0)) + if ( uuid_le_cmp(guid, NULL_UUID_LE) == 0 ) /* we had better be a CLIENT of this channel */ guid = p->chan_hdr.Type; if (visor_memregion_resize(p->memregion, channelBytes) < 0) { @@ -114,7 +115,7 @@ Away: } VISORCHANNEL * -visorchannel_create(HOSTADDRESS physaddr, ulong channelBytes, GUID guid) +visorchannel_create(HOSTADDRESS physaddr, ulong channelBytes, uuid_le guid) { return visorchannel_create_guts(physaddr, channelBytes, NULL, 0, guid, FALSE); @@ -123,7 +124,7 @@ EXPORT_SYMBOL_GPL(visorchannel_create); VISORCHANNEL * visorchannel_create_with_lock(HOSTADDRESS physaddr, ulong channelBytes, - GUID guid) + uuid_le guid) { return visorchannel_create_guts(physaddr, channelBytes, NULL, 0, guid, TRUE); @@ -132,7 +133,7 @@ EXPORT_SYMBOL_GPL(visorchannel_create_with_lock); VISORCHANNEL * visorchannel_create_overlapped(ulong channelBytes, - VISORCHANNEL *parent, ulong off, GUID guid) + VISORCHANNEL *parent, ulong off, uuid_le guid) { return visorchannel_create_guts(0, channelBytes, parent, off, guid, FALSE); @@ -142,7 +143,7 @@ EXPORT_SYMBOL_GPL(visorchannel_create_overlapped); VISORCHANNEL * visorchannel_create_overlapped_with_lock(ulong channelBytes, VISORCHANNEL *parent, ulong off, - GUID guid) + uuid_le guid) { return visorchannel_create_guts(0, channelBytes, parent, off, guid, TRUE); @@ -177,9 +178,10 @@ visorchannel_get_nbytes(VISORCHANNEL *channel) EXPORT_SYMBOL_GPL(visorchannel_get_nbytes); char * -visorchannel_GUID_id(GUID *guid, char *s) +visorchannel_GUID_id(uuid_le *guid, char *s) { - return GUID_format1(guid, s); + sprintf( s, "%pUL", guid ); + return s; } EXPORT_SYMBOL_GPL(visorchannel_GUID_id); @@ -204,7 +206,7 @@ visorchannel_get_clientpartition(VISORCHANNEL *channel) } EXPORT_SYMBOL_GPL(visorchannel_get_clientpartition); -GUID +uuid_le visorchannel_get_GUID(VISORCHANNEL *channel) { return channel->guid; @@ -558,7 +560,6 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, MEMREGION *memregion = NULL; CHANNEL_HEADER hdr; CHANNEL_HEADER *phdr = &hdr; - char s[99]; int i = 0; int errcode = 0; @@ -588,9 +589,8 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, nbytes = (ulong) (phdr->Size); seq_printf(seq, "--- Begin channel @0x%-16.16Lx for 0x%lx bytes (region=0x%lx bytes) ---\n", addr + off, nbytes, nbytes_region); - seq_printf(seq, "Type = %s\n", GUID_format2(&phdr->Type, s)); - seq_printf(seq, "ZoneGuid = %s\n", - GUID_format2(&phdr->ZoneGuid, s)); + seq_printf(seq, "Type = %pUL\n", &(phdr->Type) ); + seq_printf(seq, "ZoneGuid = %pUL\n", &(phdr->ZoneGuid) ); seq_printf(seq, "Signature = 0x%-16.16Lx\n", (long long) phdr->Signature); seq_printf(seq, "LegacyState = %lu\n", (ulong) phdr->LegacyState); diff --git a/drivers/staging/unisys/visorchannel/visorchannel_main.c b/drivers/staging/unisys/visorchannel/visorchannel_main.c index 482ee0a..b30b097 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_main.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_main.c @@ -19,10 +19,11 @@ * This is a module "wrapper" around visorchannel_funcs. */ +#include <linux/uuid.h> + #include "globals.h" #include "channel.h" #include "visorchannel.h" -#include "guidutils.h" #define MYDRVNAME "visorchannel" diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index b408d41..58cad46 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -191,7 +191,7 @@ parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes) return (void *) ctx->data; } -GUID +uuid_le parser_id_get(PARSER_CONTEXT *ctx) { ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL; @@ -199,7 +199,7 @@ parser_id_get(PARSER_CONTEXT *ctx) if (ctx == NULL) { ERRDRV("%s (%s:%d) - no context", __func__, __FILE__, __LINE__); - return Guid0; + return NULL_UUID_LE; } phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data); return phdr->Id; diff --git a/drivers/staging/unisys/visorchipset/parser.h b/drivers/staging/unisys/visorchipset/parser.h index a0cc50a..3bd6211 100644 --- a/drivers/staging/unisys/visorchipset/parser.h +++ b/drivers/staging/unisys/visorchipset/parser.h @@ -37,7 +37,7 @@ PARSER_CONTEXT *parser_init_byteStream(U64 addr, U32 bytes, BOOL isLocal, void parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string); void *parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize); void *parser_string_get(PARSER_CONTEXT *ctx); -GUID parser_id_get(PARSER_CONTEXT *ctx); +uuid_le parser_id_get(PARSER_CONTEXT *ctx); char *parser_simpleString_get(PARSER_CONTEXT *ctx); void *parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes); void parser_done(PARSER_CONTEXT *ctx); diff --git a/drivers/staging/unisys/visorchipset/testing.h b/drivers/staging/unisys/visorchipset/testing.h index a44f555..ca10280 100644 --- a/drivers/staging/unisys/visorchipset/testing.h +++ b/drivers/staging/unisys/visorchipset/testing.h @@ -28,10 +28,10 @@ void test_manufacture_vnic_client_add(void *p); void test_manufacture_vnic_client_add_phys(HOSTADDRESS addr); void test_manufacture_preamble_messages(void); void test_manufacture_device_attach(ulong busNo, ulong devNo); -void test_manufacture_device_add(ulong busNo, ulong devNo, GUID dataTypeGuid, +void test_manufacture_device_add(ulong busNo, ulong devNo, uuid_le dataTypeGuid, void *pChannel); void test_manufacture_add_bus(ulong busNo, ulong maxDevices, - GUID id, u8 *name, BOOL isServer); + uuid_le id, u8 *name, BOOL isServer); void test_manufacture_device_destroy(ulong busNo, ulong devNo); void test_manufacture_bus_destroy(ulong busNo); void test_manufacture_detach_externalPort(ulong switchNo, ulong externalPortNo); diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h index d4bf203..a3770e4 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset.h +++ b/drivers/staging/unisys/visorchipset/visorchipset.h @@ -63,8 +63,8 @@ typedef struct { HOSTADDRESS channelAddr; struct InterruptInfo intr; U64 nChannelBytes; - GUID channelTypeGuid; - GUID channelInstGuid; + uuid_le channelTypeGuid; + uuid_le channelInstGuid; } VISORCHIPSET_CHANNEL_INFO; @@ -77,7 +77,7 @@ typedef struct { struct list_head entry; U32 busNo; U32 devNo; - GUID devInstGuid; + uuid_le devInstGuid; VISORCHIPSET_STATE state; VISORCHIPSET_CHANNEL_INFO chanInfo; U32 Reserved1; /* CONTROLVM_ID */ @@ -125,7 +125,7 @@ typedef struct { U32 busNo; VISORCHIPSET_STATE state; VISORCHIPSET_CHANNEL_INFO chanInfo; - GUID partitionGuid; + uuid_le partitionGuid; U64 partitionHandle; U8 *name; /* UTF8 */ U8 *description; /* UTF8 */ @@ -161,7 +161,7 @@ findbus(struct list_head *list, U32 busNo) typedef struct { U32 switchNo; VISORCHIPSET_STATE state; - GUID switchTypeGuid; + uuid_le switchTypeGuid; U8 *authService1; U8 *authService2; U8 *authService3; @@ -181,7 +181,7 @@ typedef struct { U32 switchNo; U32 externalPortNo; VISORCHIPSET_STATE state; - GUID networkZoneGuid; + uuid_le networkZoneGuid; int pdPort; U8 *ip; U8 *ipNetmask; @@ -224,7 +224,7 @@ typedef struct { void (*device_destroy)(ulong busNo, ulong devNo); void (*device_pause)(ulong busNo, ulong devNo); void (*device_resume)(ulong busNo, ulong devNo); - int (*get_channel_info)(GUID typeGuid, ulong *minSize, + int (*get_channel_info)(uuid_le typeGuid, ulong *minSize, ulong *maxSize); } VISORCHIPSET_BUSDEV_NOTIFIERS; diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 8252ca1..3544857 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -15,6 +15,11 @@ * details. */ +#include <linux/nls.h> +#include <linux/netdevice.h> +#include <linux/platform_device.h> +#include <linux/uuid.h> + #include "globals.h" #include "controlvm.h" #include "visorchipset.h" @@ -26,15 +31,10 @@ #include "parser.h" #include "uniklog.h" #include "uisutils.h" -#include "guidutils.h" #include "controlvmcompletionstatus.h" #include "guestlinuxdebug.h" #include "filexfer.h" -#include <linux/nls.h> -#include <linux/netdevice.h> -#include <linux/platform_device.h> - #define CURRENT_FILE_PC VISOR_CHIPSET_PC_visorchipset_main_c #define TEST_VNIC_PHYSITF "eth0" /* physical network itf for * vnic loopback test */ @@ -82,7 +82,7 @@ typedef struct { static CONTROLVM_MESSAGE_HEADER g_DiagMsgHdr; static CONTROLVM_MESSAGE_HEADER g_ChipSetMsgHdr; static CONTROLVM_MESSAGE_HEADER g_DelDumpMsgHdr; -static const GUID UltraDiagPoolChannelProtocolGuid = +static const uuid_le UltraDiagPoolChannelProtocolGuid = ULTRA_DIAG_POOL_CHANNEL_PROTOCOL_GUID; /* 0xffffff is an invalid Bus/Device number */ static ulong g_diagpoolBusNo = 0xffffff; @@ -93,15 +93,12 @@ static CONTROLVM_MESSAGE_PACKET g_DeviceChangeStatePacket; * "visorhackbus") */ #define FOR_VISORHACKBUS(channel_type_guid) \ - ((memcmp(&channel_type_guid, &UltraVnicChannelProtocolGuid, \ - sizeof(GUID)) == 0) || \ - (memcmp(&channel_type_guid, &UltraVhbaChannelProtocolGuid, \ - sizeof(GUID)) == 0)) + ((uuid_le_cmp( channel_type_guid, UltraVnicChannelProtocolGuid ) == 0) || \ + (uuid_le_cmp( channel_type_guid, UltraVhbaChannelProtocolGuid ) == 0)) #define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid))) #define is_diagpool_channel(channel_type_guid) \ - (memcmp(&channel_type_guid, \ - &UltraDiagPoolChannelProtocolGuid, sizeof(GUID)) == 0) + (uuid_le_cmp( channel_type_guid, UltraDiagPoolChannelProtocolGuid ) == 0) typedef enum { PARTPROP_invalid, _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel