xref: /openbmc/linux/drivers/firmware/pcdp.h (revision 66b7f8a3)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Definitions for PCDP-defined console devices
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * v1.0a: http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf
5280dedb8SBjorn Helgaas  * v2.0:  http://www.dig64.org/specifications/DIG64_PCDPv20.pdf
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * (c) Copyright 2002, 2004 Hewlett-Packard Development Company, L.P.
81da177e4SLinus Torvalds  *	Khalid Aziz <khalid.aziz@hp.com>
91da177e4SLinus Torvalds  *	Bjorn Helgaas <bjorn.helgaas@hp.com>
101da177e4SLinus Torvalds  *
111da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify
121da177e4SLinus Torvalds  * it under the terms of the GNU General Public License version 2 as
131da177e4SLinus Torvalds  * published by the Free Software Foundation.
141da177e4SLinus Torvalds  */
151da177e4SLinus Torvalds 
161da177e4SLinus Torvalds #define PCDP_CONSOLE			0
171da177e4SLinus Torvalds #define PCDP_DEBUG			1
181da177e4SLinus Torvalds #define PCDP_CONSOLE_OUTPUT		2
191da177e4SLinus Torvalds #define PCDP_CONSOLE_INPUT		3
201da177e4SLinus Torvalds 
211da177e4SLinus Torvalds #define PCDP_UART			(0 << 3)
221da177e4SLinus Torvalds #define PCDP_VGA			(1 << 3)
231da177e4SLinus Torvalds #define PCDP_USB			(2 << 3)
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds /* pcdp_uart.type and pcdp_device.type */
261da177e4SLinus Torvalds #define PCDP_CONSOLE_UART		(PCDP_UART | PCDP_CONSOLE)
271da177e4SLinus Torvalds #define PCDP_DEBUG_UART			(PCDP_UART | PCDP_DEBUG)
281da177e4SLinus Torvalds #define PCDP_CONSOLE_VGA		(PCDP_VGA  | PCDP_CONSOLE_OUTPUT)
291da177e4SLinus Torvalds #define PCDP_CONSOLE_USB		(PCDP_USB  | PCDP_CONSOLE_INPUT)
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds /* pcdp_uart.flags */
321da177e4SLinus Torvalds #define PCDP_UART_EDGE_SENSITIVE	(1 << 0)
331da177e4SLinus Torvalds #define PCDP_UART_ACTIVE_LOW		(1 << 1)
341da177e4SLinus Torvalds #define PCDP_UART_PRIMARY_CONSOLE	(1 << 2)
351da177e4SLinus Torvalds #define PCDP_UART_IRQ			(1 << 6) /* in pci_func for rev < 3 */
361da177e4SLinus Torvalds #define PCDP_UART_PCI			(1 << 7) /* in pci_func for rev < 3 */
371da177e4SLinus Torvalds 
381da177e4SLinus Torvalds struct pcdp_uart {
391da177e4SLinus Torvalds 	u8				type;
401da177e4SLinus Torvalds 	u8				bits;
411da177e4SLinus Torvalds 	u8				parity;
421da177e4SLinus Torvalds 	u8				stop_bits;
431da177e4SLinus Torvalds 	u8				pci_seg;
441da177e4SLinus Torvalds 	u8				pci_bus;
451da177e4SLinus Torvalds 	u8				pci_dev;
461da177e4SLinus Torvalds 	u8				pci_func;
471da177e4SLinus Torvalds 	u64				baud;
481da177e4SLinus Torvalds 	struct acpi_generic_address	addr;
491da177e4SLinus Torvalds 	u16				pci_dev_id;
501da177e4SLinus Torvalds 	u16				pci_vendor_id;
511da177e4SLinus Torvalds 	u32				gsi;
521da177e4SLinus Torvalds 	u32				clock_rate;
531da177e4SLinus Torvalds 	u8				pci_prog_intfc;
541da177e4SLinus Torvalds 	u8				flags;
5566b7f8a3SMark Maule } __attribute__((packed));
5666b7f8a3SMark Maule 
5766b7f8a3SMark Maule #define PCDP_IF_PCI	1
5866b7f8a3SMark Maule 
5966b7f8a3SMark Maule /* pcdp_if_pci.trans */
6066b7f8a3SMark Maule #define PCDP_PCI_TRANS_IOPORT	0x02
6166b7f8a3SMark Maule #define PCDP_PCI_TRANS_MMIO	0x01
6266b7f8a3SMark Maule 
6366b7f8a3SMark Maule struct pcdp_if_pci {
6466b7f8a3SMark Maule 	u8			interconnect;
6566b7f8a3SMark Maule 	u8			reserved;
6666b7f8a3SMark Maule 	u16			length;
6766b7f8a3SMark Maule 	u8			segment;
6866b7f8a3SMark Maule 	u8			bus;
6966b7f8a3SMark Maule 	u8			dev;
7066b7f8a3SMark Maule 	u8			fun;
7166b7f8a3SMark Maule 	u16			dev_id;
7266b7f8a3SMark Maule 	u16			vendor_id;
7366b7f8a3SMark Maule 	u32			acpi_interrupt;
7466b7f8a3SMark Maule 	u64			mmio_tra;
7566b7f8a3SMark Maule 	u64			ioport_tra;
7666b7f8a3SMark Maule 	u8			flags;
7766b7f8a3SMark Maule 	u8			trans;
7866b7f8a3SMark Maule } __attribute__((packed));
791da177e4SLinus Torvalds 
801da177e4SLinus Torvalds struct pcdp_vga {
811da177e4SLinus Torvalds 	u8			count;		/* address space descriptors */
8266b7f8a3SMark Maule } __attribute__((packed));
831da177e4SLinus Torvalds 
841da177e4SLinus Torvalds /* pcdp_device.flags */
851da177e4SLinus Torvalds #define PCDP_PRIMARY_CONSOLE	1
861da177e4SLinus Torvalds 
871da177e4SLinus Torvalds struct pcdp_device {
881da177e4SLinus Torvalds 	u8			type;
891da177e4SLinus Torvalds 	u8			flags;
901da177e4SLinus Torvalds 	u16			length;
911da177e4SLinus Torvalds 	u16			efi_index;
9266b7f8a3SMark Maule 	/* next data is pcdp_if_pci or pcdp_if_acpi (not yet supported) */
9366b7f8a3SMark Maule 	/* next data is device specific type (currently only pcdp_vga) */
9466b7f8a3SMark Maule } __attribute__((packed));
951da177e4SLinus Torvalds 
961da177e4SLinus Torvalds struct pcdp {
971da177e4SLinus Torvalds 	u8			signature[4];
981da177e4SLinus Torvalds 	u32			length;
991da177e4SLinus Torvalds 	u8			rev;		/* PCDP v2.0 is rev 3 */
1001da177e4SLinus Torvalds 	u8			chksum;
1011da177e4SLinus Torvalds 	u8			oemid[6];
1021da177e4SLinus Torvalds 	u8			oem_tabid[8];
1031da177e4SLinus Torvalds 	u32			oem_rev;
1041da177e4SLinus Torvalds 	u8			creator_id[4];
1051da177e4SLinus Torvalds 	u32			creator_rev;
1061da177e4SLinus Torvalds 	u32			num_uarts;
1071da177e4SLinus Torvalds 	struct pcdp_uart	uart[0];	/* actual size is num_uarts */
1081da177e4SLinus Torvalds 	/* remainder of table is pcdp_device structures */
10966b7f8a3SMark Maule } __attribute__((packed));
110