1 /* $NetBSD: dig64.h,v 1.1 2006/04/07 14:21:18 cherry Exp $ */
4 * Copyright (c) 2002 Marcel Moolenaar
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef _MACHINE_DIG64_H_
32 #define _MACHINE_DIG64_H_
35 * This header file written refer to 'DIG64 Desriptions for Primary Console &
36 * Debug Port Devices'.
39 /* ACPI GAS (Generic Address Structure) */
46 * XXX using a 64-bit type for the address would cause padding and
47 * using __packed would cause unaligned accesses...
53 struct dig64_hcdp_entry
{
55 #define DIG64_HCDP_CONSOLE DIG64_ENTRYTYPE_TYPE0
56 #define DIG64_HCDP_DBGPORT DIG64_ENTRYTYPE_TYPE1
59 #define DIG64_HCDP_PARITY_NO 1
60 #define DIG64_HCDP_PARITY_EVEN 2
61 #define DIG64_HCDP_PARITY_ODD 3
62 #define DIG64_HCDP_PARITY_MARK 4
63 #define DIG64_HCDP_PARITY_SPACE 5
65 #define DIG64_HCDP_STOPBITS_1 1
66 #define DIG64_HCDP_STOPBITS_15 2
67 #define DIG64_HCDP_STOPBITS_2 3
71 uint8_t _reserved1_
:3;
72 uint8_t pci_function
:3;
73 uint8_t _reserved2_
:3;
77 * XXX using a 64-bit type for the baudrate would cause padding and
78 * using __packed would cause unaligned accesses...
82 struct dig64_gas address
;
87 uint8_t pci_interface
;
88 uint8_t _reserved3_
[7];
92 /* Device Specific Structures */
94 struct dig64_vga_spec
{
95 uint8_t num
; /*Number of Extended Address Space Descriptors*/
102 /* Interconnect Specific Structure */
104 #define DIG64_FLAGS_INTR_LEVEL (0 << 0) /* Level Triggered */
105 #define DIG64_FLAGS_INTR_EDGE (1 << 0) /* Edge Triggered */
106 #define DIG64_FLAGS_INTR_ACTH (0 << 1) /* Intr Active High */
107 #define DIG64_FLAGS_INTR_ACTL (1 << 1) /* Intr Active Low */
108 #define DIG64_FLAGS_TRANS_DENSE (0 << 3) /* Dense Transration */
109 #define DIG64_FLAGS_TRANS_SPARSE (1 << 3) /* Sparse Transration */
110 #define DIG64_FLAGS_TYPE_STATIC (0 << 4) /* Type Static */
111 #define DIG64_FLAGS_TYPE_TRANS (1 << 4) /* Type Translation */
112 #define DIG64_FLAGS_INTR_SUPP (1 << 6) /* Intrrupt supported */
113 #define DIG64_FLAGS_MMIO_TRA_VALID (1 << 8)
114 #define DIG64_FLAGS_IOPORT_TRA_VALID (1 << 9)
116 struct dig64_acpi_spec
{
117 uint8_t type
; /* = 0 indicating ACPI */
118 uint8_t resv
; /* must be 0 */
119 uint16_t length
; /* of the ACPI Specific Structure */
122 uint32_t acpi_gsi
; /* ACPI Global System Interrupt */
128 struct dig64_pci_spec
{
129 uint8_t type
; /* = 1 indicating PCI */
130 uint8_t resv
; /* must be 0 */
131 uint16_t length
; /* of the PCI Specific Structure */
132 uint8_t sgn
; /* PCI Segment Group Number */
133 uint8_t bus
; /* PCI Bus Number */
134 uint8_t device
; /* PCI Device Number */
135 uint8_t function
; /* PCI Function Number */
138 uint32_t acpi_gsi
; /* ACPI Global System Interrupt */
145 struct dig64_pcdp_entry
{
148 uint16_t length
; /* in bytes */
150 #define DIG64_PCDP_CONOUTDEV 0
151 #define DIG64_PCDP_NOT_VALID 1
152 #define DIG64_PCDP_CONOUTDEV2 2
153 #define DIG64_PCDP_CONINDEV 3
157 * Interconnect Specific Structure,
158 * and Device Specific Structure(s)
161 #define DIG64_PCDP_SPEC_ACPI 0
162 struct dig64_acpi_spec acpi
;
163 #define DIG64_PCDP_SPEC_PCI 1
164 struct dig64_pci_spec pci
;
168 struct dig64_hcdp_table
{
170 #define HCDP_SIGNATURE "HCDP"
172 uint8_t revision
; /* It is PCDP, if '3' or greater. */
178 uint32_t creator_rev
;
179 uint32_t entries
; /* Number of Type0 and Type1 Entries. */
180 union dev_desc
{ /* Device Descriptor */
182 #define DIG64_ENTRYTYPE_TYPE0 0 /* (UART | Bidirect) */
183 #define DIG64_ENTRYTYPE_TYPE1 1 /* (UART | Debug Port) */
184 #define DIG64_ENTRYTYPE_BIDIRECT (0<<0) /* bidirectional console */
185 #define DIG64_ENTRYTYPE_DEBUGPORT (1<<0) /* debug port */
186 #define DIG64_ENTRYTYPE_OUTONLY (2<<0) /* console output-only */
187 #define DIG64_ENTRYTYPE_INONLY (3<<0) /* console input-only */
188 #define DIG64_ENTRYTYPE_UART (0<<3)
189 #define DIG64_ENTRYTYPE_VGA (1<<3)
190 #define DIG64_ENTRYTYPE_VENDOR (1<<7) /* Vendor specific */
191 struct dig64_hcdp_entry uart
;
192 struct dig64_pcdp_entry pcdp
;