xref: /freebsd/sys/contrib/edk2/Include/Protocol/RamDisk.h (revision e985c628a0e4082d9b953897d6f56c81d177cea7)
1*e985c628SWarner Losh /** @file
2*e985c628SWarner Losh   This file defines the EFI RAM Disk Protocol.
3*e985c628SWarner Losh 
4*e985c628SWarner Losh   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5*e985c628SWarner Losh   SPDX-License-Identifier: BSD-2-Clause-Patent
6*e985c628SWarner Losh 
7*e985c628SWarner Losh   @par Revision Reference:
8*e985c628SWarner Losh   This Protocol is introduced in UEFI Specification 2.6
9*e985c628SWarner Losh 
10*e985c628SWarner Losh **/
11*e985c628SWarner Losh 
12*e985c628SWarner Losh #ifndef __RAM_DISK_PROTOCOL_H__
13*e985c628SWarner Losh #define __RAM_DISK_PROTOCOL_H__
14*e985c628SWarner Losh 
15*e985c628SWarner Losh //
16*e985c628SWarner Losh // EFI RAM Disk Protocol GUID value
17*e985c628SWarner Losh //
18*e985c628SWarner Losh #define EFI_RAM_DISK_PROTOCOL_GUID \
19*e985c628SWarner Losh   { 0xab38a0df, 0x6873, 0x44a9, { 0x87, 0xe6, 0xd4, 0xeb, 0x56, 0x14, 0x84, 0x49 }};
20*e985c628SWarner Losh 
21*e985c628SWarner Losh //
22*e985c628SWarner Losh // Forward reference for pure ANSI compatability
23*e985c628SWarner Losh //
24*e985c628SWarner Losh typedef struct _EFI_RAM_DISK_PROTOCOL EFI_RAM_DISK_PROTOCOL;
25*e985c628SWarner Losh 
26*e985c628SWarner Losh /**
27*e985c628SWarner Losh   Register a RAM disk with specified address, size and type.
28*e985c628SWarner Losh 
29*e985c628SWarner Losh   @param[in]  RamDiskBase    The base address of registered RAM disk.
30*e985c628SWarner Losh   @param[in]  RamDiskSize    The size of registered RAM disk.
31*e985c628SWarner Losh   @param[in]  RamDiskType    The type of registered RAM disk. The GUID can be
32*e985c628SWarner Losh                              any of the values defined in section 9.3.6.9, or a
33*e985c628SWarner Losh                              vendor defined GUID.
34*e985c628SWarner Losh   @param[in]  ParentDevicePath
35*e985c628SWarner Losh                              Pointer to the parent device path. If there is no
36*e985c628SWarner Losh                              parent device path then ParentDevicePath is NULL.
37*e985c628SWarner Losh   @param[out] DevicePath     On return, points to a pointer to the device path
38*e985c628SWarner Losh                              of the RAM disk device.
39*e985c628SWarner Losh                              If ParentDevicePath is not NULL, the returned
40*e985c628SWarner Losh                              DevicePath is created by appending a RAM disk node
41*e985c628SWarner Losh                              to the parent device path. If ParentDevicePath is
42*e985c628SWarner Losh                              NULL, the returned DevicePath is a RAM disk device
43*e985c628SWarner Losh                              path without appending. This function is
44*e985c628SWarner Losh                              responsible for allocating the buffer DevicePath
45*e985c628SWarner Losh                              with the boot service AllocatePool().
46*e985c628SWarner Losh 
47*e985c628SWarner Losh   @retval EFI_SUCCESS             The RAM disk is registered successfully.
48*e985c628SWarner Losh   @retval EFI_INVALID_PARAMETER   DevicePath or RamDiskType is NULL.
49*e985c628SWarner Losh                                   RamDiskSize is 0.
50*e985c628SWarner Losh   @retval EFI_ALREADY_STARTED     A Device Path Protocol instance to be created
51*e985c628SWarner Losh                                   is already present in the handle database.
52*e985c628SWarner Losh   @retval EFI_OUT_OF_RESOURCES    The RAM disk register operation fails due to
53*e985c628SWarner Losh                                   resource limitation.
54*e985c628SWarner Losh 
55*e985c628SWarner Losh **/
56*e985c628SWarner Losh typedef
57*e985c628SWarner Losh EFI_STATUS
58*e985c628SWarner Losh (EFIAPI *EFI_RAM_DISK_REGISTER_RAMDISK)(
59*e985c628SWarner Losh   IN UINT64                       RamDiskBase,
60*e985c628SWarner Losh   IN UINT64                       RamDiskSize,
61*e985c628SWarner Losh   IN EFI_GUID                     *RamDiskType,
62*e985c628SWarner Losh   IN EFI_DEVICE_PATH              *ParentDevicePath     OPTIONAL,
63*e985c628SWarner Losh   OUT EFI_DEVICE_PATH_PROTOCOL    **DevicePath
64*e985c628SWarner Losh   );
65*e985c628SWarner Losh 
66*e985c628SWarner Losh /**
67*e985c628SWarner Losh   Unregister a RAM disk specified by DevicePath.
68*e985c628SWarner Losh 
69*e985c628SWarner Losh   @param[in] DevicePath      A pointer to the device path that describes a RAM
70*e985c628SWarner Losh                              Disk device.
71*e985c628SWarner Losh 
72*e985c628SWarner Losh   @retval EFI_SUCCESS             The RAM disk is unregistered successfully.
73*e985c628SWarner Losh   @retval EFI_INVALID_PARAMETER   DevicePath is NULL.
74*e985c628SWarner Losh   @retval EFI_UNSUPPORTED         The device specified by DevicePath is not a
75*e985c628SWarner Losh                                   valid ramdisk device path and not supported
76*e985c628SWarner Losh                                   by the driver.
77*e985c628SWarner Losh   @retval EFI_NOT_FOUND           The RAM disk pointed by DevicePath doesn't
78*e985c628SWarner Losh                                   exist.
79*e985c628SWarner Losh 
80*e985c628SWarner Losh **/
81*e985c628SWarner Losh typedef
82*e985c628SWarner Losh EFI_STATUS
83*e985c628SWarner Losh (EFIAPI *EFI_RAM_DISK_UNREGISTER_RAMDISK)(
84*e985c628SWarner Losh   IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath
85*e985c628SWarner Losh   );
86*e985c628SWarner Losh 
87*e985c628SWarner Losh ///
88*e985c628SWarner Losh /// RAM Disk Protocol structure.
89*e985c628SWarner Losh ///
90*e985c628SWarner Losh struct _EFI_RAM_DISK_PROTOCOL {
91*e985c628SWarner Losh   EFI_RAM_DISK_REGISTER_RAMDISK      Register;
92*e985c628SWarner Losh   EFI_RAM_DISK_UNREGISTER_RAMDISK    Unregister;
93*e985c628SWarner Losh };
94*e985c628SWarner Losh 
95*e985c628SWarner Losh ///
96*e985c628SWarner Losh /// RAM Disk Protocol GUID variable.
97*e985c628SWarner Losh ///
98*e985c628SWarner Losh extern EFI_GUID  gEfiRamDiskProtocolGuid;
99*e985c628SWarner Losh 
100*e985c628SWarner Losh #endif
101