diff mbox

[edk2,2/2] MdePkg: Add WiFi device path definition and its node/text conversion

Message ID CAKv+Gu_RDYKVaoD=ENzqu2M8CpqKnTbep6KVSwU459iQCq13Pg@mail.gmail.com
State New
Headers show

Commit Message

Ard Biesheuvel May 20, 2015, 7:14 a.m. UTC
On 15 May 2015 at 02:58, Hao Wu <hao.a.wu@intel.com> wrote:
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> Reviewed-by: Ye Ting <ting.ye@intel.com>

This patch uses UINT8* and CHAR8* interchangeably, which breaks the
build on ARM since unqualified CHAR is signed not unsigned.

Please fix by adding this patch on top:



Regards,
Ard.



> ---
>  MdePkg/Include/Protocol/DevicePath.h               | 14 ++++++++++
>  .../Library/UefiDevicePathLib/DevicePathFromText.c | 31 ++++++++++++++++++++++
>  .../Library/UefiDevicePathLib/DevicePathToText.c   | 28 +++++++++++++++++++
>  3 files changed, 73 insertions(+)
>
> diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h
> index 1dbb1a1..7b9a4e5 100644
> --- a/MdePkg/Include/Protocol/DevicePath.h
> +++ b/MdePkg/Include/Protocol/DevicePath.h
> @@ -895,6 +895,18 @@ typedef struct {
>    BLUETOOTH_ADDRESS               BD_ADDR;
>  } BLUETOOTH_DEVICE_PATH;
>
> +///
> +/// Wi-Fi Device Path SubType.
> +///
> +#define MSG_WIFI_DP               0x1C
> +typedef struct {
> +  EFI_DEVICE_PATH_PROTOCOL        Header;
> +  ///
> +  /// Service set identifier. A 32-byte octets string.
> +  ///
> +  UINT8                           SSId[32];
> +} WIFI_DEVICE_PATH;
> +
>  //
>  // Media Device Path
>  //
> @@ -1145,6 +1157,7 @@ typedef union {
>    NVME_NAMESPACE_DEVICE_PATH                 NvmeNamespace;
>    URI_DEVICE_PATH                            Uri;
>    BLUETOOTH_DEVICE_PATH                      Bluetooth;
> +  WIFI_DEVICE_PATH                           WiFi;
>    UFS_DEVICE_PATH                            Ufs;
>    SD_DEVICE_PATH                             Sd;
>    HARDDRIVE_DEVICE_PATH                      HardDrive;
> @@ -1199,6 +1212,7 @@ typedef union {
>    NVME_NAMESPACE_DEVICE_PATH                 *NvmeNamespace;
>    URI_DEVICE_PATH                            *Uri;
>    BLUETOOTH_DEVICE_PATH                      *Bluetooth;
> +  WIFI_DEVICE_PATH                           *WiFi;
>    UFS_DEVICE_PATH                            *Ufs;
>    SD_DEVICE_PATH                             *Sd;
>    HARDDRIVE_DEVICE_PATH                      *HardDrive;
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> index 3bccad9..c2aa93c 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> @@ -2770,6 +2770,36 @@ DevPathFromTextBluetooth (
>  }
>
>  /**
> +  Converts a text device path node to Wi-Fi device path structure.
> +
> +  @param TextDeviceNode  The input Text device path node.
> +
> +  @return A pointer to the newly-created Wi-Fi device path structure.
> +
> +**/
> +EFI_DEVICE_PATH_PROTOCOL *
> +DevPathFromTextWiFi (
> +  IN CHAR16 *TextDeviceNode
> +  )
> +{
> +  CHAR16                *SSIdStr;
> +  CHAR8                 *AsciiStr;
> +  WIFI_DEVICE_PATH      *WiFiDp;
> +
> +  SSIdStr = GetNextParamStr (&TextDeviceNode);
> +  WiFiDp  = (WIFI_DEVICE_PATH *) CreateDeviceNode (
> +                                   MESSAGING_DEVICE_PATH,
> +                                   MSG_WIFI_DP,
> +                                   (UINT16) sizeof (WIFI_DEVICE_PATH)
> +                                   );
> +
> +  AsciiStr = WiFiDp->SSId;
> +  StrToAscii (SSIdStr, &AsciiStr);
> +
> +  return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;
> +}
> +
> +/**
>    Converts a text device path node to URI device path structure.
>
>    @param TextDeviceNode  The input Text device path node.
> @@ -3244,6 +3274,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
>    {L"Vlan",                    DevPathFromTextVlan                    },
>    {L"Uri",                     DevPathFromTextUri                     },
>    {L"Bluetooth",               DevPathFromTextBluetooth               },
> +  {L"WiFi",                    DevPathFromTextWiFi                    },
>    {L"MediaPath",               DevPathFromTextMediaPath               },
>    {L"HD",                      DevPathFromTextHD                      },
>    {L"CDROM",                   DevPathFromTextCDROM                   },
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> index a4a665b..68b9372 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> @@ -1562,6 +1562,33 @@ DevPathToTextBluetooth (
>  }
>
>  /**
> +  Converts a Wi-Fi device path structure to its string representative.
> +
> +  @param Str             The string representative of input device.
> +  @param DevPath         The input device path structure.
> +  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation
> +                         of the display node is used, where applicable. If DisplayOnly
> +                         is FALSE, then the longer text representation of the display node
> +                         is used.
> +  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text
> +                         representation for a device node can be used, where applicable.
> +
> +**/
> +VOID
> +DevPathToTextWiFi (
> +  IN OUT POOL_PRINT  *Str,
> +  IN VOID            *DevPath,
> +  IN BOOLEAN         DisplayOnly,
> +  IN BOOLEAN         AllowShortcuts
> +  )
> +{
> +  WIFI_DEVICE_PATH      *WiFi;
> +
> +  WiFi = DevPath;
> +  UefiDevicePathLibCatPrint (Str, L"WiFi(%a)", WiFi->SSId);
> +}
> +
> +/**
>    Converts a URI device path structure to its string representative.
>
>    @param Str             The string representative of input device.
> @@ -2021,6 +2048,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
>    {MESSAGING_DEVICE_PATH, MSG_VLAN_DP,                      DevPathToTextVlan           },
>    {MESSAGING_DEVICE_PATH, MSG_URI_DP,                       DevPathToTextUri            },
>    {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP,                 DevPathToTextBluetooth      },
> +  {MESSAGING_DEVICE_PATH, MSG_WIFI_DP,                      DevPathToTextWiFi           },
>    {MEDIA_DEVICE_PATH,     MEDIA_HARDDRIVE_DP,               DevPathToTextHardDrive      },
>    {MEDIA_DEVICE_PATH,     MEDIA_CDROM_DP,                   DevPathToTextCDROM          },
>    {MEDIA_DEVICE_PATH,     MEDIA_VENDOR_DP,                  DevPathToTextVendor         },
> --
> 1.9.5.msysgit.0
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y

Comments

Ard Biesheuvel May 20, 2015, 7:44 a.m. UTC | #1
On 20 May 2015 at 09:40, Wu, Hao A <hao.a.wu@intel.com> wrote:
> Yes, I will fix this problem. Is it more reasonable to use the following patch?
>
> --- a/MdePkg/Include/Protocol/DevicePath.h
> +++ b/MdePkg/Include/Protocol/DevicePath.h
> @@ -904,7 +904,7 @@ typedef struct {
>    ///
>    /// Service set identifier. A 32-byte octets string.
>    ///
> -  UINT8                           SSId[32];
> +  CHAR8                           SSId[32];
>  } WIFI_DEVICE_PATH;
>
>  //
>
> Since SSId is a human readable identifier, so using CHAR8 instead of INT8 sounds better?
>

Yes, that is also fine. I tested the ARM build with your change
instead of mine, and it works fine as well.

Thanks,
Ard.


> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Wednesday, May 20, 2015 3:14 PM
> To: edk2-devel@lists.sourceforge.net; Wu, Hao A; Ye, Ting
> Subject: Re: [edk2] [PATCH 2/2] MdePkg: Add WiFi device path definition and its node/text conversion
>
> On 15 May 2015 at 02:58, Hao Wu <hao.a.wu@intel.com> wrote:
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
>> Reviewed-by: Ye Ting <ting.ye@intel.com>
>
> This patch uses UINT8* and CHAR8* interchangeably, which breaks the
> build on ARM since unqualified CHAR is signed not unsigned.
>
> Please fix by adding this patch on top:
>
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> index c2aa93cedc5e..ac54b88c9116 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> @@ -2793,7 +2793,7 @@ DevPathFromTextWiFi (
>                                     (UINT16) sizeof (WIFI_DEVICE_PATH)
>                                     );
>
> -  AsciiStr = WiFiDp->SSId;
> +  AsciiStr = (CHAR8 *)WiFiDp->SSId;
>    StrToAscii (SSIdStr, &AsciiStr);
>
>    return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;
>
>
> Regards,
> Ard.
>
>
>
>> ---
>>  MdePkg/Include/Protocol/DevicePath.h               | 14 ++++++++++
>>  .../Library/UefiDevicePathLib/DevicePathFromText.c | 31 ++++++++++++++++++++++
>>  .../Library/UefiDevicePathLib/DevicePathToText.c   | 28 +++++++++++++++++++
>>  3 files changed, 73 insertions(+)
>>
>> diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h
>> index 1dbb1a1..7b9a4e5 100644
>> --- a/MdePkg/Include/Protocol/DevicePath.h
>> +++ b/MdePkg/Include/Protocol/DevicePath.h
>> @@ -895,6 +895,18 @@ typedef struct {
>>    BLUETOOTH_ADDRESS               BD_ADDR;
>>  } BLUETOOTH_DEVICE_PATH;
>>
>> +///
>> +/// Wi-Fi Device Path SubType.
>> +///
>> +#define MSG_WIFI_DP               0x1C
>> +typedef struct {
>> +  EFI_DEVICE_PATH_PROTOCOL        Header;
>> +  ///
>> +  /// Service set identifier. A 32-byte octets string.
>> +  ///
>> +  UINT8                           SSId[32];
>> +} WIFI_DEVICE_PATH;
>> +
>>  //
>>  // Media Device Path
>>  //
>> @@ -1145,6 +1157,7 @@ typedef union {
>>    NVME_NAMESPACE_DEVICE_PATH                 NvmeNamespace;
>>    URI_DEVICE_PATH                            Uri;
>>    BLUETOOTH_DEVICE_PATH                      Bluetooth;
>> +  WIFI_DEVICE_PATH                           WiFi;
>>    UFS_DEVICE_PATH                            Ufs;
>>    SD_DEVICE_PATH                             Sd;
>>    HARDDRIVE_DEVICE_PATH                      HardDrive;
>> @@ -1199,6 +1212,7 @@ typedef union {
>>    NVME_NAMESPACE_DEVICE_PATH                 *NvmeNamespace;
>>    URI_DEVICE_PATH                            *Uri;
>>    BLUETOOTH_DEVICE_PATH                      *Bluetooth;
>> +  WIFI_DEVICE_PATH                           *WiFi;
>>    UFS_DEVICE_PATH                            *Ufs;
>>    SD_DEVICE_PATH                             *Sd;
>>    HARDDRIVE_DEVICE_PATH                      *HardDrive;
>> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
>> index 3bccad9..c2aa93c 100644
>> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
>> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
>> @@ -2770,6 +2770,36 @@ DevPathFromTextBluetooth (
>>  }
>>
>>  /**
>> +  Converts a text device path node to Wi-Fi device path structure.
>> +
>> +  @param TextDeviceNode  The input Text device path node.
>> +
>> +  @return A pointer to the newly-created Wi-Fi device path structure.
>> +
>> +**/
>> +EFI_DEVICE_PATH_PROTOCOL *
>> +DevPathFromTextWiFi (
>> +  IN CHAR16 *TextDeviceNode
>> +  )
>> +{
>> +  CHAR16                *SSIdStr;
>> +  CHAR8                 *AsciiStr;
>> +  WIFI_DEVICE_PATH      *WiFiDp;
>> +
>> +  SSIdStr = GetNextParamStr (&TextDeviceNode);
>> +  WiFiDp  = (WIFI_DEVICE_PATH *) CreateDeviceNode (
>> +                                   MESSAGING_DEVICE_PATH,
>> +                                   MSG_WIFI_DP,
>> +                                   (UINT16) sizeof (WIFI_DEVICE_PATH)
>> +                                   );
>> +
>> +  AsciiStr = WiFiDp->SSId;
>> +  StrToAscii (SSIdStr, &AsciiStr);
>> +
>> +  return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;
>> +}
>> +
>> +/**
>>    Converts a text device path node to URI device path structure.
>>
>>    @param TextDeviceNode  The input Text device path node.
>> @@ -3244,6 +3274,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
>>    {L"Vlan",                    DevPathFromTextVlan                    },
>>    {L"Uri",                     DevPathFromTextUri                     },
>>    {L"Bluetooth",               DevPathFromTextBluetooth               },
>> +  {L"WiFi",                    DevPathFromTextWiFi                    },
>>    {L"MediaPath",               DevPathFromTextMediaPath               },
>>    {L"HD",                      DevPathFromTextHD                      },
>>    {L"CDROM",                   DevPathFromTextCDROM                   },
>> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
>> index a4a665b..68b9372 100644
>> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
>> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
>> @@ -1562,6 +1562,33 @@ DevPathToTextBluetooth (
>>  }
>>
>>  /**
>> +  Converts a Wi-Fi device path structure to its string representative.
>> +
>> +  @param Str             The string representative of input device.
>> +  @param DevPath         The input device path structure.
>> +  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation
>> +                         of the display node is used, where applicable. If DisplayOnly
>> +                         is FALSE, then the longer text representation of the display node
>> +                         is used.
>> +  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text
>> +                         representation for a device node can be used, where applicable.
>> +
>> +**/
>> +VOID
>> +DevPathToTextWiFi (
>> +  IN OUT POOL_PRINT  *Str,
>> +  IN VOID            *DevPath,
>> +  IN BOOLEAN         DisplayOnly,
>> +  IN BOOLEAN         AllowShortcuts
>> +  )
>> +{
>> +  WIFI_DEVICE_PATH      *WiFi;
>> +
>> +  WiFi = DevPath;
>> +  UefiDevicePathLibCatPrint (Str, L"WiFi(%a)", WiFi->SSId);
>> +}
>> +
>> +/**
>>    Converts a URI device path structure to its string representative.
>>
>>    @param Str             The string representative of input device.
>> @@ -2021,6 +2048,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
>>    {MESSAGING_DEVICE_PATH, MSG_VLAN_DP,                      DevPathToTextVlan           },
>>    {MESSAGING_DEVICE_PATH, MSG_URI_DP,                       DevPathToTextUri            },
>>    {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP,                 DevPathToTextBluetooth      },
>> +  {MESSAGING_DEVICE_PATH, MSG_WIFI_DP,                      DevPathToTextWiFi           },
>>    {MEDIA_DEVICE_PATH,     MEDIA_HARDDRIVE_DP,               DevPathToTextHardDrive      },
>>    {MEDIA_DEVICE_PATH,     MEDIA_CDROM_DP,                   DevPathToTextCDROM          },
>>    {MEDIA_DEVICE_PATH,     MEDIA_VENDOR_DP,                  DevPathToTextVendor         },
>> --
>> 1.9.5.msysgit.0
>>
>>
>> ------------------------------------------------------------------------------
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM Insight.
>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
diff mbox

Patch

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index c2aa93cedc5e..ac54b88c9116 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -2793,7 +2793,7 @@  DevPathFromTextWiFi (
                                    (UINT16) sizeof (WIFI_DEVICE_PATH)
                                    );

-  AsciiStr = WiFiDp->SSId;
+  AsciiStr = (CHAR8 *)WiFiDp->SSId;
   StrToAscii (SSIdStr, &AsciiStr);

   return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;