Message ID | 1421938231-25698-25-git-send-email-imammedo@redhat.com |
---|---|
State | New |
Headers | show |
On 01/22/2015 04:50 PM, Igor Mammedov wrote: > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > --- > hw/acpi/acpi-build-utils.c | 14 ++++++++++++++ > include/hw/acpi/acpi-build-utils.h | 7 +++++++ > 2 files changed, 21 insertions(+) > > diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c > index 094c821..9ac5a0d 100644 > --- a/hw/acpi/acpi-build-utils.c > +++ b/hw/acpi/acpi-build-utils.c > @@ -544,3 +544,17 @@ AcpiAml acpi_package(uint8_t num_elements) > build_append_byte(var.buf, num_elements); > return var; > } > + > +/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefOpRegion */ > +AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs, > + uint32_t offset, uint32_t len) > +{ > + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > + build_append_byte(var.buf, 0x5B); /* ExtOpPrefix */ > + build_append_byte(var.buf, 0x80); /* OpRegionOp */ > + build_append_namestring(var.buf, "%s", name); > + build_append_byte(var.buf, rs); > + build_append_int(var.buf, offset); > + build_append_int(var.buf, len); > + return var; > +} > diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h > index 176596e..cb45129 100644 > --- a/include/hw/acpi/acpi-build-utils.h > +++ b/include/hw/acpi/acpi-build-utils.h > @@ -24,6 +24,11 @@ typedef enum { > acpi_decode16 = 1, > } acpiIODecode; ^^^ Why do you want enums to no start with capital letters? Thanks, Marcel > > +typedef enum { > + acpi_system_memory = 0x00, > + acpi_system_io = 0x01, > +} acpiRegionSpace; > + > void aml_append(AcpiAml *parent_ctx, AcpiAml child); > > /* non block ASL object primitives */ > @@ -46,6 +51,8 @@ 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_operation_region(const char *name, acpiRegionSpace rs, > + uint32_t offset, uint32_t len); > > /* Block ASL object primitives */ > AcpiAml acpi_if(AcpiAml predicate); >
On Thu, 05 Feb 2015 17:28:39 +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 | 14 ++++++++++++++ > > include/hw/acpi/acpi-build-utils.h | 7 +++++++ > > 2 files changed, 21 insertions(+) > > > > diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c > > index 094c821..9ac5a0d 100644 > > --- a/hw/acpi/acpi-build-utils.c > > +++ b/hw/acpi/acpi-build-utils.c > > @@ -544,3 +544,17 @@ AcpiAml acpi_package(uint8_t num_elements) > > build_append_byte(var.buf, num_elements); > > return var; > > } > > + > > +/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefOpRegion */ > > +AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs, > > + uint32_t offset, uint32_t len) > > +{ > > + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > > + build_append_byte(var.buf, 0x5B); /* ExtOpPrefix */ > > + build_append_byte(var.buf, 0x80); /* OpRegionOp */ > > + build_append_namestring(var.buf, "%s", name); > > + build_append_byte(var.buf, rs); > > + build_append_int(var.buf, offset); > > + build_append_int(var.buf, len); > > + return var; > > +} > > diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h > > index 176596e..cb45129 100644 > > --- a/include/hw/acpi/acpi-build-utils.h > > +++ b/include/hw/acpi/acpi-build-utils.h > > @@ -24,6 +24,11 @@ typedef enum { > > acpi_decode16 = 1, > > } acpiIODecode; > ^^^ > Why do you want enums to no start with capital letters? fixed > > Thanks, > Marcel > > > > > +typedef enum { > > + acpi_system_memory = 0x00, > > + acpi_system_io = 0x01, > > +} acpiRegionSpace; > > + > > void aml_append(AcpiAml *parent_ctx, AcpiAml child); > > > > /* non block ASL object primitives */ > > @@ -46,6 +51,8 @@ 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_operation_region(const char *name, acpiRegionSpace rs, > > + uint32_t offset, uint32_t len); > > > > /* Block ASL object primitives */ > > AcpiAml acpi_if(AcpiAml predicate); > > >
diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c index 094c821..9ac5a0d 100644 --- a/hw/acpi/acpi-build-utils.c +++ b/hw/acpi/acpi-build-utils.c @@ -544,3 +544,17 @@ AcpiAml acpi_package(uint8_t num_elements) build_append_byte(var.buf, num_elements); return var; } + +/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefOpRegion */ +AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs, + uint32_t offset, uint32_t len) +{ + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); + build_append_byte(var.buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var.buf, 0x80); /* OpRegionOp */ + build_append_namestring(var.buf, "%s", name); + build_append_byte(var.buf, rs); + build_append_int(var.buf, offset); + build_append_int(var.buf, len); + return var; +} diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h index 176596e..cb45129 100644 --- a/include/hw/acpi/acpi-build-utils.h +++ b/include/hw/acpi/acpi-build-utils.h @@ -24,6 +24,11 @@ typedef enum { acpi_decode16 = 1, } acpiIODecode; +typedef enum { + acpi_system_memory = 0x00, + acpi_system_io = 0x01, +} acpiRegionSpace; + void aml_append(AcpiAml *parent_ctx, AcpiAml child); /* non block ASL object primitives */ @@ -46,6 +51,8 @@ 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_operation_region(const char *name, acpiRegionSpace rs, + uint32_t offset, uint32_t len); /* Block ASL object primitives */ AcpiAml acpi_if(AcpiAml predicate);
Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/acpi/acpi-build-utils.c | 14 ++++++++++++++ include/hw/acpi/acpi-build-utils.h | 7 +++++++ 2 files changed, 21 insertions(+)