18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Definitions for PCDP-defined console devices 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * For DIG64_HCDPv10a_01.pdf and DIG64_PCDPv20.pdf (v1.0a and v2.0 resp.), 68c2ecf20Sopenharmony_ci * please see <http://www.dig64.org/specifications/> 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * (c) Copyright 2002, 2004 Hewlett-Packard Development Company, L.P. 98c2ecf20Sopenharmony_ci * Khalid Aziz <khalid.aziz@hp.com> 108c2ecf20Sopenharmony_ci * Bjorn Helgaas <bjorn.helgaas@hp.com> 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define PCDP_CONSOLE 0 148c2ecf20Sopenharmony_ci#define PCDP_DEBUG 1 158c2ecf20Sopenharmony_ci#define PCDP_CONSOLE_OUTPUT 2 168c2ecf20Sopenharmony_ci#define PCDP_CONSOLE_INPUT 3 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define PCDP_UART (0 << 3) 198c2ecf20Sopenharmony_ci#define PCDP_VGA (1 << 3) 208c2ecf20Sopenharmony_ci#define PCDP_USB (2 << 3) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* pcdp_uart.type and pcdp_device.type */ 238c2ecf20Sopenharmony_ci#define PCDP_CONSOLE_UART (PCDP_UART | PCDP_CONSOLE) 248c2ecf20Sopenharmony_ci#define PCDP_DEBUG_UART (PCDP_UART | PCDP_DEBUG) 258c2ecf20Sopenharmony_ci#define PCDP_CONSOLE_VGA (PCDP_VGA | PCDP_CONSOLE_OUTPUT) 268c2ecf20Sopenharmony_ci#define PCDP_CONSOLE_USB (PCDP_USB | PCDP_CONSOLE_INPUT) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* pcdp_uart.flags */ 298c2ecf20Sopenharmony_ci#define PCDP_UART_EDGE_SENSITIVE (1 << 0) 308c2ecf20Sopenharmony_ci#define PCDP_UART_ACTIVE_LOW (1 << 1) 318c2ecf20Sopenharmony_ci#define PCDP_UART_PRIMARY_CONSOLE (1 << 2) 328c2ecf20Sopenharmony_ci#define PCDP_UART_IRQ (1 << 6) /* in pci_func for rev < 3 */ 338c2ecf20Sopenharmony_ci#define PCDP_UART_PCI (1 << 7) /* in pci_func for rev < 3 */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct pcdp_uart { 368c2ecf20Sopenharmony_ci u8 type; 378c2ecf20Sopenharmony_ci u8 bits; 388c2ecf20Sopenharmony_ci u8 parity; 398c2ecf20Sopenharmony_ci u8 stop_bits; 408c2ecf20Sopenharmony_ci u8 pci_seg; 418c2ecf20Sopenharmony_ci u8 pci_bus; 428c2ecf20Sopenharmony_ci u8 pci_dev; 438c2ecf20Sopenharmony_ci u8 pci_func; 448c2ecf20Sopenharmony_ci u64 baud; 458c2ecf20Sopenharmony_ci struct acpi_generic_address addr; 468c2ecf20Sopenharmony_ci u16 pci_dev_id; 478c2ecf20Sopenharmony_ci u16 pci_vendor_id; 488c2ecf20Sopenharmony_ci u32 gsi; 498c2ecf20Sopenharmony_ci u32 clock_rate; 508c2ecf20Sopenharmony_ci u8 pci_prog_intfc; 518c2ecf20Sopenharmony_ci u8 flags; 528c2ecf20Sopenharmony_ci u16 conout_index; 538c2ecf20Sopenharmony_ci u32 reserved; 548c2ecf20Sopenharmony_ci} __attribute__((packed)); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define PCDP_IF_PCI 1 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* pcdp_if_pci.trans */ 598c2ecf20Sopenharmony_ci#define PCDP_PCI_TRANS_IOPORT 0x02 608c2ecf20Sopenharmony_ci#define PCDP_PCI_TRANS_MMIO 0x01 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistruct pcdp_if_pci { 638c2ecf20Sopenharmony_ci u8 interconnect; 648c2ecf20Sopenharmony_ci u8 reserved; 658c2ecf20Sopenharmony_ci u16 length; 668c2ecf20Sopenharmony_ci u8 segment; 678c2ecf20Sopenharmony_ci u8 bus; 688c2ecf20Sopenharmony_ci u8 dev; 698c2ecf20Sopenharmony_ci u8 fun; 708c2ecf20Sopenharmony_ci u16 dev_id; 718c2ecf20Sopenharmony_ci u16 vendor_id; 728c2ecf20Sopenharmony_ci u32 acpi_interrupt; 738c2ecf20Sopenharmony_ci u64 mmio_tra; 748c2ecf20Sopenharmony_ci u64 ioport_tra; 758c2ecf20Sopenharmony_ci u8 flags; 768c2ecf20Sopenharmony_ci u8 trans; 778c2ecf20Sopenharmony_ci} __attribute__((packed)); 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistruct pcdp_vga { 808c2ecf20Sopenharmony_ci u8 count; /* address space descriptors */ 818c2ecf20Sopenharmony_ci} __attribute__((packed)); 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* pcdp_device.flags */ 848c2ecf20Sopenharmony_ci#define PCDP_PRIMARY_CONSOLE 1 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistruct pcdp_device { 878c2ecf20Sopenharmony_ci u8 type; 888c2ecf20Sopenharmony_ci u8 flags; 898c2ecf20Sopenharmony_ci u16 length; 908c2ecf20Sopenharmony_ci u16 efi_index; 918c2ecf20Sopenharmony_ci /* next data is pcdp_if_pci or pcdp_if_acpi (not yet supported) */ 928c2ecf20Sopenharmony_ci /* next data is device specific type (currently only pcdp_vga) */ 938c2ecf20Sopenharmony_ci} __attribute__((packed)); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistruct pcdp { 968c2ecf20Sopenharmony_ci u8 signature[4]; 978c2ecf20Sopenharmony_ci u32 length; 988c2ecf20Sopenharmony_ci u8 rev; /* PCDP v2.0 is rev 3 */ 998c2ecf20Sopenharmony_ci u8 chksum; 1008c2ecf20Sopenharmony_ci u8 oemid[6]; 1018c2ecf20Sopenharmony_ci u8 oem_tabid[8]; 1028c2ecf20Sopenharmony_ci u32 oem_rev; 1038c2ecf20Sopenharmony_ci u8 creator_id[4]; 1048c2ecf20Sopenharmony_ci u32 creator_rev; 1058c2ecf20Sopenharmony_ci u32 num_uarts; 1068c2ecf20Sopenharmony_ci struct pcdp_uart uart[]; /* actual size is num_uarts */ 1078c2ecf20Sopenharmony_ci /* remainder of table is pcdp_device structures */ 1088c2ecf20Sopenharmony_ci} __attribute__((packed)); 109