1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * Definitions for PCDP-defined console devices 41da177e4SLinus Torvalds * 5631dd1a8SJustin P. Mattock * For DIG64_HCDPv10a_01.pdf and DIG64_PCDPv20.pdf (v1.0a and v2.0 resp.), 6631dd1a8SJustin P. Mattock * please see <http://www.dig64.org/specifications/> 71da177e4SLinus Torvalds * 81da177e4SLinus Torvalds * (c) Copyright 2002, 2004 Hewlett-Packard Development Company, L.P. 91da177e4SLinus Torvalds * Khalid Aziz <khalid.aziz@hp.com> 101da177e4SLinus Torvalds * Bjorn Helgaas <bjorn.helgaas@hp.com> 111da177e4SLinus Torvalds */ 121da177e4SLinus Torvalds 131da177e4SLinus Torvalds #define PCDP_CONSOLE 0 141da177e4SLinus Torvalds #define PCDP_DEBUG 1 151da177e4SLinus Torvalds #define PCDP_CONSOLE_OUTPUT 2 161da177e4SLinus Torvalds #define PCDP_CONSOLE_INPUT 3 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds #define PCDP_UART (0 << 3) 191da177e4SLinus Torvalds #define PCDP_VGA (1 << 3) 201da177e4SLinus Torvalds #define PCDP_USB (2 << 3) 211da177e4SLinus Torvalds 221da177e4SLinus Torvalds /* pcdp_uart.type and pcdp_device.type */ 231da177e4SLinus Torvalds #define PCDP_CONSOLE_UART (PCDP_UART | PCDP_CONSOLE) 241da177e4SLinus Torvalds #define PCDP_DEBUG_UART (PCDP_UART | PCDP_DEBUG) 251da177e4SLinus Torvalds #define PCDP_CONSOLE_VGA (PCDP_VGA | PCDP_CONSOLE_OUTPUT) 261da177e4SLinus Torvalds #define PCDP_CONSOLE_USB (PCDP_USB | PCDP_CONSOLE_INPUT) 271da177e4SLinus Torvalds 281da177e4SLinus Torvalds /* pcdp_uart.flags */ 291da177e4SLinus Torvalds #define PCDP_UART_EDGE_SENSITIVE (1 << 0) 301da177e4SLinus Torvalds #define PCDP_UART_ACTIVE_LOW (1 << 1) 311da177e4SLinus Torvalds #define PCDP_UART_PRIMARY_CONSOLE (1 << 2) 321da177e4SLinus Torvalds #define PCDP_UART_IRQ (1 << 6) /* in pci_func for rev < 3 */ 331da177e4SLinus Torvalds #define PCDP_UART_PCI (1 << 7) /* in pci_func for rev < 3 */ 341da177e4SLinus Torvalds 351da177e4SLinus Torvalds struct pcdp_uart { 361da177e4SLinus Torvalds u8 type; 371da177e4SLinus Torvalds u8 bits; 381da177e4SLinus Torvalds u8 parity; 391da177e4SLinus Torvalds u8 stop_bits; 401da177e4SLinus Torvalds u8 pci_seg; 411da177e4SLinus Torvalds u8 pci_bus; 421da177e4SLinus Torvalds u8 pci_dev; 431da177e4SLinus Torvalds u8 pci_func; 441da177e4SLinus Torvalds u64 baud; 451da177e4SLinus Torvalds struct acpi_generic_address addr; 461da177e4SLinus Torvalds u16 pci_dev_id; 471da177e4SLinus Torvalds u16 pci_vendor_id; 481da177e4SLinus Torvalds u32 gsi; 491da177e4SLinus Torvalds u32 clock_rate; 501da177e4SLinus Torvalds u8 pci_prog_intfc; 511da177e4SLinus Torvalds u8 flags; 52f62c4a96SDavid Mosberger-Tang u16 conout_index; 53f62c4a96SDavid Mosberger-Tang u32 reserved; 5466b7f8a3SMark Maule } __attribute__((packed)); 5566b7f8a3SMark Maule 5666b7f8a3SMark Maule #define PCDP_IF_PCI 1 5766b7f8a3SMark Maule 5866b7f8a3SMark Maule /* pcdp_if_pci.trans */ 5966b7f8a3SMark Maule #define PCDP_PCI_TRANS_IOPORT 0x02 6066b7f8a3SMark Maule #define PCDP_PCI_TRANS_MMIO 0x01 6166b7f8a3SMark Maule 6266b7f8a3SMark Maule struct pcdp_if_pci { 6366b7f8a3SMark Maule u8 interconnect; 6466b7f8a3SMark Maule u8 reserved; 6566b7f8a3SMark Maule u16 length; 6666b7f8a3SMark Maule u8 segment; 6766b7f8a3SMark Maule u8 bus; 6866b7f8a3SMark Maule u8 dev; 6966b7f8a3SMark Maule u8 fun; 7066b7f8a3SMark Maule u16 dev_id; 7166b7f8a3SMark Maule u16 vendor_id; 7266b7f8a3SMark Maule u32 acpi_interrupt; 7366b7f8a3SMark Maule u64 mmio_tra; 7466b7f8a3SMark Maule u64 ioport_tra; 7566b7f8a3SMark Maule u8 flags; 7666b7f8a3SMark Maule u8 trans; 7766b7f8a3SMark Maule } __attribute__((packed)); 781da177e4SLinus Torvalds 791da177e4SLinus Torvalds struct pcdp_vga { 801da177e4SLinus Torvalds u8 count; /* address space descriptors */ 8166b7f8a3SMark Maule } __attribute__((packed)); 821da177e4SLinus Torvalds 831da177e4SLinus Torvalds /* pcdp_device.flags */ 841da177e4SLinus Torvalds #define PCDP_PRIMARY_CONSOLE 1 851da177e4SLinus Torvalds 861da177e4SLinus Torvalds struct pcdp_device { 871da177e4SLinus Torvalds u8 type; 881da177e4SLinus Torvalds u8 flags; 891da177e4SLinus Torvalds u16 length; 901da177e4SLinus Torvalds u16 efi_index; 9166b7f8a3SMark Maule /* next data is pcdp_if_pci or pcdp_if_acpi (not yet supported) */ 9266b7f8a3SMark Maule /* next data is device specific type (currently only pcdp_vga) */ 9366b7f8a3SMark Maule } __attribute__((packed)); 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds struct pcdp { 961da177e4SLinus Torvalds u8 signature[4]; 971da177e4SLinus Torvalds u32 length; 981da177e4SLinus Torvalds u8 rev; /* PCDP v2.0 is rev 3 */ 991da177e4SLinus Torvalds u8 chksum; 1001da177e4SLinus Torvalds u8 oemid[6]; 1011da177e4SLinus Torvalds u8 oem_tabid[8]; 1021da177e4SLinus Torvalds u32 oem_rev; 1031da177e4SLinus Torvalds u8 creator_id[4]; 1041da177e4SLinus Torvalds u32 creator_rev; 1051da177e4SLinus Torvalds u32 num_uarts; 1061da177e4SLinus Torvalds struct pcdp_uart uart[0]; /* actual size is num_uarts */ 1071da177e4SLinus Torvalds /* remainder of table is pcdp_device structures */ 10866b7f8a3SMark Maule } __attribute__((packed)); 109