]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.c
ArmPlatformPkg/ArmFvpDxe: Added Virtio Block support
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / ArmFvpDxe / ArmFvpDxe.c
CommitLineData
1e69576f
OM
1/** @file
2
3 Copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
4
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#include <Library/UefiLib.h>
e94784c6
OM
16#include <Library/VirtioMmioDeviceLib.h>
17#include <Library/DebugLib.h>
18#include <Library/UefiBootServicesTableLib.h>
19
20#define ARM_FVP_BASE_VIRTIO_BLOCK_BASE 0x1c130000
21
22#pragma pack(1)
23typedef struct {
24 VENDOR_DEVICE_PATH Vendor;
25 EFI_DEVICE_PATH_PROTOCOL End;
26} VIRTIO_BLK_DEVICE_PATH;
27#pragma pack()
28
29VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
30{
31 {
32 {
33 HARDWARE_DEVICE_PATH,
34 HW_VENDOR_DP,
35 {
36 (UINT8)( sizeof(VENDOR_DEVICE_PATH) ),
37 (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8)
38 }
39 },
40 EFI_CALLER_ID_GUID,
41 },
42 {
43 END_DEVICE_PATH_TYPE,
44 END_ENTIRE_DEVICE_PATH_SUBTYPE,
45 {
46 sizeof (EFI_DEVICE_PATH_PROTOCOL),
47 0
48 }
49 }
50};
1e69576f
OM
51
52EFI_STATUS
53EFIAPI
54ArmFvpInitialise (
55 IN EFI_HANDLE ImageHandle,
56 IN EFI_SYSTEM_TABLE *SystemTable
57 )
58{
e94784c6
OM
59 EFI_STATUS Status;
60
61 Status = gBS->InstallProtocolInterface (&ImageHandle,
62 &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
63 &mVirtioBlockDevicePath);
64 if (EFI_ERROR (Status)) {
65 return Status;
66 }
67
68 // Declare the Virtio BlockIo device
69 Status = VirtioMmioInstallDevice (ARM_FVP_BASE_VIRTIO_BLOCK_BASE, ImageHandle);
70 if (EFI_ERROR (Status)) {
71 DEBUG ((EFI_D_ERROR, "ArmFvpDxe: Failed to install Virtio block device\n"));
72 }
1e69576f 73
e94784c6 74 return Status;
1e69576f 75}