diff mbox series

[edk2,4/5] ArmPlatformPkg: add Null implementation of NorFlashPlatformLib

Message ID 20171205101326.23732-5-ard.biesheuvel@linaro.org
State Accepted
Commit 4ab99aa266454ea35b630fed599034ff235c2796
Headers show
Series ArmPlatformPkg: create standalone .dsc file | expand

Commit Message

Ard Biesheuvel Dec. 5, 2017, 10:13 a.m. UTC
In order to be able to build ArmPlatformPkg components outside of
the context of a particular platform, add Null implementation of
NorFlashPlatformLib.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c   | 34 ++++++++++++++++++++
 ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf | 30 +++++++++++++++++
 2 files changed, 64 insertions(+)

-- 
2.11.0

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

Comments

Leif Lindholm Dec. 8, 2017, 4:07 p.m. UTC | #1
On Tue, Dec 05, 2017 at 10:13:25AM +0000, Ard Biesheuvel wrote:
> In order to be able to build ArmPlatformPkg components outside of

> the context of a particular platform, add Null implementation of

> NorFlashPlatformLib.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Question/comment:
Not only ARM Ltd. platforms implement this API.
Would it be worth moving this (as well as
ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h) into EmbeddedPkg
and actually documenting the inputs/outputs?

/
    Leif

> ---

>  ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c   | 34 ++++++++++++++++++++

>  ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf | 30 +++++++++++++++++

>  2 files changed, 64 insertions(+)

> 

> diff --git a/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c

> new file mode 100644

> index 000000000000..264d18719763

> --- /dev/null

> +++ b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c

> @@ -0,0 +1,34 @@

> +/** @file

> +

> + Copyright (c) 2014, Linaro Ltd. 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.

> +

> + **/

> +

> +#include <Library/NorFlashPlatformLib.h>

> +

> +EFI_STATUS

> +NorFlashPlatformInitialization (

> +  VOID

> +  )

> +{

> +  return EFI_SUCCESS;

> +}

> +

> +EFI_STATUS

> +NorFlashPlatformGetDevices (

> +  OUT NOR_FLASH_DESCRIPTION   **NorFlashDescriptions,

> +  OUT UINT32                  *Count

> +  )

> +{

> +  *NorFlashDescriptions = NULL;

> +  *Count = 0;

> +  return EFI_SUCCESS;

> +}

> diff --git a/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf

> new file mode 100644

> index 000000000000..777a629678e1

> --- /dev/null

> +++ b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf

> @@ -0,0 +1,30 @@

> +#/** @file

> +#

> +#  Component description file for NorFlashPlatformNullLib module

> +#

> +#  Copyright (c) 2017, Linaro Ltd. 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.

> +#

> +#**/

> +

> +[Defines]

> +  INF_VERSION                    = 0x00010005

> +  BASE_NAME                      = NorFlashPlatformNullLib

> +  FILE_GUID                      = 29b733ad-d066-4df6-8a89-b9df1beb818a

> +  MODULE_TYPE                    = DXE_DRIVER

> +  VERSION_STRING                 = 1.0

> +  LIBRARY_CLASS                  = NorFlashPlatformLib

> +

> +[Sources.common]

> +  NorFlashPlatformNullLib.c

> +

> +[Packages]

> +  MdePkg/MdePkg.dec

> +  ArmPlatformPkg/ArmPlatformPkg.dec

> -- 

> 2.11.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Dec. 8, 2017, 4:13 p.m. UTC | #2
On 8 December 2017 at 16:07, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Tue, Dec 05, 2017 at 10:13:25AM +0000, Ard Biesheuvel wrote:

>> In order to be able to build ArmPlatformPkg components outside of

>> the context of a particular platform, add Null implementation of

>> NorFlashPlatformLib.

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>

> Question/comment:

> Not only ARM Ltd. platforms implement this API.

> Would it be worth moving this (as well as

> ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h) into EmbeddedPkg

> and actually documenting the inputs/outputs?

>


I'd rather move away from the monolithical NOR flash drivers derived
from ArmPlatformPkg/Drivers/NorFlashDxe, and move to split SPI host
controller drivers and a generic SPI NOR flash driver based on
NorFlashInfoLib. That's a rather sizable chunk of work, though, and
I'm not sure when this will ever get done or by whom.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Dec. 8, 2017, 4:17 p.m. UTC | #3
On Fri, Dec 08, 2017 at 04:13:10PM +0000, Ard Biesheuvel wrote:
> On 8 December 2017 at 16:07, Leif Lindholm <leif.lindholm@linaro.org> wrote:

> > On Tue, Dec 05, 2017 at 10:13:25AM +0000, Ard Biesheuvel wrote:

> >> In order to be able to build ArmPlatformPkg components outside of

> >> the context of a particular platform, add Null implementation of

> >> NorFlashPlatformLib.

> >>

> >> Contributed-under: TianoCore Contribution Agreement 1.1

> >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> >

> > Question/comment:

> > Not only ARM Ltd. platforms implement this API.

> > Would it be worth moving this (as well as

> > ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h) into EmbeddedPkg

> > and actually documenting the inputs/outputs?

> 

> I'd rather move away from the monolithical NOR flash drivers derived

> from ArmPlatformPkg/Drivers/NorFlashDxe, and move to split SPI host

> controller drivers and a generic SPI NOR flash driver based on

> NorFlashInfoLib. That's a rather sizable chunk of work, though, and

> I'm not sure when this will ever get done or by whom.


Sure.
I'd complain if you were trying to move it into
edk2-platforms/Platform/ARM, but leaving this in ArmPlatformPkg seems
ok for a non-specified transitional period.

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

Patch

diff --git a/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c
new file mode 100644
index 000000000000..264d18719763
--- /dev/null
+++ b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.c
@@ -0,0 +1,34 @@ 
+/** @file
+
+ Copyright (c) 2014, Linaro Ltd. 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.
+
+ **/
+
+#include <Library/NorFlashPlatformLib.h>
+
+EFI_STATUS
+NorFlashPlatformInitialization (
+  VOID
+  )
+{
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+NorFlashPlatformGetDevices (
+  OUT NOR_FLASH_DESCRIPTION   **NorFlashDescriptions,
+  OUT UINT32                  *Count
+  )
+{
+  *NorFlashDescriptions = NULL;
+  *Count = 0;
+  return EFI_SUCCESS;
+}
diff --git a/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf
new file mode 100644
index 000000000000..777a629678e1
--- /dev/null
+++ b/ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf
@@ -0,0 +1,30 @@ 
+#/** @file
+#
+#  Component description file for NorFlashPlatformNullLib module
+#
+#  Copyright (c) 2017, Linaro Ltd. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = NorFlashPlatformNullLib
+  FILE_GUID                      = 29b733ad-d066-4df6-8a89-b9df1beb818a
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = NorFlashPlatformLib
+
+[Sources.common]
+  NorFlashPlatformNullLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec