aboutsummaryrefslogtreecommitdiff
path: root/arch/nios2/include
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2015-10-21 21:34:57 +0800
committerThomas Chou <thomas@wytron.com.tw>2015-10-23 07:37:03 +0800
commitbcae80e9551bc0ba2d67e78bda57b9283b4bab12 (patch)
tree200069cf225f838daaaaf8d5cb0958d5a0b164b5 /arch/nios2/include
parent88d5ecf4b9c0d5a3bff5d6d98ab7383a550a57db (diff)
downloadu-boot-bcae80e9551bc0ba2d67e78bda57b9283b4bab12.zip
u-boot-bcae80e9551bc0ba2d67e78bda57b9283b4bab12.tar.gz
u-boot-bcae80e9551bc0ba2d67e78bda57b9283b4bab12.tar.bz2
nios2: convert nios2 cpu to driver model
Convert nios2 cpu to driver model. The cpu parameters are extracted from device tree and saved to global data structure. We will use them to replace the custom_fpga.h . Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/nios2/include')
-rw-r--r--arch/nios2/include/asm/global_data.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/nios2/include/asm/global_data.h b/arch/nios2/include/asm/global_data.h
index 580b019..d6a2cfa 100644
--- a/arch/nios2/include/asm/global_data.h
+++ b/arch/nios2/include/asm/global_data.h
@@ -9,6 +9,15 @@
/* Architecture-specific global data */
struct arch_global_data {
+ u32 dcache_line_size;
+ u32 icache_line_size;
+ u32 dcache_size;
+ u32 icache_size;
+ u32 reset_addr;
+ u32 exception_addr;
+ int has_initda;
+ int has_mmu;
+ u32 io_region_base;
};
#include <asm-generic/global_data.h>
If provided, append the new resource data node to the list of resource data elements of this node. @param [out] NewRdNode If provided and success, contain the created node. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Could not allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenRdDWordMemory ( IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN UINT8 Cacheable, IN BOOLEAN IsReadWrite, IN UINT32 AddressGranularity, IN UINT32 AddressMinimum, IN UINT32 AddressMaximum, IN UINT32 AddressTranslation, IN UINT32 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN UINT8 MemoryRangeType, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL ); /** Code generation for the "Memory32Fixed ()" ASL macro. The Resource Data effectively created is a 32-bit Memory Resource Data. Cf ACPI 6.4: - s19.6.83 "Memory Resource Descriptor Macro". - s19.2.8 "Memory32FixedTerm". See ACPI 6.4 spec, s19.2.8 for more. @param [in] IsReadWrite ReadAndWrite parameter. @param [in] Address AddressBase parameter. @param [in] RangeLength Range length. @param [in] NameOpNode NameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node. @param [out] NewMemNode If provided and success, contain the created node. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Could not allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenRdMemory32Fixed ( BOOLEAN IsReadWrite, UINT32 Address, UINT32 RangeLength, AML_OBJECT_NODE_HANDLE NameOpNode, AML_DATA_NODE_HANDLE *NewMemNode ); /** Code generation for the "WordBusNumber ()" ASL function. The Resource Data effectively created is a Word Address Space Resource Data. Cf ACPI 6.4: - s6.4.3.5.3 "Word Address Space Descriptor". - s19.6.149 "WordBusNumber". The created resource data node can be: - appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()". - returned through the NewRdNode parameter. See ACPI 6.4 spec, s19.6.149 for more. @param [in] IsResourceConsumer ResourceUsage parameter. @param [in] IsMinFixed Minimum address is fixed. @param [in] IsMaxFixed Maximum address is fixed. @param [in] IsPosDecode Decode parameter @param [in] AddressGranularity Address granularity. @param [in] AddressMinimum Minimum address. @param [in] AddressMaximum Maximum address. @param [in] AddressTranslation Address translation. @param [in] RangeLength Range length. @param [in] ResourceSourceIndex Resource Source index. Not supported. Must be 0. @param [in] ResourceSource Resource Source. Not supported. Must be NULL. @param [in] NameOpNode NameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node. @param [out] NewRdNode If provided and success, contain the created node. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Could not allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenRdWordBusNumber ( IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN BOOLEAN IsPosDecode, IN UINT32 AddressGranularity, IN UINT32 AddressMinimum, IN UINT32 AddressMaximum, IN UINT32 AddressTranslation, IN UINT32 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL ); /** Code generation for the "QWordMemory ()" ASL function. The Resource Data effectively created is a QWord Address Space Resource Data. Cf ACPI 6.4: - s6.4.3.5.1 "QWord Address Space Descriptor". - s19.6.110 "QWordMemory". The created resource data node can be: - appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()". - returned through the NewRdNode parameter. See ACPI 6.4 spec, s19.6.110 for more. @param [in] IsResourceConsumer ResourceUsage parameter. @param [in] IsPosDecode Decode parameter. @param [in] IsMinFixed Minimum address is fixed. @param [in] IsMaxFixed Maximum address is fixed. @param [in] Cacheable Possible values are: 0-The memory is non-cacheable 1-The memory is cacheable 2-The memory is cacheable and supports write combining 3-The memory is cacheable and prefetchable @param [in] IsReadWrite ReadAndWrite parameter. @param [in] AddressGranularity Address granularity. @param [in] AddressMinimum Minimum address. @param [in] AddressMaximum Maximum address. @param [in] AddressTranslation Address translation. @param [in] RangeLength Range length. @param [in] ResourceSourceIndex Resource Source index. Not supported. Must be 0. @param [in] ResourceSource Resource Source. Not supported. Must be NULL. @param [in] MemoryRangeType Possible values are: 0-AddressRangeMemory 1-AddressRangeReserved 2-AddressRangeACPI 3-AddressRangeNVS @param [in] IsTypeStatic TranslationType parameter. @param [in] NameOpNode NameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node. @param [out] NewRdNode If provided and success, contain the created node. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Could not allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenRdQWordMemory ( IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN UINT8 Cacheable, IN BOOLEAN IsReadWrite, IN UINT64 AddressGranularity, IN UINT64 AddressMinimum, IN UINT64 AddressMaximum, IN UINT64 AddressTranslation, IN UINT64 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN UINT8 MemoryRangeType, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL ); /** Code generation for the "Interrupt ()" ASL function. The Resource Data effectively created is an Extended Interrupt Resource Data. Cf ACPI 6.4: - s6.4.3.6 "Extended Interrupt Descriptor" - s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)" The created resource data node can be: - appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()". - returned through the NewRdNode parameter. @ingroup CodeGenApis @param [in] ResourceConsumer The device consumes the specified interrupt or produces it for use by a child device. @param [in] EdgeTriggered The interrupt is edge triggered or level triggered. @param [in] ActiveLow The interrupt is active-high or active-low. @param [in] Shared The interrupt can be shared with other devices or not (Exclusive). @param [in] IrqList Interrupt list. Must be non-NULL. @param [in] IrqCount Interrupt count. Must be non-zero. @param [in] NameOpNode NameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node. @param [out] NewRdNode If provided and success, contain the created node. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Could not allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenRdInterrupt ( IN BOOLEAN ResourceConsumer, IN BOOLEAN EdgeTriggered, IN BOOLEAN ActiveLow, IN BOOLEAN Shared, IN UINT32 *IrqList, IN UINT8 IrqCount, IN AML_OBJECT_NODE_HANDLE NameOpNode OPTIONAL, OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL ); /** AML code generation for DefinitionBlock. Create a Root Node handle. It is the caller's responsibility to free the allocated memory with the AmlDeleteTree function. AmlCodeGenDefinitionBlock (TableSignature, OemId, TableID, OEMRevision) is equivalent to the following ASL code: DefinitionBlock (AMLFileName, TableSignature, ComplianceRevision, OemId, TableID, OEMRevision) {} with the ComplianceRevision set to 2 and the AMLFileName is ignored. @ingroup CodeGenApis @param[in] TableSignature 4-character ACPI signature. Must be 'DSDT' or 'SSDT'. @param[in] OemId 6-character string OEM identifier. @param[in] OemTableId 8-character string OEM table identifier. @param[in] OemRevision OEM revision number. @param[out] DefinitionBlockTerm The ASL Term handle representing a Definition Block. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenDefinitionBlock ( IN CONST CHAR8 *TableSignature, IN CONST CHAR8 *OemId, IN CONST CHAR8 *OemTableId, IN UINT32 OemRevision, OUT AML_ROOT_NODE_HANDLE *NewRootNode ); /** AML code generation for a Name object node, containing a String. AmlCodeGenNameString ("_HID", "HID0000", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_HID, "HID0000") @ingroup CodeGenApis @param [in] NameString The new variable name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] String NULL terminated String to associate to the NameString. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenNameString ( IN CONST CHAR8 *NameString, IN CHAR8 *String, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a Name object node, containing an Integer. AmlCodeGenNameInteger ("_UID", 1, ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_UID, One) @ingroup CodeGenApis @param [in] NameString The new variable name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] Integer Integer to associate to the NameString. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenNameInteger ( IN CONST CHAR8 *NameString, IN UINT64 Integer, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a Name object node, containing a Package. AmlCodeGenNamePackage ("PKG0", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(PKG0, Package () {}) @ingroup CodeGenApis @param [in] NameString The new variable name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenNamePackage ( IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode, OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a Name object node, containing a ResourceTemplate. AmlCodeGenNameResourceTemplate ("PRS0", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(PRS0, ResourceTemplate () {}) @ingroup CodeGenApis @param [in] NameString The new variable name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenNameResourceTemplate ( IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode, OPTIONAL OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a Name object node, containing a String. AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_STR, Unicode ("String")) @ingroup CodeGenApis @param [in] NameString The new variable name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] String NULL terminated Unicode String to associate to the NameString. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenNameUnicodeString ( IN CONST CHAR8 *NameString, IN CHAR16 *String, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** Add a _PRT entry. AmlCodeGenPrtEntry (0x0FFFF, 0, "LNKA", 0, PrtNameNode) is equivalent of the following ASL code: Package (4) { 0x0FFFF, // Address: Device address (([Device Id] << 16) | 0xFFFF). 0, // Pin: PCI pin number of the device (0-INTA, ...). LNKA // Source: Name of the device that allocates the interrupt // to which the above pin is connected. 0 // Source Index: Source is assumed to only describe one // interrupt, so let it to index 0. } The package is added at the tail of the list of the input _PRT node name: Name (_PRT, Package () { [Pre-existing _PRT entries], [Newly created _PRT entry] }) Cf. ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)" @ingroup CodeGenApis @param [in] Address Address. Cf ACPI 6.4 specification, Table 6.2: "ADR Object Address Encodings": High word-Device #, Low word-Function #. (for example, device 3, function 2 is 0x00030002). To refer to all the functions on a device #, use a function number of FFFF). @param [in] Pin PCI pin number of the device (0-INTA ... 3-INTD). Must be between 0-3. @param [in] LinkName Link Name, i.e. device in the AML NameSpace describing the interrupt used. The input string is copied. @param [in] SourceIndex Source index or GSIV. @param [in] PrtNameNode Prt Named node to add the object to .... @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlAddPrtEntry ( IN UINT32 Address, IN UINT8 Pin, IN CONST CHAR8 *LinkName, IN UINT32 SourceIndex, IN AML_OBJECT_NODE_HANDLE PrtNameNode ); /** AML code generation for a Device object node. AmlCodeGenDevice ("COM0", ParentNode, NewObjectNode) is equivalent of the following ASL code: Device(COM0) {} @ingroup CodeGenApis @param [in] NameString The new Device's name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenDevice ( IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a ThermalZone object node. AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is equivalent of the following ASL code: ThermalZone(TZ00) {} @ingroup CodeGenApis @param [in] NameString The new ThermalZone's name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenThermalZone ( IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a Scope object node. AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is equivalent of the following ASL code: Scope(_SB) {} @ingroup CodeGenApis @param [in] NameString The new Scope's name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenScope ( IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a method returning a NameString. AmlCodeGenMethodRetNameString ( "MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode ); is equivalent of the following ASL code: Method(MET0, 1, Serialized, 3) { Return (_CRS) } The ASL parameters "ReturnType" and "ParameterTypes" are not asked in this function. They are optional parameters in ASL. @ingroup CodeGenApis @param [in] MethodNameString The new Method's name. Must be a NULL-terminated ASL NameString e.g.: "MET0", "_SB.MET0", etc. The input string is copied. @param [in] ReturnedNameString The name of the object returned by the method. Optional parameter, can be: - NULL (ignored). - A NULL-terminated ASL NameString. e.g.: "MET0", "_SB.MET0", etc. The input string is copied. @param [in] NumArgs Number of arguments. Must be 0 <= NumArgs <= 6. @param [in] IsSerialized TRUE is equivalent to Serialized. FALSE is equivalent to NotSerialized. Default is NotSerialized in ASL spec. @param [in] SyncLevel Synchronization level for the method. Must be 0 <= SyncLevel <= 15. Default is 0 in ASL. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenMethodRetNameString ( IN CONST CHAR8 *MethodNameString, IN CONST CHAR8 *ReturnedNameString OPTIONAL, IN UINT8 NumArgs, IN BOOLEAN IsSerialized, IN UINT8 SyncLevel, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a method returning an Integer. AmlCodeGenMethodRetInteger ( "_CBA", 0, 1, TRUE, 3, ParentNode, NewObjectNode ); is equivalent of the following ASL code: Method(_CBA, 1, Serialized, 3) { Return (0) } The ASL parameters "ReturnType" and "ParameterTypes" are not asked in this function. They are optional parameters in ASL. @param [in] MethodNameString The new Method's name. Must be a NULL-terminated ASL NameString e.g.: "MET0", "_SB.MET0", etc. The input string is copied. @param [in] ReturnedInteger The value of the integer returned by the method. @param [in] NumArgs Number of arguments. Must be 0 <= NumArgs <= 6. @param [in] IsSerialized TRUE is equivalent to Serialized. FALSE is equivalent to NotSerialized. Default is NotSerialized in ASL spec. @param [in] SyncLevel Synchronization level for the method. Must be 0 <= SyncLevel <= 15. Default is 0 in ASL. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenMethodRetInteger ( IN CONST CHAR8 *MethodNameString, IN UINT64 ReturnedInteger, IN UINT8 NumArgs, IN BOOLEAN IsSerialized, IN UINT8 SyncLevel, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** AML code generation for a method returning a NameString that takes an integer argument. AmlCodeGenMethodRetNameStringIntegerArgument ( "MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode ); is equivalent of the following ASL code: Method(MET0, 1, Serialized, 3) { Return (MET1 (5)) } The ASL parameters "ReturnType" and "ParameterTypes" are not asked in this function. They are optional parameters in ASL. @param [in] MethodNameString The new Method's name. Must be a NULL-terminated ASL NameString e.g.: "MET0", "_SB.MET0", etc. The input string is copied. @param [in] ReturnedNameString The name of the object returned by the method. Optional parameter, can be: - NULL (ignored). - A NULL-terminated ASL NameString. e.g.: "MET0", "_SB.MET0", etc. The input string is copied. @param [in] NumArgs Number of arguments. Must be 0 <= NumArgs <= 6. @param [in] IsSerialized TRUE is equivalent to Serialized. FALSE is equivalent to NotSerialized. Default is NotSerialized in ASL spec. @param [in] SyncLevel Synchronization level for the method. Must be 0 <= SyncLevel <= 15. Default is 0 in ASL. @param [in] IntegerArgument Argument to pass to the NameString. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewObjectNode If success, contains the created node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCodeGenMethodRetNameStringIntegerArgument ( IN CONST CHAR8 *MethodNameString, IN CONST CHAR8 *ReturnedNameString OPTIONAL, IN UINT8 NumArgs, IN BOOLEAN IsSerialized, IN UINT8 SyncLevel, IN UINT64 IntegerArgument, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); /** Create a _LPI name. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is equivalent of the following ASL code: Name (_LPI, Package ( 0, // Revision 1, // LevelId 0 // Count )) This function doesn't define any LPI state. As shown above, the count of _LPI state is set to 0. The AmlAddLpiState () function must be used to add LPI states. Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States". @ingroup CodeGenApis @param [in] LpiNameString The new LPI 's object name. Must be a NULL-terminated ASL NameString e.g.: "_LPI", "DEV0.PLPI", etc. The input string is copied. @param [in] Revision Revision number of the _LPI states. @param [in] LevelId A platform defined number that identifies the level of hierarchy of the processor node to which the LPI states apply. @param [in] ParentNode If provided, set ParentNode as the parent of the node created. @param [out] NewLpiNode If success, contains the created node. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlCreateLpiNode ( IN CONST CHAR8 *LpiNameString, IN UINT16 Revision, IN UINT64 LevelId, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewLpiNode OPTIONAL ); /** Add an _LPI state to a LPI node created using AmlCreateLpiNode (). AmlAddLpiState () increments the Count of LPI states in the LPI node by one, and adds the following package: Package() { MinResidency, WorstCaseWakeLatency, Flags, ArchFlags, ResCntFreq, EnableParentState, (GenericRegisterDescriptor != NULL) ? // Entry method. If a ResourceTemplate(GenericRegisterDescriptor) : // Register is given, Integer, // use it. Use the // Integer otherwise. ResourceTemplate() { // NULL Residency Counter Register (SystemMemory, 0, 0, 0, 0) }, ResourceTemplate() { // NULL Usage Counter Register (SystemMemory, 0, 0, 0, 0) }, "" // NULL State Name }, Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States". @ingroup CodeGenApis @param [in] MinResidency Minimum Residency. @param [in] WorstCaseWakeLatency Worst case wake-up latency. @param [in] Flags Flags. @param [in] ArchFlags Architectural flags. @param [in] ResCntFreq Residency Counter Frequency. @param [in] EnableParentState Enabled Parent State. @param [in] GenericRegisterDescriptor Entry Method. If not NULL, use this Register to describe the entry method address. @param [in] Integer Entry Method. If GenericRegisterDescriptor is NULL, take this value. @param [in] ResidencyCounterRegister If not NULL, use it to populate the residency counter register. @param [in] UsageCounterRegister If not NULL, use it to populate the usage counter register. @param [in] StateName If not NULL, use it to populate the state name. @param [in] LpiNode Lpi node created with the function AmlCreateLpiNode to which the new LPI state is appended. @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlAddLpiState ( IN UINT32 MinResidency, IN UINT32 WorstCaseWakeLatency, IN UINT32 Flags, IN UINT32 ArchFlags, IN UINT32 ResCntFreq, IN UINT32 EnableParentState, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GenericRegisterDescriptor OPTIONAL, IN UINT64 Integer OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ResidencyCounterRegister OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *UsageCounterRegister OPTIONAL, IN CHAR8 *StateName OPTIONAL, IN AML_OBJECT_NODE_HANDLE LpiNode ); /** AML code generation for a _DSD device data object. AmlAddDeviceDataDescriptorPackage (Uuid, DsdNode, PackageNode) is equivalent of the following ASL code: ToUUID(Uuid), Package () {} Cf ACPI 6.4 specification, s6.2.5 "_DSD (Device Specific Data)". _DSD (Device Specific Data) Implementation Guide https://github.com/UEFI/DSD-Guide Per s3. "'Well-Known _DSD UUIDs and Data Structure Formats'" If creating a Device Properties data then UUID daffd814-6eba-4d8c-8a91-bc9bbf4aa301 should be used. @param [in] Uuid The Uuid of the descriptor to be created @param [in] DsdNode Node of the DSD Package. @param [out] PackageNode If success, contains the created package node. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlAddDeviceDataDescriptorPackage ( IN CONST EFI_GUID *Uuid, IN AML_OBJECT_NODE_HANDLE DsdNode, OUT AML_OBJECT_NODE_HANDLE *PackageNode ); /** AML code generation to add a package with a name and value, to a parent package. This is useful to build the _DSD package but can be used in other cases. AmlAddNameIntegerPackage ("Name", Value, PackageNode) is equivalent of the following ASL code: Package (2) {"Name", Value} Cf ACPI 6.4 specification, s6.2.5 "_DSD (Device Specific Data)". @param [in] Name String to place in first entry of package @param [in] Value Integer to place in second entry of package @param [in] PackageNode Package to add new sub package to. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. **/ EFI_STATUS EFIAPI AmlAddNameIntegerPackage ( IN CHAR8 *Name, IN UINT64 Value, IN AML_OBJECT_NODE_HANDLE PackageNode ); /** Create a _CPC node. Creates and optionally adds the following node Name(_CPC, Package() { NumEntries, // Integer Revision, // Integer HighestPerformance, // Integer or Buffer (Resource Descriptor) NominalPerformance, // Integer or Buffer (Resource Descriptor) LowestNonlinearPerformance, // Integer or Buffer (Resource Descriptor) LowestPerformance, // Integer or Buffer (Resource Descriptor) GuaranteedPerformanceRegister, // Buffer (Resource Descriptor) DesiredPerformanceRegister , // Buffer (Resource Descriptor) MinimumPerformanceRegister , // Buffer (Resource Descriptor) MaximumPerformanceRegister , // Buffer (Resource Descriptor) PerformanceReductionToleranceRegister, // Buffer (Resource Descriptor) TimeWindowRegister, // Buffer (Resource Descriptor)