public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: evan.lloyd@arm.com
Cc: edk2-devel@lists.01.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Matteo Carlini <Matteo.Carlini@arm.com>,
	nd@arm.com
Subject: Re: [PATCH 2/5] EmbeddedPkg: Introduce HardwareInterrupt2 protocol
Date: Thu, 14 Sep 2017 17:42:24 +0100	[thread overview]
Message-ID: <20170914164224.lqrqkq4ot3ozftyo@bivouac.eciton.net> (raw)
In-Reply-To: <20170911152335.72672-3-evan.lloyd@arm.com>

On Mon, Sep 11, 2017 at 04:23:32PM +0100, evan.lloyd@arm.com wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> 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.0
> 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                       |   1 +
>  EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h | 182 ++++++++++++++++++++
>  2 files changed, 183 insertions(+)
> 
> diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
> index 0be102ad9c767d81a004c757f40a65063aab1d7a..151b1d503dee463d529a173d2555b6c9208100e5 100644
> --- a/EmbeddedPkg/EmbeddedPkg.dec
> +++ b/EmbeddedPkg/EmbeddedPkg.dec
> @@ -69,6 +69,7 @@ [Guids.common]
>  
>  [Protocols.common]
>    gHardwareInterruptProtocolGuid =  { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }
> +  gHardwareInterrupt2ProtocolGuid = { 0x32898322, 0x2da1, 0x474a, { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }
>    gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } }
>    gEfiEblAddCommandProtocolGuid =   { 0xaeda2428, 0x9a22, 0x4637, { 0x9b, 0x21, 0x54, 0x5e, 0x28, 0xfb, 0xb8, 0x29 } }
>    gEmbeddedDeviceGuid =   { 0xbf4b9d10, 0x13ec, 0x43dd, { 0x88, 0x80, 0xe9, 0xb, 0x71, 0x8f, 0x27, 0xde } }
> diff --git a/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h b/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..505052bd81afe7432e3122a2722ceab348777c29
> --- /dev/null
> +++ b/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h
> @@ -0,0 +1,182 @@
> +/** @file
> +
> +  Copyright (c) 2016-2017, 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 __HARDWARE_INTERRUPT2_H__
> +#define __HARDWARE_INTERRUPT2_H__
> +
> +#include <Protocol/HardwareInterrupt.h>
> +
> +// 22838932-1a2d-4a47-aaba-f3f7cf569470
> +
> +#define EFI_HARDWARE_INTERRUPT2_PROTOCOL_GUID \
> +  { 0x32898322, 0x2d1a, 0x474a, \
> +    { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }
> +
> +typedef enum {
> +  EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_LOW,
> +  EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH,
> +  EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_FALLING,
> +  EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING,
> +} EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE;
> +
> +typedef struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL \
> +                 EFI_HARDWARE_INTERRUPT2_PROTOCOL;
> +
> +/**
> +  Register Handler for the specified interrupt source.
> +
> +  @param This     Instance pointer for this protocol
> +  @param Source   Hardware source of the interrupt
> +  @param Handler  Callback for interrupt. NULL to unregister
> +
> +  @retval EFI_SUCCESS Source was updated to support Handler.
> +  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_REGISTER) (
> +  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN HARDWARE_INTERRUPT_SOURCE Source,
> +  IN HARDWARE_INTERRUPT_HANDLER Handler
> +  );
> +
> +
> +/**
> +  Enable interrupt source Source.
> +
> +  @param This     Instance pointer for this protocol
> +  @param Source   Hardware source of the interrupt
> +
> +  @retval EFI_SUCCESS       Source interrupt enabled.
> +  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_ENABLE) (
> +  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN HARDWARE_INTERRUPT_SOURCE Source
> +  );
> +
> +
> +/**
> +  Disable interrupt source Source.
> +
> +  @param This     Instance pointer for this protocol
> +  @param Source   Hardware source of the interrupt
> +
> +  @retval EFI_SUCCESS       Source interrupt disabled.
> +  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_DISABLE) (
> +  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN HARDWARE_INTERRUPT_SOURCE Source
> +  );
> +
> +
> +/**
> +  Return current state of interrupt source Source.
> +
> +  @param This     Instance pointer for this protocol
> +  @param Source   Hardware source of the interrupt
> +  @param InterruptState  TRUE: source enabled, FALSE: source disabled.
> +
> +  @retval EFI_SUCCESS       InterruptState is valid
> +  @retval EFI_DEVICE_ERROR  InterruptState is not valid
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_INTERRUPT_STATE) (
> +  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN HARDWARE_INTERRUPT_SOURCE Source,
> +  IN BOOLEAN *InterruptState
> +  );
> +
> +/**
> +  Signal to the hardware that the End Of Intrrupt state
> +  has been reached.
> +
> +  @param This     Instance pointer for this protocol
> +  @param Source   Hardware source of the interrupt
> +
> +  @retval EFI_SUCCESS       Source interrupt EOI'ed.
> +  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_END_OF_INTERRUPT) (
> +  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN HARDWARE_INTERRUPT_SOURCE Source
> +  );
> +
> +/**
> +  Return the configured trigger type for an interrupt source
> +
> +  @param This         Instance pointer for this protocol
> +  @param Source       Hardware source of the interrupt
> +  @param TriggerType  The configured trigger type
> +
> +  @retval EFI_SUCCESS       Operation successful
> +  @retval EFI_DEVICE_ERROR  Information could not be returned
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE) (
> +  IN  EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN  HARDWARE_INTERRUPT_SOURCE Source,
> +  OUT EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE *TriggerType
> +  );
> +
> +
> +/**
> + Configure the trigger type for an interrupt source
> +
> +  @param This         Instance pointer for this protocol
> +  @param Source       Hardware source of the interrupt
> +  @param TriggerType  The trigger type to configure
> +
> +  @retval EFI_SUCCESS       Operation successful
> +  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE) (
> +  IN  EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
> +  IN  HARDWARE_INTERRUPT_SOURCE Source,
> +  IN  EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE TriggerType
> +  );
> +
> +struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL {
> +  HARDWARE_INTERRUPT2_REGISTER            RegisterInterruptSource;
> +  HARDWARE_INTERRUPT2_ENABLE              EnableInterruptSource;
> +  HARDWARE_INTERRUPT2_DISABLE             DisableInterruptSource;
> +  HARDWARE_INTERRUPT2_INTERRUPT_STATE     GetInterruptSourceState;
> +  HARDWARE_INTERRUPT2_END_OF_INTERRUPT    EndOfInterrupt;
> +
> +  // v2 members
> +  HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE    GetTriggerType;
> +  HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE    SetTriggerType;
> +};
> +
> +extern EFI_GUID gHardwareInterrupt2ProtocolGuid;
> +
> +#endif
> -- 
> Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
> 


  reply	other threads:[~2017-09-14 16:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 15:23 [PATCH 0/5] Add HardwareInterrupt2 for ARM evan.lloyd
2017-09-11 15:23 ` [PATCH 1/5] ArmPkg: Tidy GIC code before changes evan.lloyd
2017-09-14 16:41   ` Leif Lindholm
2017-09-21 15:34     ` Evan Lloyd
2017-09-21 17:43       ` Leif Lindholm
2017-09-11 15:23 ` [PATCH 2/5] EmbeddedPkg: Introduce HardwareInterrupt2 protocol evan.lloyd
2017-09-14 16:42   ` Leif Lindholm [this message]
2017-09-15  9:21     ` Alexei Fedorov
2017-09-11 15:23 ` [PATCH 3/5] ArmPkg/ArmGicDxe: Expose " evan.lloyd
2017-09-14 17:00   ` Leif Lindholm
2017-09-11 15:23 ` [PATCH 4/5] ArmPkg/GenericWatchdogDxe: Set Watchdog interrupt type evan.lloyd
2017-09-14 17:06   ` Leif Lindholm
2017-09-11 15:23 ` [PATCH 5/5] ArmPkg: Tidy up GenericWatchdogDxe.c evan.lloyd
2017-09-14 17:10   ` Leif Lindholm
  -- strict thread matches above, loose matches on Subject: below --
2017-02-16 22:14 [PATCH 0/5] HardwareInterrupt2 protocol evan.lloyd
2017-02-16 22:14 ` [PATCH 2/5] EmbeddedPkg: Introduce " evan.lloyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170914164224.lqrqkq4ot3ozftyo@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox