Message ID | 1409235244-25783-16-git-send-email-ard.biesheuvel@linaro.org |
---|---|
State | New |
Headers | show |
> -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: 28 August 2014 15:14 > To: lersek@redhat.com; Olivier Martin; edk2- > devel@lists.sourceforge.net; peter.maydell@linaro.org; > christoffer.dall@linaro.org; drjones@redhat.com; > ilias.biris@linaro.org; leif.lindholm@linaro.org > Cc: Ard Biesheuvel > Subject: [PATCH v4 15/16] ArmVirtualizationPkg: add driver for QEMU's > NOR flash > > This adds an implementation of NorFlashPlatformLib that exposes the > two 64 MB NOR flash banks that are provided by QEMU's mach-virt > emulation both in 32-bit and 64-bit mode. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Reviewed-by: Laszlo Ersek <lersek@redhat.com> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > --- > .../Library/NorFlashQemuLib/NorFlashQemuLib.c | 63 > ++++++++++++++++++++++ > .../Library/NorFlashQemuLib/NorFlashQemuLib.inf | 35 ++++++++++++ > 2 files changed, 98 insertions(+) > create mode 100644 > ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQem > uLib.c > create mode 100644 > ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQem > uLib.inf > > diff --git > a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQ > emuLib.c > b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQ > emuLib.c > new file mode 100644 > index 000000000000..1e50ed9d9b1b > --- /dev/null > +++ > b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQ > emuLib.c > @@ -0,0 +1,63 @@ > +/** @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. > + > + **/ > + > +#ifndef _NORFLASHQEMULIB_H_ > +#define _NORFLASHQEMULIB_H_ > + > +#include <ArmPlatform.h> > + > +typedef struct { > + UINTN DeviceBaseAddress; // Start address of the Device > Base Address (DBA) > + UINTN RegionBaseAddress; // Start address of one single > region > + UINTN Size; > + UINTN BlockSize; > + EFI_GUID Guid; > +} NOR_FLASH_DESCRIPTION; Why did you have to duplicate this structure definition? > +EFI_STATUS > +NorFlashPlatformInitialization ( > + VOID > + ) > +{ > + return EFI_SUCCESS; > +} > + > +NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { > + { > + QEMU_NOR0_BASE, > + QEMU_NOR0_BASE, > + QEMU_NOR0_SIZE, > + QEMU_NOR_BSIZE, > + {0xF9B94AE2, 0x8BA6, 0x409B, {0x9D, 0x56, 0xB9, 0xB4, 0x17, 0xF5, > 0x3C, 0xB3}} > + }, { > + QEMU_NOR1_BASE, > + QEMU_NOR1_BASE, > + QEMU_NOR1_SIZE, > + QEMU_NOR_BSIZE, > + {0x8047DB4B, 0x7E9C, 0x4C0C, {0x8E, 0xBC, 0xDF, 0xBB, 0xAA, 0xCA, > 0xCE, 0x8F}} > + } > +}; > + > +EFI_STATUS > +NorFlashPlatformGetDevices ( > + OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions, > + OUT UINT32 *Count > + ) > +{ > + *NorFlashDescriptions = mNorFlashDevices; > + *Count = sizeof (mNorFlashDevices) / sizeof (mNorFlashDevices[0]); > + return EFI_SUCCESS; > +} > + > +#endif /* _NORFLASHPLATFORMLIB_H_ */ > diff --git > a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQ > emuLib.inf > b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQ > emuLib.inf > new file mode 100644 > index 000000000000..8717df5070d1 > --- /dev/null > +++ > b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQ > emuLib.inf > @@ -0,0 +1,35 @@ > +#/** @file > +# > +# Component description file for NorFlashQemuLib module > +# > +# 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. > +# > +#**/ > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = NorFlashQemuLib > + FILE_GUID = 339B7829-4C5F-4EFC-B2DD- > 5050E530DECE > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = NorFlashPlatformLib > + > +[Sources.common] > + NorFlashQemuLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + ArmPlatformPkg/ArmPlatformPkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + IoLib > -- > 1.8.3.2 > If you could fix the line endings too (CRLF instead of unix line endings)? ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c new file mode 100644 index 000000000000..1e50ed9d9b1b --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c @@ -0,0 +1,63 @@ +/** @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. + + **/ + +#ifndef _NORFLASHQEMULIB_H_ +#define _NORFLASHQEMULIB_H_ + +#include <ArmPlatform.h> + +typedef struct { + UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA) + UINTN RegionBaseAddress; // Start address of one single region + UINTN Size; + UINTN BlockSize; + EFI_GUID Guid; +} NOR_FLASH_DESCRIPTION; + +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + return EFI_SUCCESS; +} + +NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { + { + QEMU_NOR0_BASE, + QEMU_NOR0_BASE, + QEMU_NOR0_SIZE, + QEMU_NOR_BSIZE, + {0xF9B94AE2, 0x8BA6, 0x409B, {0x9D, 0x56, 0xB9, 0xB4, 0x17, 0xF5, 0x3C, 0xB3}} + }, { + QEMU_NOR1_BASE, + QEMU_NOR1_BASE, + QEMU_NOR1_SIZE, + QEMU_NOR_BSIZE, + {0x8047DB4B, 0x7E9C, 0x4C0C, {0x8E, 0xBC, 0xDF, 0xBB, 0xAA, 0xCA, 0xCE, 0x8F}} + } +}; + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions, + OUT UINT32 *Count + ) +{ + *NorFlashDescriptions = mNorFlashDevices; + *Count = sizeof (mNorFlashDevices) / sizeof (mNorFlashDevices[0]); + return EFI_SUCCESS; +} + +#endif /* _NORFLASHPLATFORMLIB_H_ */ diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf new file mode 100644 index 000000000000..8717df5070d1 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf @@ -0,0 +1,35 @@ +#/** @file +# +# Component description file for NorFlashQemuLib module +# +# 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. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = NorFlashQemuLib + FILE_GUID = 339B7829-4C5F-4EFC-B2DD-5050E530DECE + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NorFlashPlatformLib + +[Sources.common] + NorFlashQemuLib.c + +[Packages] + MdePkg/MdePkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib