xref: /freebsd/tools/tools/pirtool/pirtable.h (revision 4f52dfbb)
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 2002-2006 Bruce M. Simpson.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of Bruce M. Simpson nor the names of
16  *    contributors may be used to endorse or promote products derived
17  *    from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  * $FreeBSD$
32  */
33 
34 /*
35  * All fields and quantities in this file are in little-endian byte order,
36  * unless otherwise specified.
37  */
38 
39 #ifndef _PIRTABLE_H
40 #define _PIRTABLE_H
41 
42 #define PIR_BASE	0xF0000
43 #define PIR_SIZE	0x10000
44 #define PIR_OFFSET	16
45 
46 #define PIR_DEV(x)	(((x) & 0xF8) >> 3)
47 #define PIR_FUNC(x)	((x) & 0x7)
48 
49 typedef struct {
50 	uint8_t		bus;		/* bus number of this device */
51 	uint8_t		devfunc;	/* only upper 5 device bits valid */
52 	uint8_t		inta_link;	/* how INTA is linked */
53 	uint16_t	inta_irqs;	/* how INTA may be routed (bitset) */
54 	uint8_t		intb_link;
55 	uint16_t	intb_irqs;
56 	uint8_t		intc_link;
57 	uint16_t	intc_irqs;
58 	uint8_t		intd_link;
59 	uint16_t	intd_irqs;	/* how this pin may be routed */
60 	uint8_t		slot;		/* physical slot number on bus,
61 					 * slot 0 if motherboard */
62 	uint8_t		reserved00;	/* must be zero */
63 } __packed pir_entry_t;
64 
65 typedef struct {
66 	uint32_t	signature;	/* $PIR */
67 	uint8_t		minor;		/* minor version (0) */
68 	uint8_t		major;		/* major version (1) */
69 	uint16_t	size;		/* total size of table */
70 	uint8_t		bus;		/* Bus number of router */
71 	uint8_t		devfunc;	/* Dev/Func of router */
72 	uint16_t	excl_irqs;	/* PCI Exclusive IRQs */
73 	uint32_t	compatible;	/* Device/Vendor ID of a register
74 					 * compatible PCI IRQ router device */
75 	uint32_t	miniport_data;	/* Windows specific */
76 	uint8_t		reserved00[11]; /* Must be zero */
77 	uint8_t		checksum;	/* Inverse mod-256 sum of table bytes */
78 	pir_entry_t	entry[1];	/* 1..N device entries */
79 } __packed pir_table_t;
80 
81 #endif /* _PIRTABLE_H */
82