[edk2] [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol definitions

Hao Wu posted 2 patches 8 years ago
There is a newer version of this series
[edk2] [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol definitions
Posted by Hao Wu 8 years ago
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdePkg/Include/Protocol/PartitionInfo.h | 78 ++++++++++++++++++++
 MdePkg/MdePkg.dec                       |  3 +
 2 files changed, 81 insertions(+)

diff --git a/MdePkg/Include/Protocol/PartitionInfo.h b/MdePkg/Include/Protocol/PartitionInfo.h
new file mode 100644
index 0000000000..60e46456c6
--- /dev/null
+++ b/MdePkg/Include/Protocol/PartitionInfo.h
@@ -0,0 +1,78 @@
+/** @file
+  This file defines the EFI Partition Information Protocol.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.7
+
+**/
+
+#ifndef __PARTITION_INFO_PROTOCOL_H__
+#define __PARTITION_INFO_PROTOCOL_H__
+
+#include <IndustryStandard/Mbr.h>
+#include <Uefi/UefiGpt.h>
+
+//
+// EFI Partition Information Protocol GUID value
+//
+#define EFI_PARTITION_INFO_PROTOCOL_GUID \
+  { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }};
+
+//
+// Forward reference for pure ANSI compatability
+//
+typedef struct _EFI_PARTITION_INFO_PROTOCOL  EFI_PARTITION_INFO_PROTOCOL;
+
+#define EFI_PARTITION_INFO_PROTOCOL_REVISION     0x0001000
+#define PARTITION_TYPE_OTHER                     0x00
+#define PARTITION_TYPE_MBR                       0x01
+#define PARTITION_TYPE_GPT                       0x02
+
+#pragma pack(1)
+
+///
+/// Partition Information Protocol structure.
+///
+struct _EFI_PARTITION_INFO_PROTOCOL {
+  //
+  // Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
+  //
+  UINT32                     Revision;
+  //
+  // Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or PARTITION_TYPE_OTHER).
+  //
+  UINT32                     Type;
+  //
+  // If 1, partition describes an EFI System Partition.
+  //
+  UINT8                      System;
+  UINT8                      Reserved[7];
+  union {
+    ///
+    /// MBR data
+    ///
+    MBR_PARTITION_RECORD     Mbr;
+    ///
+    /// GPT data
+    ///
+    EFI_PARTITION_ENTRY      Gpt;
+  } Info;
+};
+
+#pragma pack()
+
+///
+/// Partition Information Protocol GUID variable.
+///
+extern EFI_GUID gEfiPartitionInfoProtocolGuid;
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 7a7504b7a3..c48f248526 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1671,6 +1671,9 @@
   ## Include/Protocol/BluetoothLeConfig.h
   gEfiBluetoothLeConfigProtocolGuid         = { 0x8f76da58, 0x1f99, 0x4275, { 0xa4, 0xec, 0x47, 0x56, 0x51, 0x5b, 0x1c, 0xe8 } }
 
+  ## Include/Protocol/PartitionInfo.h
+  gEfiPartitionInfoProtocolGuid             = { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }}
+
   #
   # Protocols defined in Shell2.0
   #
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol definitions
Posted by Ni, Ruiyu 8 years ago
Minor comment:
Why uses forward reference for structure EFI_PARTITION_INFO_PROTOCOL?
The forward reference is because some protocol interfaces need the pointer of protocol structure as This parameter.
I think you can directly use typedef struct {...} EFI_PARTITION_INFO_PROTOCOL.

Thanks/Ray

> -----Original Message-----
> From: Wu, Hao A
> Sent: Thursday, June 22, 2017 4:45 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol
> definitions
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  MdePkg/Include/Protocol/PartitionInfo.h | 78 ++++++++++++++++++++
>  MdePkg/MdePkg.dec                       |  3 +
>  2 files changed, 81 insertions(+)
> 
> diff --git a/MdePkg/Include/Protocol/PartitionInfo.h
> b/MdePkg/Include/Protocol/PartitionInfo.h
> new file mode 100644
> index 0000000000..60e46456c6
> --- /dev/null
> +++ b/MdePkg/Include/Protocol/PartitionInfo.h
> @@ -0,0 +1,78 @@
> +/** @file
> +  This file defines the EFI Partition Information Protocol.
> +
> +  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>  This
> + program and the accompanying materials  are licensed and made
> + available under the terms and conditions of the BSD License  which
> + accompanies this distribution.  The full text of the license may be
> + found at  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +  @par Revision Reference:
> +  This Protocol is introduced in UEFI Specification 2.7
> +
> +**/
> +
> +#ifndef __PARTITION_INFO_PROTOCOL_H__
> +#define __PARTITION_INFO_PROTOCOL_H__
> +
> +#include <IndustryStandard/Mbr.h>
> +#include <Uefi/UefiGpt.h>
> +
> +//
> +// EFI Partition Information Protocol GUID value // #define
> +EFI_PARTITION_INFO_PROTOCOL_GUID \
> +  { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21,
> +0xa1, 0xa0 }};
> +
> +//
> +// Forward reference for pure ANSI compatability // typedef struct
> +_EFI_PARTITION_INFO_PROTOCOL  EFI_PARTITION_INFO_PROTOCOL;
> +
> +#define EFI_PARTITION_INFO_PROTOCOL_REVISION     0x0001000
> +#define PARTITION_TYPE_OTHER                     0x00
> +#define PARTITION_TYPE_MBR                       0x01
> +#define PARTITION_TYPE_GPT                       0x02
> +
> +#pragma pack(1)
> +
> +///
> +/// Partition Information Protocol structure.
> +///
> +struct _EFI_PARTITION_INFO_PROTOCOL {
> +  //
> +  // Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
> +  //
> +  UINT32                     Revision;
> +  //
> +  // Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or
> PARTITION_TYPE_OTHER).
> +  //
> +  UINT32                     Type;
> +  //
> +  // If 1, partition describes an EFI System Partition.
> +  //
> +  UINT8                      System;
> +  UINT8                      Reserved[7];
> +  union {
> +    ///
> +    /// MBR data
> +    ///
> +    MBR_PARTITION_RECORD     Mbr;
> +    ///
> +    /// GPT data
> +    ///
> +    EFI_PARTITION_ENTRY      Gpt;
> +  } Info;
> +};
> +
> +#pragma pack()
> +
> +///
> +/// Partition Information Protocol GUID variable.
> +///
> +extern EFI_GUID gEfiPartitionInfoProtocolGuid;
> +
> +#endif
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> 7a7504b7a3..c48f248526 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -1671,6 +1671,9 @@
>    ## Include/Protocol/BluetoothLeConfig.h
>    gEfiBluetoothLeConfigProtocolGuid         = { 0x8f76da58, 0x1f99, 0x4275,
> { 0xa4, 0xec, 0x47, 0x56, 0x51, 0x5b, 0x1c, 0xe8 } }
> 
> +  ## Include/Protocol/PartitionInfo.h
> +  gEfiPartitionInfoProtocolGuid             = { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80,
> 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }}
> +
>    #
>    # Protocols defined in Shell2.0
>    #
> --
> 2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol definitions
Posted by Wu, Hao A 8 years ago
> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Friday, July 07, 2017 10:27 AM
> To: Wu, Hao A
> Cc: Ni, Ruiyu; Kinney, Michael D; Gao, Liming; edk2-devel@lists.01.org
> Subject: RE: [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol
> definitions
> 
> Minor comment:
> Why uses forward reference for structure EFI_PARTITION_INFO_PROTOCOL?
> The forward reference is because some protocol interfaces need the pointer of
> protocol structure as This parameter.
> I think you can directly use typedef struct {...} EFI_PARTITION_INFO_PROTOCOL.
> 

Got it. Sent a V2 patch according to the comment.

Best Regards,
Hao Wu

> Thanks/Ray
> 
> > -----Original Message-----
> > From: Wu, Hao A
> > Sent: Thursday, June 22, 2017 4:45 PM
> > To: edk2-devel@lists.01.org
> > Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>;
> > Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> > <liming.gao@intel.com>
> > Subject: [PATCH 1/2] MdePkg: Add EFI Partition Information Protocol
> > definitions
> >
> > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> > ---
> >  MdePkg/Include/Protocol/PartitionInfo.h | 78 ++++++++++++++++++++
> >  MdePkg/MdePkg.dec                       |  3 +
> >  2 files changed, 81 insertions(+)
> >
> > diff --git a/MdePkg/Include/Protocol/PartitionInfo.h
> > b/MdePkg/Include/Protocol/PartitionInfo.h
> > new file mode 100644
> > index 0000000000..60e46456c6
> > --- /dev/null
> > +++ b/MdePkg/Include/Protocol/PartitionInfo.h
> > @@ -0,0 +1,78 @@
> > +/** @file
> > +  This file defines the EFI Partition Information Protocol.
> > +
> > +  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>  This
> > + program and the accompanying materials  are licensed and made
> > + available under the terms and conditions of the BSD License  which
> > + accompanies this distribution.  The full text of the license may be
> > + found at  http://opensource.org/licenses/bsd-license.php
> > +
> > +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +
> > +  @par Revision Reference:
> > +  This Protocol is introduced in UEFI Specification 2.7
> > +
> > +**/
> > +
> > +#ifndef __PARTITION_INFO_PROTOCOL_H__
> > +#define __PARTITION_INFO_PROTOCOL_H__
> > +
> > +#include <IndustryStandard/Mbr.h>
> > +#include <Uefi/UefiGpt.h>
> > +
> > +//
> > +// EFI Partition Information Protocol GUID value // #define
> > +EFI_PARTITION_INFO_PROTOCOL_GUID \
> > +  { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21,
> > +0xa1, 0xa0 }};
> > +
> > +//
> > +// Forward reference for pure ANSI compatability // typedef struct
> > +_EFI_PARTITION_INFO_PROTOCOL  EFI_PARTITION_INFO_PROTOCOL;
> > +
> > +#define EFI_PARTITION_INFO_PROTOCOL_REVISION     0x0001000
> > +#define PARTITION_TYPE_OTHER                     0x00
> > +#define PARTITION_TYPE_MBR                       0x01
> > +#define PARTITION_TYPE_GPT                       0x02
> > +
> > +#pragma pack(1)
> > +
> > +///
> > +/// Partition Information Protocol structure.
> > +///
> > +struct _EFI_PARTITION_INFO_PROTOCOL {
> > +  //
> > +  // Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
> > +  //
> > +  UINT32                     Revision;
> > +  //
> > +  // Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or
> > PARTITION_TYPE_OTHER).
> > +  //
> > +  UINT32                     Type;
> > +  //
> > +  // If 1, partition describes an EFI System Partition.
> > +  //
> > +  UINT8                      System;
> > +  UINT8                      Reserved[7];
> > +  union {
> > +    ///
> > +    /// MBR data
> > +    ///
> > +    MBR_PARTITION_RECORD     Mbr;
> > +    ///
> > +    /// GPT data
> > +    ///
> > +    EFI_PARTITION_ENTRY      Gpt;
> > +  } Info;
> > +};
> > +
> > +#pragma pack()
> > +
> > +///
> > +/// Partition Information Protocol GUID variable.
> > +///
> > +extern EFI_GUID gEfiPartitionInfoProtocolGuid;
> > +
> > +#endif
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > 7a7504b7a3..c48f248526 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -1671,6 +1671,9 @@
> >    ## Include/Protocol/BluetoothLeConfig.h
> >    gEfiBluetoothLeConfigProtocolGuid         = { 0x8f76da58, 0x1f99, 0x4275,
> > { 0xa4, 0xec, 0x47, 0x56, 0x51, 0x5b, 0x1c, 0xe8 } }
> >
> > +  ## Include/Protocol/PartitionInfo.h
> > +  gEfiPartitionInfoProtocolGuid             = { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80,
> > 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }}
> > +
> >    #
> >    # Protocols defined in Shell2.0
> >    #
> > --
> > 2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel