Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p0sdk-0004Ob-43 for mharc-grub-devel@gnu.org; Thu, 01 Dec 2022 18:06:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0sdi-0004NF-LY for grub-devel@gnu.org; Thu, 01 Dec 2022 18:06:46 -0500 Received: from gate.crashing.org ([63.228.1.57]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0sdg-0005pw-TQ for grub-devel@gnu.org; Thu, 01 Dec 2022 18:06:46 -0500 Received: from u0f3226c756e75a.ant.amazon.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 2B1N5ULr005438; Thu, 1 Dec 2022 17:05:39 -0600 From: Benjamin Herrenschmidt To: grub-devel@gnu.org Cc: Benjamin Herrenschmidt , Benjamin Herrenschmidt Subject: [PATCH 2/7] acpi: Add SPCR and generic address definitions Date: Fri, 2 Dec 2022 10:05:21 +1100 Message-Id: <20221201230526.881378-3-benh@kernel.crashing.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221201230526.881378-1-benh@kernel.crashing.org> References: <20221201230526.881378-1-benh@kernel.crashing.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=63.228.1.57; envelope-from=benh@kernel.crashing.org; helo=gate.crashing.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2022 23:06:46 -0000 From: Benjamin Herrenschmidt Signed-off-by: Benjamin Herrenschmidt --- include/grub/acpi.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/include/grub/acpi.h b/include/grub/acpi.h index 8c126b2b9..17aadb802 100644 --- a/include/grub/acpi.h +++ b/include/grub/acpi.h @@ -179,6 +179,57 @@ enum GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED = 1 }; +struct grub_acpi_genaddr { + grub_uint8_t space_id; +#define GRUB_ACPI_GENADDR_MEM_SPACE 0x00 +#define GRUB_ACPI_GENADDR_IO_SPACE 0x01 + grub_uint8_t bit_width; + grub_uint8_t bit_offset; + grub_uint8_t access_size; +#define GRUB_ACPI_GENADDR_SIZE_LGCY 0x00 +#define GRUB_ACPI_GENADDR_SIZE_BYTE 0x01 +#define GRUB_ACPI_GENADDR_SIZE_WORD 0x02 +#define GRUB_ACPI_GENADDR_SIZE_DWORD 0x03 +#define GRUB_ACPI_GENADDR_SIZE_QWORD 0x04 + grub_uint64_t addr; +} GRUB_PACKED; + +#define GRUB_ACPI_SPCR_SIGNATURE "SPCR" + +struct grub_acpi_spcr { + struct grub_acpi_table_header hdr; + grub_uint8_t intf_type; +#define GRUB_ACPI_SPCR_INTF_TYPE_16550 0x00 +#define GRUB_ACPI_SPCR_INTF_TYPE_16550X 0x01 + grub_uint8_t reserved_0[3]; + struct grub_acpi_genaddr base_addr; + grub_uint8_t interrupt_type; + grub_uint8_t irq; + grub_uint32_t gsi; + grub_uint8_t baud_rate; +#define GRUB_ACPI_SPCR_BAUD_CURRENT 0x00 +#define GRUB_ACPI_SPCR_BAUD_9600 0x03 +#define GRUB_ACPI_SPCR_BAUD_19200 0x04 +#define GRUB_ACPI_SPCR_BAUD_57600 0x06 +#define GRUB_ACPI_SPCR_BAUD_115200 0x07 + grub_uint8_t parity; + grub_uint8_t stop_bits; + grub_uint8_t flow_control; +#define GRUB_ACPI_SPCR_FC_DCD_TX (1 << 0) +#define GRUB_ACPI_SPCR_FC_RTSCTS (1 << 1) +#define GRUB_ACPI_SPCR_FC_XONXOFF (1 << 2) + grub_uint8_t terminal_type; + grub_uint8_t language; + grub_uint16_t pci_device_id; + grub_uint16_t pci_vendor_id; + grub_uint8_t pci_bus; + grub_uint8_t pci_device; + grub_uint8_t pci_function; + grub_uint32_t pci_flags; + grub_uint8_t pci_segment; + grub_uint32_t reserved_1; +} GRUB_PACKED; + #ifndef GRUB_DSDT_TEST struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void); struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void); -- 2.34.1