]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg: Introduce HardwareInterrupt2 protocol
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 1 Sep 2016 16:21:55 +0000 (17:21 +0100)
committerLeif Lindholm <leif.lindholm@linaro.org>
Thu, 5 Oct 2017 20:23:34 +0000 (21:23 +0100)
The existing HardwareInterrupt protocol lacks the means to configure
the level/edge and polarity properties of an interrupt. So introduce a
new protocol HardwareInterrupt2, and add some new members that allow
manipulation of those properties.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Tested-by: Girish Pathak <girish.pathak@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
EmbeddedPkg/EmbeddedPkg.dec
EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h [new file with mode: 0644]

index 0be102ad9c767d81a004c757f40a65063aab1d7a..151b1d503dee463d529a173d2555b6c9208100e5 100644 (file)
@@ -69,6 +69,7 @@
 \r
 [Protocols.common]\r
   gHardwareInterruptProtocolGuid =  { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }\r
+  gHardwareInterrupt2ProtocolGuid = { 0x32898322, 0x2da1, 0x474a, { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }\r
   gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } }\r
   gEfiEblAddCommandProtocolGuid =   { 0xaeda2428, 0x9a22, 0x4637, { 0x9b, 0x21, 0x54, 0x5e, 0x28, 0xfb, 0xb8, 0x29 } }\r
   gEmbeddedDeviceGuid =   { 0xbf4b9d10, 0x13ec, 0x43dd, { 0x88, 0x80, 0xe9, 0xb, 0x71, 0x8f, 0x27, 0xde } }\r
diff --git a/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h b/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h
new file mode 100644 (file)
index 0000000..caa28d4
--- /dev/null
@@ -0,0 +1,182 @@
+/** @file\r
+\r
+  Copyright (c) 2016-2017, Linaro Ltd. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __HARDWARE_INTERRUPT2_H__\r
+#define __HARDWARE_INTERRUPT2_H__\r
+\r
+#include <Protocol/HardwareInterrupt.h>\r
+\r
+// 22838932-1a2d-4a47-aaba-f3f7cf569470\r
+\r
+#define EFI_HARDWARE_INTERRUPT2_PROTOCOL_GUID \\r
+  { 0x32898322, 0x2d1a, 0x474a, \\r
+    { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }\r
+\r
+typedef enum {\r
+  EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_LOW,\r
+  EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH,\r
+  EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_FALLING,\r
+  EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING,\r
+} EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE;\r
+\r
+typedef struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL \\r
+                 EFI_HARDWARE_INTERRUPT2_PROTOCOL;\r
+\r
+/**\r
+  Register Handler for the specified interrupt source.\r
+\r
+  @param This     Instance pointer for this protocol\r
+  @param Source   Hardware source of the interrupt\r
+  @param Handler  Callback for interrupt. NULL to unregister\r
+\r
+  @retval EFI_SUCCESS Source was updated to support Handler.\r
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_REGISTER) (\r
+  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN HARDWARE_INTERRUPT_SOURCE Source,\r
+  IN HARDWARE_INTERRUPT_HANDLER Handler\r
+  );\r
+\r
+\r
+/**\r
+  Enable interrupt source Source.\r
+\r
+  @param This     Instance pointer for this protocol\r
+  @param Source   Hardware source of the interrupt\r
+\r
+  @retval EFI_SUCCESS       Source interrupt enabled.\r
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_ENABLE) (\r
+  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN HARDWARE_INTERRUPT_SOURCE Source\r
+  );\r
+\r
+\r
+/**\r
+  Disable interrupt source Source.\r
+\r
+  @param This     Instance pointer for this protocol\r
+  @param Source   Hardware source of the interrupt\r
+\r
+  @retval EFI_SUCCESS       Source interrupt disabled.\r
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_DISABLE) (\r
+  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN HARDWARE_INTERRUPT_SOURCE Source\r
+  );\r
+\r
+\r
+/**\r
+  Return current state of interrupt source Source.\r
+\r
+  @param This     Instance pointer for this protocol\r
+  @param Source   Hardware source of the interrupt\r
+  @param InterruptState  TRUE: source enabled, FALSE: source disabled.\r
+\r
+  @retval EFI_SUCCESS       InterruptState is valid\r
+  @retval EFI_DEVICE_ERROR  InterruptState is not valid\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_INTERRUPT_STATE) (\r
+  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN HARDWARE_INTERRUPT_SOURCE Source,\r
+  IN BOOLEAN *InterruptState\r
+  );\r
+\r
+/**\r
+  Signal to the hardware that the End Of Interrupt state\r
+  has been reached.\r
+\r
+  @param This     Instance pointer for this protocol\r
+  @param Source   Hardware source of the interrupt\r
+\r
+  @retval EFI_SUCCESS       Source interrupt EOI'ed.\r
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_END_OF_INTERRUPT) (\r
+  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN HARDWARE_INTERRUPT_SOURCE Source\r
+  );\r
+\r
+/**\r
+  Return the configured trigger type for an interrupt source\r
+\r
+  @param This         Instance pointer for this protocol\r
+  @param Source       Hardware source of the interrupt\r
+  @param TriggerType  The configured trigger type\r
+\r
+  @retval EFI_SUCCESS       Operation successful\r
+  @retval EFI_DEVICE_ERROR  Information could not be returned\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE) (\r
+  IN  EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN  HARDWARE_INTERRUPT_SOURCE Source,\r
+  OUT EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE *TriggerType\r
+  );\r
+\r
+\r
+/**\r
+ Configure the trigger type for an interrupt source\r
+\r
+  @param This         Instance pointer for this protocol\r
+  @param Source       Hardware source of the interrupt\r
+  @param TriggerType  The trigger type to configure\r
+\r
+  @retval EFI_SUCCESS       Operation successful\r
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE) (\r
+  IN  EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,\r
+  IN  HARDWARE_INTERRUPT_SOURCE Source,\r
+  IN  EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE TriggerType\r
+  );\r
+\r
+struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL {\r
+  HARDWARE_INTERRUPT2_REGISTER            RegisterInterruptSource;\r
+  HARDWARE_INTERRUPT2_ENABLE              EnableInterruptSource;\r
+  HARDWARE_INTERRUPT2_DISABLE             DisableInterruptSource;\r
+  HARDWARE_INTERRUPT2_INTERRUPT_STATE     GetInterruptSourceState;\r
+  HARDWARE_INTERRUPT2_END_OF_INTERRUPT    EndOfInterrupt;\r
+\r
+  // v2 members\r
+  HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE    GetTriggerType;\r
+  HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE    SetTriggerType;\r
+};\r
+\r
+extern EFI_GUID gHardwareInterrupt2ProtocolGuid;\r
+\r
+#endif\r