xref: /netbsd-src/sys/arch/arm/acpi/acpi_pci_machdep.h (revision 12a41c4dcffaa7a86e16da1edfdf2f5a3196bec2)
1*12a41c4dSjmcneill /* $NetBSD: acpi_pci_machdep.h,v 1.8 2021/08/07 21:27:53 jmcneill Exp $ */
2e2ed649eSjmcneill 
3e2ed649eSjmcneill /*-
4e2ed649eSjmcneill  * Copyright (c) 2018 The NetBSD Foundation, Inc.
5e2ed649eSjmcneill  * All rights reserved.
6e2ed649eSjmcneill  *
7e2ed649eSjmcneill  * This code is derived from software contributed to The NetBSD Foundation
8e2ed649eSjmcneill  * by Jared McNeill <jmcneill@invisible.ca>.
9e2ed649eSjmcneill  *
10e2ed649eSjmcneill  * Redistribution and use in source and binary forms, with or without
11e2ed649eSjmcneill  * modification, are permitted provided that the following conditions
12e2ed649eSjmcneill  * are met:
13e2ed649eSjmcneill  * 1. Redistributions of source code must retain the above copyright
14e2ed649eSjmcneill  *    notice, this list of conditions and the following disclaimer.
15e2ed649eSjmcneill  * 2. Redistributions in binary form must reproduce the above copyright
16e2ed649eSjmcneill  *    notice, this list of conditions and the following disclaimer in the
17e2ed649eSjmcneill  *    documentation and/or other materials provided with the distribution.
18e2ed649eSjmcneill  *
19e2ed649eSjmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20e2ed649eSjmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21e2ed649eSjmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22e2ed649eSjmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23e2ed649eSjmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24e2ed649eSjmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25e2ed649eSjmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26e2ed649eSjmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27e2ed649eSjmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28e2ed649eSjmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29e2ed649eSjmcneill  * POSSIBILITY OF SUCH DAMAGE.
30e2ed649eSjmcneill  */
31e2ed649eSjmcneill 
32e2ed649eSjmcneill #ifndef _ARM_ACPI_PCI_MACHDEP_H
33e2ed649eSjmcneill #define _ARM_ACPI_PCI_MACHDEP_H
34e2ed649eSjmcneill 
35e2ed649eSjmcneill extern struct arm32_pci_chipset arm_acpi_pci_chipset;
36e2ed649eSjmcneill 
374fb00351Sjmcneill struct acpi_pci_context {
384fb00351Sjmcneill 	struct arm32_pci_chipset ap_pc;
394d90935bSjmcneill 	device_t ap_dev;
404fb00351Sjmcneill 	u_int ap_seg;
414d90935bSjmcneill 	int ap_bus;
42*12a41c4dSjmcneill 	int ap_maxbus;
434d90935bSjmcneill 	bus_space_tag_t ap_bst;
444d90935bSjmcneill 	bus_space_handle_t ap_conf_bsh;
454d90935bSjmcneill 	int (*ap_conf_read)(pci_chipset_tag_t, pcitag_t, int, pcireg_t *);
464d90935bSjmcneill 	int (*ap_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
471583ac80Sjmcneill 	void *ap_conf_priv;
486f25f864Sjmcneill 	int ap_pciflags_clear;
49*12a41c4dSjmcneill 	u_int ap_flags;
50*12a41c4dSjmcneill #define	ACPI_PCI_FLAG_NO_MCFG		__BIT(0)	/* ignore MCFG table */
514fb00351Sjmcneill };
524fb00351Sjmcneill 
536f25f864Sjmcneill struct acpi_pci_quirk {
546f25f864Sjmcneill 	const char			q_oemid[ACPI_OEM_ID_SIZE+1];
556f25f864Sjmcneill 	const char			q_oemtableid[ACPI_OEM_TABLE_ID_SIZE+1];
566f25f864Sjmcneill 	uint32_t			q_oemrevision;
576f25f864Sjmcneill 	int				q_segment;
586f25f864Sjmcneill 	void				(*q_init)(struct acpi_pci_context *);
596f25f864Sjmcneill };
606f25f864Sjmcneill 
616f25f864Sjmcneill const struct acpi_pci_quirk *	acpi_pci_md_find_quirk(int);
626f25f864Sjmcneill 
63*12a41c4dSjmcneill void	acpi_pci_smccc_init(struct acpi_pci_context *);
646f25f864Sjmcneill void	acpi_pci_graviton_init(struct acpi_pci_context *);
651583ac80Sjmcneill void	acpi_pci_layerscape_gen4_init(struct acpi_pci_context *);
666f25f864Sjmcneill void	acpi_pci_n1sdp_init(struct acpi_pci_context *);
676f25f864Sjmcneill 
68e2ed649eSjmcneill #endif /* !_ARM_ACPI_PCI_MACHDEP_H */
69