diff mbox

[v2,35/47] acpi: add acpi_reserved_field() term

Message ID 1421938231-25698-36-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         | 10 ++++++++++
 include/hw/acpi/acpi-build-utils.h |  6 ++++++
 2 files changed, 16 insertions(+)

Comments

Marcel Apfelbaum Feb. 5, 2015, 3:36 p.m. UTC | #1
On 01/22/2015 04:50 PM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/acpi-build-utils.c         | 10 ++++++++++
>   include/hw/acpi/acpi-build-utils.h |  6 ++++++
>   2 files changed, 16 insertions(+)
>
> diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
> index cbc1241..644af1f 100644
> --- a/hw/acpi/acpi-build-utils.c
> +++ b/hw/acpi/acpi-build-utils.c
> @@ -591,6 +591,16 @@ AcpiAml acpi_named_field(const char *name, unsigned length)
>       return var;
>   }
>
> +/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: ReservedField */
> +AcpiAml acpi_reserved_field(unsigned length)
> +{
> +    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
> +    /* ReservedField  := 0x00 PkgLength */
> +    build_append_byte(var.buf, 0x00);
> +    build_append_pkg_length(var.buf, length, false);
> +    return var;
> +}
> +
>   /* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefField */
>   AcpiAml acpi_field(const char *name, acpiFieldFlags flags)
>   {
> diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
> index 02d5aa8..048ed26 100644
> --- a/include/hw/acpi/acpi-build-utils.h
> +++ b/include/hw/acpi/acpi-build-utils.h
> @@ -25,7 +25,12 @@ typedef enum {
>   } acpiIODecode;
     ^^^
>
>   typedef enum {
> +    acpi_any_acc = 0,
>       acpi_byte_acc = 1,
> +    acpi_word_acc = 2,
> +    acpi_dword_acc = 3,
> +    acpi_qword_acc = 4,
> +    acpi_buffer_acc = 5,
>   } acpiFieldFlags;
      ^^^
I missed that, is there any way it was like that already? Do we have such
a coding convention on QEMU?

Thanks,
Marcel

>
>   typedef enum {
> @@ -58,6 +63,7 @@ AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
>   AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
>                                 uint32_t offset, uint32_t len);
>   AcpiAml acpi_named_field(const char *name, unsigned length);
> +AcpiAml acpi_reserved_field(unsigned length);
>   AcpiAml GCC_FMT_ATTR(1, 2) acpi_string(const char *name_format, ...);
>   AcpiAml acpi_local0(void);
>   AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2);
>
Igor Mammedov Feb. 5, 2015, 5:57 p.m. UTC | #2
On Thu, 05 Feb 2015 17:36:16 +0200
Marcel Apfelbaum <marcel@redhat.com> wrote:

> On 01/22/2015 04:50 PM, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/acpi/acpi-build-utils.c         | 10 ++++++++++
> >   include/hw/acpi/acpi-build-utils.h |  6 ++++++
> >   2 files changed, 16 insertions(+)
> >
> > diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
> > index cbc1241..644af1f 100644
> > --- a/hw/acpi/acpi-build-utils.c
> > +++ b/hw/acpi/acpi-build-utils.c
> > @@ -591,6 +591,16 @@ AcpiAml acpi_named_field(const char *name, unsigned length)
> >       return var;
> >   }
> >
> > +/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: ReservedField */
> > +AcpiAml acpi_reserved_field(unsigned length)
> > +{
> > +    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
> > +    /* ReservedField  := 0x00 PkgLength */
> > +    build_append_byte(var.buf, 0x00);
> > +    build_append_pkg_length(var.buf, length, false);
> > +    return var;
> > +}
> > +
> >   /* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefField */
> >   AcpiAml acpi_field(const char *name, acpiFieldFlags flags)
> >   {
> > diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
> > index 02d5aa8..048ed26 100644
> > --- a/include/hw/acpi/acpi-build-utils.h
> > +++ b/include/hw/acpi/acpi-build-utils.h
> > @@ -25,7 +25,12 @@ typedef enum {
> >   } acpiIODecode;
>      ^^^
> >
> >   typedef enum {
> > +    acpi_any_acc = 0,
> >       acpi_byte_acc = 1,
> > +    acpi_word_acc = 2,
> > +    acpi_dword_acc = 3,
> > +    acpi_qword_acc = 4,
> > +    acpi_buffer_acc = 5,
> >   } acpiFieldFlags;
>       ^^^
> I missed that, is there any way it was like that already? Do we have such
> a coding convention on QEMU?
Fixed

> 
> Thanks,
> Marcel
> 
> >
> >   typedef enum {
> > @@ -58,6 +63,7 @@ AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
> >   AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
> >                                 uint32_t offset, uint32_t len);
> >   AcpiAml acpi_named_field(const char *name, unsigned length);
> > +AcpiAml acpi_reserved_field(unsigned length);
> >   AcpiAml GCC_FMT_ATTR(1, 2) acpi_string(const char *name_format, ...);
> >   AcpiAml acpi_local0(void);
> >   AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2);
> >
>
diff mbox

Patch

diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
index cbc1241..644af1f 100644
--- a/hw/acpi/acpi-build-utils.c
+++ b/hw/acpi/acpi-build-utils.c
@@ -591,6 +591,16 @@  AcpiAml acpi_named_field(const char *name, unsigned length)
     return var;
 }
 
+/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: ReservedField */
+AcpiAml acpi_reserved_field(unsigned length)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    /* ReservedField  := 0x00 PkgLength */
+    build_append_byte(var.buf, 0x00);
+    build_append_pkg_length(var.buf, length, false);
+    return var;
+}
+
 /* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefField */
 AcpiAml acpi_field(const char *name, acpiFieldFlags flags)
 {
diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
index 02d5aa8..048ed26 100644
--- a/include/hw/acpi/acpi-build-utils.h
+++ b/include/hw/acpi/acpi-build-utils.h
@@ -25,7 +25,12 @@  typedef enum {
 } acpiIODecode;
 
 typedef enum {
+    acpi_any_acc = 0,
     acpi_byte_acc = 1,
+    acpi_word_acc = 2,
+    acpi_dword_acc = 3,
+    acpi_qword_acc = 4,
+    acpi_buffer_acc = 5,
 } acpiFieldFlags;
 
 typedef enum {
@@ -58,6 +63,7 @@  AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
 AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
                               uint32_t offset, uint32_t len);
 AcpiAml acpi_named_field(const char *name, unsigned length);
+AcpiAml acpi_reserved_field(unsigned length);
 AcpiAml GCC_FMT_ATTR(1, 2) acpi_string(const char *name_format, ...);
 AcpiAml acpi_local0(void);
 AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2);