diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-10-31 14:58:18 +0000 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-12-07 09:01:27 +0000 |
commit | 1652dc2158de59483788cff6e06169bcf66643f5 (patch) | |
tree | 130be49d39ccafcd5acca8a2b15e7aacc0edf8cc /MdeModulePkg/Include | |
parent | 9598cdc2924f4fb86f23d8004eaea6187e44ba21 (diff) | |
download | edk2-1652dc2158de59483788cff6e06169bcf66643f5.tar.gz edk2-1652dc2158de59483788cff6e06169bcf66643f5.tar.bz2 edk2-1652dc2158de59483788cff6e06169bcf66643f5.zip |
MdeModulePkg: introduce helper library to register non-discoverable devices
Non-discoverable devices need to be registered explicitly by the platform.
Introduce a helper library that takes care of this.
This implementation currently only supports registering devices that are
covered by one or more MMIO resources. The underlying protocol allows for
more flexibility than that, but this is currently sufficient for the use
cases that we know about.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Diffstat (limited to 'MdeModulePkg/Include')
-rw-r--r-- | MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h new file mode 100644 index 0000000000..120d914660 --- /dev/null +++ b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h @@ -0,0 +1,62 @@ +/** @file
+ Copyright (c) 2016, 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 __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
+#define __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
+
+#include <Protocol/NonDiscoverableDevice.h>
+
+typedef enum {
+ NonDiscoverableDeviceTypeAhci,
+ NonDiscoverableDeviceTypeAmba,
+ NonDiscoverableDeviceTypeEhci,
+ NonDiscoverableDeviceTypeNvme,
+ NonDiscoverableDeviceTypeOhci,
+ NonDiscoverableDeviceTypeSdhci,
+ NonDiscoverableDeviceTypeUfs,
+ NonDiscoverableDeviceTypeUhci,
+ NonDiscoverableDeviceTypeXhci,
+ NonDiscoverableDeviceTypeMax,
+} NON_DISCOVERABLE_DEVICE_TYPE;
+
+/**
+ Register a non-discoverable MMIO device
+
+ @param[in] DeviceType The type of non-discoverable device
+ @param[in] DmaType Whether the device is DMA coherent
+ @param[in] InitFunc Initialization routine to be invoked when
+ the device is enabled
+ @param[in,out] Handle The handle onto which to install the
+ non-discoverable device protocol.
+ If Handle is NULL or *Handle is NULL, a
+ new handle will be allocated.
+ @param[in] NumMmioResources The number of UINTN base/size pairs that
+ follow, each describing an MMIO region
+ owned by the device
+
+ @retval EFI_SUCCESS The registration succeeded.
+ @retval Other The registration failed.
+
+**/
+EFI_STATUS
+EFIAPI
+RegisterNonDiscoverableMmioDevice (
+ IN NON_DISCOVERABLE_DEVICE_TYPE Type,
+ IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType,
+ IN NON_DISCOVERABLE_DEVICE_INIT InitFunc,
+ IN OUT EFI_HANDLE *Handle OPTIONAL,
+ IN UINTN NumMmioResources,
+ ...
+ );
+
+#endif
|