xref: /openbmc/linux/drivers/firmware/pcdp.h (revision 1da177e4)
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
51da177e4SLinus Torvalds  * v2.0:  http://www.dig64.org/specifications/DIG64_HCDPv20_042804.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;
551da177e4SLinus Torvalds };
561da177e4SLinus Torvalds 
571da177e4SLinus Torvalds struct pcdp_vga {
581da177e4SLinus Torvalds 	u8			count;		/* address space descriptors */
591da177e4SLinus Torvalds };
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds /* pcdp_device.flags */
621da177e4SLinus Torvalds #define PCDP_PRIMARY_CONSOLE	1
631da177e4SLinus Torvalds 
641da177e4SLinus Torvalds struct pcdp_device {
651da177e4SLinus Torvalds 	u8			type;
661da177e4SLinus Torvalds 	u8			flags;
671da177e4SLinus Torvalds 	u16			length;
681da177e4SLinus Torvalds 	u16			efi_index;
691da177e4SLinus Torvalds };
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds struct pcdp {
721da177e4SLinus Torvalds 	u8			signature[4];
731da177e4SLinus Torvalds 	u32			length;
741da177e4SLinus Torvalds 	u8			rev;		/* PCDP v2.0 is rev 3 */
751da177e4SLinus Torvalds 	u8			chksum;
761da177e4SLinus Torvalds 	u8			oemid[6];
771da177e4SLinus Torvalds 	u8			oem_tabid[8];
781da177e4SLinus Torvalds 	u32			oem_rev;
791da177e4SLinus Torvalds 	u8			creator_id[4];
801da177e4SLinus Torvalds 	u32			creator_rev;
811da177e4SLinus Torvalds 	u32			num_uarts;
821da177e4SLinus Torvalds 	struct pcdp_uart	uart[0];	/* actual size is num_uarts */
831da177e4SLinus Torvalds 	/* remainder of table is pcdp_device structures */
841da177e4SLinus Torvalds };
85