diff mbox

[v2,45/47] acpi: add acpi_iqr_no_flags() term

Message ID 1421938231-25698-46-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Jan. 22, 2015, 2:50 p.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/acpi-build-utils.c         | 18 ++++++++++++++++++
 include/hw/acpi/acpi-build-utils.h |  1 +
 2 files changed, 19 insertions(+)

Comments

Claudio Fontana Jan. 27, 2015, 3:37 p.m. UTC | #1
Hi,

I think you have to replace "iqr" with "irq" in the function definition and in the commit message.

Ciao,

Claudio

On 22.01.2015 15:50, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/acpi/acpi-build-utils.c         | 18 ++++++++++++++++++
>  include/hw/acpi/acpi-build-utils.h |  1 +
>  2 files changed, 19 insertions(+)
> 
> diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
> index 58f88cd..59873e3 100644
> --- a/hw/acpi/acpi-build-utils.c
> +++ b/hw/acpi/acpi-build-utils.c
> @@ -511,6 +511,24 @@ AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
>      return var;
>  }
>  
> +/*
> + * ACPI 5.0: 19.5.64 IRQNoFlags (Interrupt Resource Descriptor Macro)
> + *           6.4.2.1 IRQ Descriptor
> +*/
> +AcpiAml acpi_iqr_no_flags(uint8_t irq)
> +{
> +    uint16_t irq_mask;
> +    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
> +
> +    assert(irq < 16);
> +    build_append_byte(var.buf, 0x22); /* IRQ descriptor 2 byte form */
> +
> +    irq_mask = 1U << irq;
> +    build_append_byte(var.buf, irq_mask & 0xFF); /* IRQ mask bits[7:0] */
> +    build_append_byte(var.buf, irq_mask >> 8); /* IRQ mask bits[15:8] */
> +    return var;
> +}
> +
>  /* ACPI 5.0: 20.2.5.4 Type 2 Opcodes Encoding: DefLEqual */
>  AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2)
>  {
> diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
> index 868d439..d39b5b1 100644
> --- a/include/hw/acpi/acpi-build-utils.h
> +++ b/include/hw/acpi/acpi-build-utils.h
> @@ -117,6 +117,7 @@ AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
>                     AcpiAml arg3, AcpiAml arg4);
>  AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
>                  uint8_t aln, uint8_t len);
> +AcpiAml acpi_iqr_no_flags(uint8_t irq);
>  AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
>                                uint32_t offset, uint32_t len);
>  AcpiAml acpi_named_field(const char *name, unsigned length);
>
Igor Mammedov Jan. 28, 2015, 12:15 p.m. UTC | #2
On Tue, 27 Jan 2015 16:37:45 +0100
Claudio Fontana <claudio.fontana@huawei.com> wrote:

> Hi,
> 
> I think you have to replace "iqr" with "irq" in the function definition and in the commit message.
sure, I'll fix it.

> 
> Ciao,
> 
> Claudio
> 
> On 22.01.2015 15:50, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/acpi/acpi-build-utils.c         | 18 ++++++++++++++++++
> >  include/hw/acpi/acpi-build-utils.h |  1 +
> >  2 files changed, 19 insertions(+)
> > 
> > diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
> > index 58f88cd..59873e3 100644
> > --- a/hw/acpi/acpi-build-utils.c
> > +++ b/hw/acpi/acpi-build-utils.c
> > @@ -511,6 +511,24 @@ AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
> >      return var;
> >  }
> >  
> > +/*
> > + * ACPI 5.0: 19.5.64 IRQNoFlags (Interrupt Resource Descriptor Macro)
> > + *           6.4.2.1 IRQ Descriptor
> > +*/
> > +AcpiAml acpi_iqr_no_flags(uint8_t irq)
> > +{
> > +    uint16_t irq_mask;
> > +    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
> > +
> > +    assert(irq < 16);
> > +    build_append_byte(var.buf, 0x22); /* IRQ descriptor 2 byte form */
> > +
> > +    irq_mask = 1U << irq;
> > +    build_append_byte(var.buf, irq_mask & 0xFF); /* IRQ mask bits[7:0] */
> > +    build_append_byte(var.buf, irq_mask >> 8); /* IRQ mask bits[15:8] */
> > +    return var;
> > +}
> > +
> >  /* ACPI 5.0: 20.2.5.4 Type 2 Opcodes Encoding: DefLEqual */
> >  AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2)
> >  {
> > diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
> > index 868d439..d39b5b1 100644
> > --- a/include/hw/acpi/acpi-build-utils.h
> > +++ b/include/hw/acpi/acpi-build-utils.h
> > @@ -117,6 +117,7 @@ AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
> >                     AcpiAml arg3, AcpiAml arg4);
> >  AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
> >                  uint8_t aln, uint8_t len);
> > +AcpiAml acpi_iqr_no_flags(uint8_t irq);
> >  AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
> >                                uint32_t offset, uint32_t len);
> >  AcpiAml acpi_named_field(const char *name, unsigned length);
> > 
> 
> 
>
diff mbox

Patch

diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
index 58f88cd..59873e3 100644
--- a/hw/acpi/acpi-build-utils.c
+++ b/hw/acpi/acpi-build-utils.c
@@ -511,6 +511,24 @@  AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
     return var;
 }
 
+/*
+ * ACPI 5.0: 19.5.64 IRQNoFlags (Interrupt Resource Descriptor Macro)
+ *           6.4.2.1 IRQ Descriptor
+*/
+AcpiAml acpi_iqr_no_flags(uint8_t irq)
+{
+    uint16_t irq_mask;
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+
+    assert(irq < 16);
+    build_append_byte(var.buf, 0x22); /* IRQ descriptor 2 byte form */
+
+    irq_mask = 1U << irq;
+    build_append_byte(var.buf, irq_mask & 0xFF); /* IRQ mask bits[7:0] */
+    build_append_byte(var.buf, irq_mask >> 8); /* IRQ mask bits[15:8] */
+    return var;
+}
+
 /* ACPI 5.0: 20.2.5.4 Type 2 Opcodes Encoding: DefLEqual */
 AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2)
 {
diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
index 868d439..d39b5b1 100644
--- a/include/hw/acpi/acpi-build-utils.h
+++ b/include/hw/acpi/acpi-build-utils.h
@@ -117,6 +117,7 @@  AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
                    AcpiAml arg3, AcpiAml arg4);
 AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
                 uint8_t aln, uint8_t len);
+AcpiAml acpi_iqr_no_flags(uint8_t irq);
 AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
                               uint32_t offset, uint32_t len);
 AcpiAml acpi_named_field(const char *name, unsigned length);