All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: imammedo@redhat.com, qemu-devel@nongnu.org, shannon.zhao@linaro.org
Subject: Re: [Qemu-devel] [PATCH 1/2] ACPI: Add definitions for the SPCR table
Date: Tue, 9 Jun 2015 16:52:39 +0200	[thread overview]
Message-ID: <20150609163941-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1433772050-28113-2-git-send-email-drjones@redhat.com>

On Mon, Jun 08, 2015 at 10:00:49AM -0400, Andrew Jones wrote:
> SPCR is the Serial Port Console Redirection table. See the document
> linked from http://uefi.org/acpi. For serial port types, "Interface
> Type", see the documentation for the Debug Port Table 2 (DBG2).
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  include/hw/acpi/acpi-defs.h | 72 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 72 insertions(+)
> 
> diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
> index 59cf277434b37..e579d4c509fc8 100644
> --- a/include/hw/acpi/acpi-defs.h
> +++ b/include/hw/acpi/acpi-defs.h
> @@ -197,6 +197,78 @@ enum {
>  };
>  
>  /*
> + * ACPI Serial Port Console Redirection Table
> + */
> +enum {
> +    ACPI_SERIAL_16550_COMPAT        = 0,
> +    ACPI_SERIAL_16550_SUBSET_COMPAT = 1,
> +    ACPI_SERIAL_ARM_PL011_UART      = 3,
> +};
> +
> +enum {
> +    ACPI_SERIAL_ITYPE_PC            = 1,
> +    ACPI_SERIAL_ITYPE_APIC          = 2,
> +    ACPI_SERIAL_ITYPE_SAPIC         = 4,
> +    ACPI_SERIAL_ITYPE_ARMH_GIC      = 8,
> +};
> +
> +enum {
> +    ACPI_SERIAL_BAUD_9600           = 3,
> +    ACPI_SERIAL_BAUD_19200          = 4,
> +    ACPI_SERIAL_BAUD_57600          = 6,
> +    ACPI_SERIAL_BAUD_115200         = 7,
> +};
> +
> +enum {
> +    ACPI_SERIAL_FLOW_DCD_REQUIRED   = 1,
> +    ACPI_SERIAL_FLOW_HW             = 2,
> +    ACPI_SERIAL_FLOW_SW             = 4,
> +};
> +
> +enum {
> +    ACPI_SERIAL_TERM_VT100          = 0,
> +    ACPI_SERIAL_TERM_VT100_PLUS     = 1,
> +    ACPI_SERIAL_TERM_VT_UTF8        = 2,
> +    ACPI_SERIAL_TERM_ANSI           = 3,
> +};
> +

Please don't do these single-use enums, this more than doubles the
amount of code required and makes it hard to look up things in spec.
Do this instead
	sprc->interface_type = 0x0; /* full 16550 interface */

you should also list earliest spec version which has the data
since spec text changes with time.

> +struct AcpiSerialPortConsoleRedirection
> +{
> +    ACPI_TABLE_HEADER_DEF            /* ACPI common table header */
> +    uint8_t  interface_type;         /* See ACPI_SERIAL_ enums */
> +    uint8_t  reserved1[3];           /* Reserved, must be 0 */
> +    struct AcpiGenericAddress base_address;
> +    uint8_t  interrupt_types;        /* Interrupt type support mask,
> +                                      * see ACPI_SERIAL_ITYPE_ enums */
> +    uint8_t  irq;                    /* PC irq used. 0 if ACPI_SERIAL_ITYPE_PC
> +                                      * is not set, else must be one of
> +                                      * 2-7,9-12,14-15 */
> +    uint32_t gsi;                    /* Not valid if only ACPI_SERIAL_ITYPE_PC
> +                                      * is set in the interrupt_types mask */
> +    uint8_t  baud;                   /* See ACPI_SERIAL_BAUD_ enums */
> +    uint8_t  parity;                 /* 0 = no parity, 1-255 reserved */
> +    uint8_t  stopbits;               /* Must be 1 */
> +    uint8_t  flowctrl;               /* See ACPI_SERIAL_FLOW_ enums */
> +    uint8_t  term_type;              /* See ACPI_SERIAL_TERM_ enums */
> +    uint8_t  reserved2;              /* Reserved, must be 0 */
> +    uint16_t pci_device_id;          /* 0xffff, if not a pci dev */
> +    uint16_t pci_vendor_id;          /* 0xffff, if not a pci dev */
> +    uint8_t  pci_bus;                /* PCI bus number, 0 if not a pci dev */
> +    uint8_t  pci_slot;               /* PCI slot number, 0 if not a pci dev */
> +    uint8_t  pci_func;               /* PCI function num, 0 if not a pci dev */
> +    uint32_t pci_flags;              /* PCI compatibility mask,
> +                                      *   bits 1-31 reserved
> +                                      *   bit0 = 0, if not a pci dev
> +                                      *   bit0 = 1, don't suppress PNP or
> +                                      *             power management
> +                                      */
> +    uint8_t  pci_seg;                /* PCI segment number, 0 for systems
> +                                        with less than 255 PCI busses */
> +    uint32_t reserved3;              /* Reserved, must be 0 */
> +} QEMU_PACKED;
> +typedef struct AcpiSerialPortConsoleRedirection AcpiSerialPortConsoleRedirection;
> +
> +/*
>   * ACPI 1.0 Root System Description Table (RSDT)
>   */
>  struct AcpiRsdtDescriptorRev1
> -- 
> 1.8.3.1

  parent reply	other threads:[~2015-06-09 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 14:00 [Qemu-devel] [PATCH 0/2] ACPI: ARM: add SPCR table Andrew Jones
2015-06-08 14:00 ` [Qemu-devel] [PATCH 1/2] ACPI: Add definitions for the " Andrew Jones
2015-06-09 10:53   ` Shannon Zhao
2015-06-09 14:52   ` Michael S. Tsirkin [this message]
2015-06-09 17:03     ` Andrew Jones
2015-06-09 17:28       ` Michael S. Tsirkin
2015-06-08 14:00 ` [Qemu-devel] [PATCH 2/2] hw/arm/virt-acpi-build: Add " Andrew Jones
2015-06-09  2:54   ` Shannon Zhao
2015-06-09  9:53     ` Andrew Jones
2015-06-09 11:10   ` Shannon Zhao
2015-06-09 11:13 ` [Qemu-devel] [PATCH 0/2] ACPI: ARM: add " Shannon Zhao

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-all 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=20150609163941-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=drjones@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.