* [PATCH v2 edk2-platforms 1/8] Platform/ARM/SgiPkg: Restructure virtio device registration
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 2/8] Platform/ARM/SgiPkg: Add support for virtio net device Vijayenthiran Subramaniam
` (7 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
From: Daniil Egranov <daniil.egranov@arm.com>
SGI platforms support multiple virtio devices. So the existing code, that
supports registration of only the virtio disk, is restructured to
accommodate the registration of additional virtio devices.
In addition to this, PCDs to represent the virtio controller base and
address space size are introduced.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
---
Platform/ARM/SgiPkg/SgiPlatform.dec | 8 ++-
Platform/ARM/SgiPkg/SgiPlatform.dsc | 7 +-
Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 8 ++-
Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h | 21 ++++++
Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 14 +---
Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => VirtioDevices.c} | 67 ++++++++++++--------
6 files changed, 81 insertions(+), 44 deletions(-)
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 916605298d9f..9300337a8d68 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -37,12 +37,16 @@ [Guids.common]
gSgiClarkHeliosAcpiTablesFileGuid = { 0x2af40815, 0xa84e, 0x4de9, { 0x8c, 0x38, 0x91, 0x40, 0xb3, 0x54, 0x40, 0x73 } }
[PcdsFeatureFlag.common]
- # Set this PCD to TRUE to enable virtio support.
- gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE|BOOLEAN|0x00000001
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001
[PcdsFixedAtBuild]
gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002
gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0|UINT64|0x00000003
+ # Virtio Block device
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x00000000|UINT32|0x00000004
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x00000000|UINT32|0x00000005
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|0x00000000|UINT32|0x00000006
+
[Ppis]
gNtFwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 19d2ac3a656a..ffebddc19eff 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -100,7 +100,7 @@ [LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, Libr
################################################################################
[PcdsFeatureFlag.common]
- gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|TRUE
[PcdsFixedAtBuild.common]
gArmTokenSpaceGuid.PcdVFPEnabled|1
@@ -185,6 +185,11 @@ [PcdsFixedAtBuild.common]
# Ethernet
gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x18000000
+ # Virtio Disk
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x1c130000
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x10000
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|202
+
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index d903ed8d3375..f920f6ecafb8 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -20,7 +20,7 @@ [Defines]
[Sources.common]
PlatformDxe.c
- VirtioBlockIo.c
+ VirtioDevices.c
[Packages]
EmbeddedPkg/EmbeddedPkg.dec
@@ -41,7 +41,11 @@ [Guids]
gSgiClarkHeliosAcpiTablesFileGuid
[FeaturePcd]
- gArmSgiTokenSpaceGuid.PcdVirtioSupported
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
+
+[FixedPcd]
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
[Depex]
TRUE
diff --git a/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h b/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
new file mode 100644
index 000000000000..80d3e3ae4f91
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
@@ -0,0 +1,21 @@
+/** @file
+*
+* Copyright (c) 2018, ARM Limited. All rights reserved.
+*
+* 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 __SGI_VIRTIO_DEVICES_FORMSET_H__
+#define __SGI_VIRTIO_DEVICES_FORMSET_H__
+
+#define SGI_VIRTIO_BLOCK_GUID \
+ { 0x5a96cdcd, 0x6116, 0x4929, { 0xb7, 0x01, 0x3a, 0xc2, 0xfb, 0x1c, 0xe2, 0x28 } }
+
+#endif
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index a8708a5c4ce5..aa032c41f686 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -17,9 +17,8 @@
#include <Library/HobLib.h>
#include <SgiPlatform.h>
-EFI_STATUS
-InitVirtioBlockIo (
- IN EFI_HANDLE ImageHandle
+VOID
+InitVirtioDevices (
);
EFI_STATUS
@@ -63,14 +62,7 @@ ArmSgiPkgEntryPoint (
return Status;
}
- Status = EFI_REQUEST_UNLOAD_IMAGE;
- if (FeaturePcdGet (PcdVirtioSupported)) {
- Status = InitVirtioBlockIo (ImageHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
- __FUNCTION__));
- }
- }
+ InitVirtioDevices ();
return Status;
}
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
similarity index 41%
rename from Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
rename to Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
index 5b5863f4b806..4703aec06968 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
@@ -12,6 +12,7 @@
**/
+#include <Guid/SgiVirtioDevicesFormSet.h>
#include <Library/VirtioMmioDeviceLib.h>
#include <Library/DevicePathLib.h>
#include <Library/DebugLib.h>
@@ -20,12 +21,12 @@
#pragma pack (1)
typedef struct {
- VENDOR_DEVICE_PATH Vendor;
+ VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
-} VIRTIO_BLK_DEVICE_PATH;
+} VIRTIO_DEVICE_PATH;
#pragma pack ()
-STATIC VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
+STATIC VIRTIO_DEVICE_PATH mVirtioBlockDevicePath =
{
{
{
@@ -36,7 +37,7 @@ STATIC VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
- EFI_CALLER_ID_GUID,
+ SGI_VIRTIO_BLOCK_GUID,
},
{
END_DEVICE_PATH_TYPE,
@@ -49,33 +50,43 @@ STATIC VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
};
/**
- * Entrypoint for 'VirtioBlockIo' driver
- */
-EFI_STATUS
-InitVirtioBlockIo (
- IN EFI_HANDLE ImageHandle
+ Initialize platform Virtio devices.
+
+ @return None.
+**/
+VOID
+InitVirtioDevices (
)
{
EFI_STATUS Status;
+ STATIC EFI_HANDLE mVirtIoBlkController = NULL;
- Status = gBS->InstallProtocolInterface (&ImageHandle,
- &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
- &mVirtioBlockDevicePath);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Failed to install the EFI_DEVICE_PATH "
- "protocol for the virtio block device (Status == %r)\n",
- __FUNCTION__, Status));
- return Status;
+ // Install protocol interface for storage device
+ if ((FeaturePcdGet (PcdVirtioBlkSupported)) &&
+ (FixedPcdGet32 (PcdVirtioBlkBaseAddress))) {
+ Status = gBS->InstallProtocolInterface (&mVirtIoBlkController,
+ &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
+ &mVirtioBlockDevicePath);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install EFI_DEVICE_PATH protocol "
+ "for Virtio Block device (Status = %r)\n",
+ __FUNCTION__, Status));
+ } else {
+ // Declare the Virtio BlockIo device
+ Status = VirtioMmioInstallDevice (FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+ mVirtIoBlkController);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Unable to find Virtio Block MMIO device "
+ "(Status == %r)\n", __FUNCTION__, Status));
+ gBS->UninstallProtocolInterface (
+ mVirtIoBlkController,
+ &gEfiDevicePathProtocolGuid,
+ &mVirtioBlockDevicePath
+ );
+ } else {
+ DEBUG ((DEBUG_INIT, "%a: Installed Virtio Block device\n",
+ __FUNCTION__));
+ }
+ }
}
-
- Status = VirtioMmioInstallDevice (SGI_EXP_SYSPH_VIRTIO_BLOCK_BASE, ImageHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR,
- "%a: Failed to install Virtio block device (Status == %r)\n",
- __FUNCTION__, Status));
- gBS->UninstallProtocolInterface (ImageHandle,
- &gEfiDevicePathProtocolGuid, &mVirtioBlockDevicePath);
- }
-
- return Status;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 2/8] Platform/ARM/SgiPkg: Add support for virtio net device
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 1/8] Platform/ARM/SgiPkg: Restructure virtio device registration Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 3/8] Sgi575: AcpiTables: Use PCDs for virtio disk Vijayenthiran Subramaniam
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
From: Daniil Egranov <daniil.egranov@arm.com>
Add support for virtio net device by adding PCDs to specify the data
required to setup the virtio net device and register it.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
---
Platform/ARM/SgiPkg/SgiPlatform.dec | 6 +++
Platform/ARM/SgiPkg/SgiPlatform.dsc | 18 +++++--
Platform/ARM/SgiPkg/SgiPlatform.fdf | 4 ++
Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 3 ++
Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h | 3 ++
Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 54 ++++++++++++++++++++
6 files changed, 84 insertions(+), 4 deletions(-)
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 9300337a8d68..10157c7b6eb3 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -38,6 +38,7 @@ [Guids.common]
[PcdsFeatureFlag.common]
gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x00000010
[PcdsFixedAtBuild]
gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002
@@ -48,5 +49,10 @@ [PcdsFixedAtBuild]
gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x00000000|UINT32|0x00000005
gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|0x00000000|UINT32|0x00000006
+ # Virtio Network device
+ gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress|0x00000000|UINT32|0x00000007
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSize|0x00000000|UINT32|0x00000008
+ gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt|0x00000000|UINT32|0x00000009
+
[Ppis]
gNtFwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index ffebddc19eff..7995c7d132d6 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -47,6 +47,7 @@ [LibraryClasses.common]
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+ OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
[LibraryClasses.common.SEC]
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
@@ -101,6 +102,7 @@ [LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, Libr
[PcdsFeatureFlag.common]
gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|TRUE
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|TRUE
[PcdsFixedAtBuild.common]
gArmTokenSpaceGuid.PcdVFPEnabled|1
@@ -182,14 +184,19 @@ [PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|4
gArmPlatformTokenSpaceGuid.PcdClusterCount|2
- # Ethernet
- gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x18000000
-
# Virtio Disk
gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x1c130000
gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x10000
gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|202
+ # Ethernet / Virtio Network
+!ifdef EDK2_ENABLE_SMSC_91X
+ gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x18000000
+!endif
+ gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress|0x1c150000
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSize|0x10000
+ gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt|204
+
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
@@ -294,8 +301,11 @@ [Components.common]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
}
- # SMSC LAN 91C111
+ # SMSC LAN 91C111 / Virtio Network
+!ifdef EDK2_ENABLE_SMSC_91X
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
+!endif
+ OvmfPkg/VirtioNetDxe/VirtioNet.inf
#
# Required by PCI
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 9c0ec1fa43a6..80c3412fd4ad 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -197,7 +197,11 @@ [FV.FvMain]
INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
INF NetworkPkg/TcpDxe/TcpDxe.inf
INF NetworkPkg/IScsiDxe/IScsiDxe.inf
+
+!ifdef EDK2_ENABLE_SMSC_91X
INF EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
+!endif
+ INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
[FV.FVMAIN_COMPACT]
FvAlignment = 16
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index f920f6ecafb8..3283ff045372 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -42,10 +42,13 @@ [Guids]
[FeaturePcd]
gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSupported
[FixedPcd]
gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+ gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSize
[Depex]
TRUE
diff --git a/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h b/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
index 80d3e3ae4f91..b7aab64d7bf7 100644
--- a/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
+++ b/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
@@ -18,4 +18,7 @@
#define SGI_VIRTIO_BLOCK_GUID \
{ 0x5a96cdcd, 0x6116, 0x4929, { 0xb7, 0x01, 0x3a, 0xc2, 0xfb, 0x1c, 0xe2, 0x28 } }
+#define SGI_VIRTIO_NET_GUID \
+ { 0xf5a453e8, 0x5f5f, 0x4e7b, { 0x89, 0x4f, 0x3a, 0x23, 0x74, 0xc7, 0x28, 0xb1 } }
+
#endif
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
index 4703aec06968..e2efc4e18e13 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
@@ -49,6 +49,29 @@ STATIC VIRTIO_DEVICE_PATH mVirtioBlockDevicePath =
}
};
+STATIC VIRTIO_DEVICE_PATH mVirtioNetDevicePath =
+{
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ SGI_VIRTIO_NET_GUID,
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ sizeof (EFI_DEVICE_PATH_PROTOCOL),
+ 0
+ }
+ }
+};
+
/**
Initialize platform Virtio devices.
@@ -60,6 +83,7 @@ InitVirtioDevices (
{
EFI_STATUS Status;
STATIC EFI_HANDLE mVirtIoBlkController = NULL;
+ STATIC EFI_HANDLE mVirtIoNetController = NULL;
// Install protocol interface for storage device
if ((FeaturePcdGet (PcdVirtioBlkSupported)) &&
@@ -89,4 +113,34 @@ InitVirtioDevices (
}
}
}
+
+ // Install protocol interface for network device
+ if ((FeaturePcdGet (PcdVirtioNetSupported)) &&
+ (FixedPcdGet32 (PcdVirtioNetBaseAddress))) {
+ Status = gBS->InstallProtocolInterface (&mVirtIoNetController,
+ &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
+ &mVirtioNetDevicePath);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install EFI_DEVICE_PATH protocol "
+ "for Virtio Network device (Status = %r)\n",
+ __FUNCTION__, Status));
+ } else {
+ // Declare the Virtio Net device
+ Status = VirtioMmioInstallDevice (FixedPcdGet32 (PcdVirtioNetBaseAddress),
+ mVirtIoNetController);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Unable to find Virtio Network MMIO device "
+ "(Status == %r)\n",
+ __FUNCTION__, Status));
+ gBS->UninstallProtocolInterface (
+ mVirtIoNetController,
+ &gEfiDevicePathProtocolGuid,
+ &mVirtioNetDevicePath
+ );
+ } else {
+ DEBUG ((DEBUG_INIT, "%a: Installed Virtio Network device\n",
+ __FUNCTION__));
+ }
+ }
+ }
}
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 3/8] Sgi575: AcpiTables: Use PCDs for virtio disk
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 1/8] Platform/ARM/SgiPkg: Restructure virtio device registration Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 2/8] Platform/ARM/SgiPkg: Add support for virtio net device Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 4/8] Sgi575: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
From: Daniil Egranov <daniil.egranov@arm.com>
Use PCDs instead of hardcoded values for virtio disk in DSDT.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
---
Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf | 4 ++++
Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl | 10 ++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
index 59ccb79b6475..e236b940a802 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
@@ -55,4 +55,8 @@ [FixedPcd]
gArmTokenSpaceGuid.PcdPciBusMin
gArmTokenSpaceGuid.PcdPciBusMax
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
index 509cd7cd4262..833f5b44b6a8 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
@@ -104,8 +104,14 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI", EFI_ACPI_ARM_OEM
Name (_CCA, 1) // mark the device coherent
Name (_CRS, ResourceTemplate() {
- Memory32Fixed (ReadWrite, 0x1c130000, 0x10000)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 202 }
+ Memory32Fixed (
+ ReadWrite,
+ FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+ FixedPcdGet32 (PcdVirtioBlkSize)
+ )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+ FixedPcdGet32 (PcdVirtioBlkInterrupt)
+ }
})
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 4/8] Sgi575: AcpiTables: Add entry for virtio network device
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
` (2 preceding siblings ...)
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 3/8] Sgi575: AcpiTables: Use PCDs for virtio disk Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 5/8] SgiClark.Ares: AcpiTables: Use PCDs for virtio disk Vijayenthiran Subramaniam
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
From: Daniil Egranov <daniil.egranov@arm.com>
SGI575 include an instance of the virtio network device. So add
a representation for it in the ACPI tables.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
---
Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf | 3 +++
Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl | 18 ++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
index e236b940a802..c666ea9d51c7 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
@@ -58,5 +58,8 @@ [FixedPcd]
gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+ gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSize
+ gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
index 833f5b44b6a8..36bc8c3809a0 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
@@ -114,4 +114,22 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI", EFI_ACPI_ARM_OEM
}
})
}
+
+ // VIRTIO NET
+ Device (VR01) {
+ Name (_HID, "LNRO0005")
+ Name (_UID, 1)
+ Name (_CCA, 1) // mark the device coherent
+
+ Name (_CRS, ResourceTemplate() {
+ Memory32Fixed (
+ ReadWrite,
+ FixedPcdGet32 (PcdVirtioNetBaseAddress),
+ FixedPcdGet32 (PcdVirtioNetSize)
+ )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+ FixedPcdGet32 (PcdVirtioNetInterrupt)
+ }
+ })
+ }
}
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 5/8] SgiClark.Ares: AcpiTables: Use PCDs for virtio disk
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
` (3 preceding siblings ...)
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 4/8] Sgi575: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
Use PCDs instead of hardcoded values for virtio disk in DSDT.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---
Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf | 4 ++++
Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
index dcfe4929bb5a..10a805e07fd1 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
@@ -55,4 +55,8 @@ [FixedPcd]
gArmTokenSpaceGuid.PcdPciBusMin
gArmTokenSpaceGuid.PcdPciBusMax
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
index c94a7c69e33a..af4dc424a77c 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
@@ -107,9 +107,15 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI",
Name (_UID, 0)
Name (_CCA, 1) // mark the device coherent
- Name (_CRS, ResourceTemplate () {
- Memory32Fixed (ReadWrite, 0x1c130000, 0x10000)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 202 }
+ Name (_CRS, ResourceTemplate() {
+ Memory32Fixed (
+ ReadWrite,
+ FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+ FixedPcdGet32 (PcdVirtioBlkSize)
+ )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+ FixedPcdGet32 (PcdVirtioBlkInterrupt)
+ }
})
}
} // Scope(_SB)
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
` (4 preceding siblings ...)
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 5/8] SgiClark.Ares: AcpiTables: Use PCDs for virtio disk Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2019-02-26 13:16 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 7/8] SgiClark.Helios: AcpiTables: Use PCDs for virtio disk Vijayenthiran Subramaniam
` (2 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
SgiClark Ares include an instance of the virtio network device. Add
a representation for it in the ACPI tables.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---
Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf | 3 +++
Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 17 +++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
index 10a805e07fd1..d4bacdbc8c85 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
@@ -58,5 +58,8 @@ [FixedPcd]
gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+ gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSize
+ gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
index af4dc424a77c..69dc33c06b4d 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
@@ -118,5 +118,22 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI",
}
})
}
+
+ // VIRTIO NET
+ Device (VR01) {
+ Name (_HID, "LNRO0005")
+ Name (_UID, 1)
+ Name (_CCA, 1) // mark the device coherent
+
+ Name (_CRS, ResourceTemplate() {
+ Memory32Fixed (ReadWrite,
+ FixedPcdGet32 (PcdVirtioNetBaseAddress),
+ FixedPcdGet32 (PcdVirtioNetSize)
+ )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+ FixedPcdGet32 (PcdVirtioNetInterrupt)
+ }
+ })
+ }
} // Scope(_SB)
}
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
@ 2019-02-26 13:16 ` Vijayenthiran Subramaniam
2019-02-26 16:17 ` Ard Biesheuvel
0 siblings, 1 reply; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2019-02-26 13:16 UTC (permalink / raw)
To: edk2-devel, Ard Biesheuvel, leif.lindholm
Hi Ard,
This patch is part of the patch series "Platform/ARM/Sgi: Add support for
virtio network device". While other seven patches are merged upstream, this
patch is not yet merged. Please let me know if you have any comments on
this patch.
On Fri, Dec 14, 2018 at 11:28 PM Vijayenthiran Subramaniam <
vijayenthiran.subramaniam@arm.com> wrote:
> SgiClark Ares include an instance of the virtio network device. Add
> a representation for it in the ACPI tables.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Vijayenthiran Subramaniam <
> vijayenthiran.subramaniam@arm.com>
> ---
> Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf | 3 +++
> Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 17
> +++++++++++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
> b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
> index 10a805e07fd1..d4bacdbc8c85 100644
> --- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
> +++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
> @@ -58,5 +58,8 @@ [FixedPcd]
> gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
> gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
> gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
> + gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
> + gArmSgiTokenSpaceGuid.PcdVirtioNetSize
> + gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
>
> gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
> b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
> index af4dc424a77c..69dc33c06b4d 100644
> --- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
> +++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
> @@ -118,5 +118,22 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1,
> "ARMLTD", "ARMSGI",
> }
> })
> }
> +
> + // VIRTIO NET
> + Device (VR01) {
> + Name (_HID, "LNRO0005")
> + Name (_UID, 1)
> + Name (_CCA, 1) // mark the device coherent
> +
> + Name (_CRS, ResourceTemplate() {
> + Memory32Fixed (ReadWrite,
> + FixedPcdGet32 (PcdVirtioNetBaseAddress),
> + FixedPcdGet32 (PcdVirtioNetSize)
> + )
> + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
> + FixedPcdGet32 (PcdVirtioNetInterrupt)
> + }
> + })
> + }
> } // Scope(_SB)
> }
> --
> 2.7.4
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device
2019-02-26 13:16 ` Vijayenthiran Subramaniam
@ 2019-02-26 16:17 ` Ard Biesheuvel
0 siblings, 0 replies; 13+ messages in thread
From: Ard Biesheuvel @ 2019-02-26 16:17 UTC (permalink / raw)
To: Vijayenthiran Subramaniam
Cc: edk2-devel@lists.01.org, Leif Lindholm, Thomas Abraham
On Tue, 26 Feb 2019 at 14:17, Vijayenthiran Subramaniam
<vijayenthiran.subramaniam@arm.com> wrote:
>
> Hi Ard,
>
> This patch is part of the patch series "Platform/ARM/Sgi: Add support for virtio network device". While other seven patches are merged upstream, this patch is not yet merged. Please let me know if you have any comments on this patch.
>
Apologies for that, this wasn't intentional.
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Pushed as 54f98cb1789a..c63c3f071271
> On Fri, Dec 14, 2018 at 11:28 PM Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com> wrote:
>>
>> SgiClark Ares include an instance of the virtio network device. Add
>> a representation for it in the ACPI tables.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
>> ---
>> Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf | 3 +++
>> Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 17 +++++++++++++++++
>> 2 files changed, 20 insertions(+)
>>
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
>> index 10a805e07fd1..d4bacdbc8c85 100644
>> --- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
>> @@ -58,5 +58,8 @@ [FixedPcd]
>> gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
>> gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
>> gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
>> + gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
>> + gArmSgiTokenSpaceGuid.PcdVirtioNetSize
>> + gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
>>
>> gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
>> index af4dc424a77c..69dc33c06b4d 100644
>> --- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
>> @@ -118,5 +118,22 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI",
>> }
>> })
>> }
>> +
>> + // VIRTIO NET
>> + Device (VR01) {
>> + Name (_HID, "LNRO0005")
>> + Name (_UID, 1)
>> + Name (_CCA, 1) // mark the device coherent
>> +
>> + Name (_CRS, ResourceTemplate() {
>> + Memory32Fixed (ReadWrite,
>> + FixedPcdGet32 (PcdVirtioNetBaseAddress),
>> + FixedPcdGet32 (PcdVirtioNetSize)
>> + )
>> + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
>> + FixedPcdGet32 (PcdVirtioNetInterrupt)
>> + }
>> + })
>> + }
>> } // Scope(_SB)
>> }
>> --
>> 2.7.4
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 7/8] SgiClark.Helios: AcpiTables: Use PCDs for virtio disk
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
` (5 preceding siblings ...)
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 8/8] SgiClark.Helios: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
2018-12-19 16:08 ` [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support " Ard Biesheuvel
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
Use PCDs instead of hardcoded values for virtio disk in DSDT.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---
Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf | 4 ++++
Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl | 10 ++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
index 0ecce2db8a5d..3686e91bb7e7 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
@@ -55,4 +55,8 @@ [FixedPcd]
gArmTokenSpaceGuid.PcdPciBusMin
gArmTokenSpaceGuid.PcdPciBusMax
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+ gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
index b8eb3b8e7332..3dcf6f71eadb 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
@@ -254,8 +254,14 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI",
Name (_CCA, 1) // mark the device coherent
Name (_CRS, ResourceTemplate() {
- Memory32Fixed (ReadWrite, 0x1c130000, 0x10000)
- Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 202 }
+ Memory32Fixed (
+ ReadWrite,
+ FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+ FixedPcdGet32 (PcdVirtioBlkSize)
+ )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+ FixedPcdGet32 (PcdVirtioBlkInterrupt)
+ }
})
}
} // Scope(_SB)
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 edk2-platforms 8/8] SgiClark.Helios: AcpiTables: Add entry for virtio network device
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
` (6 preceding siblings ...)
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 7/8] SgiClark.Helios: AcpiTables: Use PCDs for virtio disk Vijayenthiran Subramaniam
@ 2018-12-14 16:58 ` Vijayenthiran Subramaniam
2018-12-19 16:08 ` [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support " Ard Biesheuvel
8 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-14 16:58 UTC (permalink / raw)
To: edk2-devel, ard.biesheuvel, leif.lindholm
SgiClark Helios include an instance of the virtio network device. Add
a representation for it in the ACPI tables.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---
Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf | 3 +++
Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl | 18 ++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
index 3686e91bb7e7..8b45702b7cd3 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
@@ -58,5 +58,8 @@ [FixedPcd]
gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+ gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+ gArmSgiTokenSpaceGuid.PcdVirtioNetSize
+ gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
index 3dcf6f71eadb..7cfc419eb3a2 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
@@ -264,5 +264,23 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARMSGI",
}
})
}
+
+ // VIRTIO NET
+ Device (VR01) {
+ Name (_HID, "LNRO0005")
+ Name (_UID, 1)
+ Name (_CCA, 1) // mark the device coherent
+
+ Name (_CRS, ResourceTemplate() {
+ Memory32Fixed (
+ ReadWrite,
+ FixedPcdGet32 (PcdVirtioNetBaseAddress),
+ FixedPcdGet32 (PcdVirtioNetSize)
+ )
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+ FixedPcdGet32 (PcdVirtioNetInterrupt)
+ }
+ })
+ }
} // Scope(_SB)
}
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device
2018-12-14 16:58 [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device Vijayenthiran Subramaniam
` (7 preceding siblings ...)
2018-12-14 16:58 ` [PATCH v2 edk2-platforms 8/8] SgiClark.Helios: AcpiTables: Add entry for virtio network device Vijayenthiran Subramaniam
@ 2018-12-19 16:08 ` Ard Biesheuvel
2018-12-19 16:25 ` Vijayenthiran Subramaniam
8 siblings, 1 reply; 13+ messages in thread
From: Ard Biesheuvel @ 2018-12-19 16:08 UTC (permalink / raw)
To: Vijayenthiran Subramaniam
Cc: edk2-devel@lists.01.org, Leif Lindholm,
Thomas Panakamattam Abraham
On Fri, 14 Dec 2018 at 17:59, Vijayenthiran Subramaniam
<vijayenthiran.subramaniam@arm.com> wrote:
>
> Changes since v1:
> - Rebased the series against latest edk2-platforms
>
> This patch series adds support for virtio network controller found in ARM SGI
> plaform's fast models. The first patch in this series restructure the
> virtio device registration code to allow registration of additional virtio
> devices. The second patch adds support for the virtio network device. The rest
> of the patches update the ACPI tables to add an entry for the virtio network
> device and corresponding PCDs for virtio block and network device.
>
> Daniil Egranov (4):
> Platform/ARM/SgiPkg: Restructure virtio device registration
> Platform/ARM/SgiPkg: Add support for virtio net device
> Sgi575: AcpiTables: Use PCDs for virtio disk
> Sgi575: AcpiTables: Add entry for virtio network device
>
> Vijayenthiran Subramaniam (4):
> SgiClark.Ares: AcpiTables: Use PCDs for virtio disk
> SgiClark.Ares: AcpiTables: Add entry for virtio network device
> SgiClark.Helios: AcpiTables: Use PCDs for virtio disk
> SgiClark.Helios: AcpiTables: Add entry for virtio network device
>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Pushed as c718cc037860..54a0e7ae1289
Thanks!
> Platform/ARM/SgiPkg/SgiPlatform.dec | 14 ++-
> Platform/ARM/SgiPkg/SgiPlatform.dsc | 21 +++-
> Platform/ARM/SgiPkg/SgiPlatform.fdf | 4 +
> Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf | 7 ++
> Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf | 7 ++
> Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf | 7 ++
> Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 11 +-
> Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h | 24 ++++
> Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 14 +--
> Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => VirtioDevices.c} | 117 +++++++++++++++-----
> Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl | 28 ++++-
> Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 29 ++++-
> Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl | 28 ++++-
> 13 files changed, 260 insertions(+), 51 deletions(-)
> create mode 100644 Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
> rename Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => VirtioDevices.c} (25%)
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device
2018-12-19 16:08 ` [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support " Ard Biesheuvel
@ 2018-12-19 16:25 ` Vijayenthiran Subramaniam
0 siblings, 0 replies; 13+ messages in thread
From: Vijayenthiran Subramaniam @ 2018-12-19 16:25 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel@lists.01.org
On Wed, Dec 19, 2018 at 4:08 PM Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>
> On Fri, 14 Dec 2018 at 17:59, Vijayenthiran Subramaniam
> <vijayenthiran.subramaniam@arm.com> wrote:
> >
> > Changes since v1:
> > - Rebased the series against latest edk2-platforms
> >
> > This patch series adds support for virtio network controller found in ARM SGI
> > plaform's fast models. The first patch in this series restructure the
> > virtio device registration code to allow registration of additional virtio
> > devices. The second patch adds support for the virtio network device. The rest
> > of the patches update the ACPI tables to add an entry for the virtio network
> > device and corresponding PCDs for virtio block and network device.
> >
> > Daniil Egranov (4):
> > Platform/ARM/SgiPkg: Restructure virtio device registration
> > Platform/ARM/SgiPkg: Add support for virtio net device
> > Sgi575: AcpiTables: Use PCDs for virtio disk
> > Sgi575: AcpiTables: Add entry for virtio network device
> >
> > Vijayenthiran Subramaniam (4):
> > SgiClark.Ares: AcpiTables: Use PCDs for virtio disk
> > SgiClark.Ares: AcpiTables: Add entry for virtio network device
> > SgiClark.Helios: AcpiTables: Use PCDs for virtio disk
> > SgiClark.Helios: AcpiTables: Add entry for virtio network device
> >
>
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Pushed as c718cc037860..54a0e7ae1289
>
> Thanks!
Thank you Ard.
Regards,
Vijayenthiran
^ permalink raw reply [flat|nested] 13+ messages in thread