170025d76Sjohnny /*
270025d76Sjohnny  * CDDL HEADER START
370025d76Sjohnny  *
470025d76Sjohnny  * The contents of this file are subject to the terms of the
526947304SEvan Yan  * Common Development and Distribution License (the "License").
626947304SEvan Yan  * You may not use this file except in compliance with the License.
770025d76Sjohnny  *
870025d76Sjohnny  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
970025d76Sjohnny  * or http://www.opensolaris.org/os/licensing.
1070025d76Sjohnny  * See the License for the specific language governing permissions
1170025d76Sjohnny  * and limitations under the License.
1270025d76Sjohnny  *
1370025d76Sjohnny  * When distributing Covered Code, include this CDDL HEADER in each
1470025d76Sjohnny  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1570025d76Sjohnny  * If applicable, add the following below this CDDL HEADER, with the
1670025d76Sjohnny  * fields enclosed by brackets "[]" replaced with your own identifying
1770025d76Sjohnny  * information: Portions Copyright [yyyy] [name of copyright owner]
1870025d76Sjohnny  *
1970025d76Sjohnny  * CDDL HEADER END
2070025d76Sjohnny  */
2170025d76Sjohnny /*
2226947304SEvan Yan  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
2370025d76Sjohnny  * Use is subject to license terms.
24*ead3c390SKeith M Wesolowski  * Copyright 2024 Oxide Computer Co.
2570025d76Sjohnny  */
2670025d76Sjohnny 
2770025d76Sjohnny #ifndef	_SYS_HOTPLUG_PCI_PCIEHPC_H
2870025d76Sjohnny #define	_SYS_HOTPLUG_PCI_PCIEHPC_H
2970025d76Sjohnny 
30*ead3c390SKeith M Wesolowski #ifdef _KERNEL
31*ead3c390SKeith M Wesolowski #include <sys/ddi_hp.h>
32*ead3c390SKeith M Wesolowski #include <sys/pcie_impl.h>
33*ead3c390SKeith M Wesolowski #include <sys/stdbool.h>
34*ead3c390SKeith M Wesolowski #include <sys/hotplug/pci/pcie_hp.h>
35*ead3c390SKeith M Wesolowski #endif /* _KERNEL */
36*ead3c390SKeith M Wesolowski 
3770025d76Sjohnny #ifdef	__cplusplus
3870025d76Sjohnny extern "C" {
3970025d76Sjohnny #endif
4070025d76Sjohnny 
41*ead3c390SKeith M Wesolowski #ifdef	_KERNEL
42*ead3c390SKeith M Wesolowski 
4370025d76Sjohnny /*
4470025d76Sjohnny  * Interfaces exported by PCI-E nexus Hot Plug Controller extension module
4570025d76Sjohnny  */
4626947304SEvan Yan int pciehpc_init(dev_info_t *dip, caddr_t arg);
4726947304SEvan Yan int pciehpc_uninit(dev_info_t *dip);
4826947304SEvan Yan int pciehpc_intr(dev_info_t *dip);
4926947304SEvan Yan int pciehpc_hp_ops(dev_info_t *dip, char *cn_name, ddi_hp_op_t op, void *arg,
5026947304SEvan Yan     void *result);
5126947304SEvan Yan void pciehpc_get_slot_state(pcie_hp_slot_t *slot_p);
5226947304SEvan Yan void pciehpc_set_slot_name(pcie_hp_ctrl_t *ctrl_p);
5326947304SEvan Yan uint8_t pciehpc_reg_get8(pcie_hp_ctrl_t *ctrl_p, uint_t off);
5426947304SEvan Yan uint16_t pciehpc_reg_get16(pcie_hp_ctrl_t *ctrl_p, uint_t off);
5526947304SEvan Yan uint32_t pciehpc_reg_get32(pcie_hp_ctrl_t *ctrl_p, uint_t off);
5626947304SEvan Yan void pciehpc_reg_put8(pcie_hp_ctrl_t *ctrl_p, uint_t off, uint8_t val);
5726947304SEvan Yan void pciehpc_reg_put16(pcie_hp_ctrl_t *ctrl_p, uint_t off, uint16_t val);
5826947304SEvan Yan void pciehpc_reg_put32(pcie_hp_ctrl_t *ctrl_p, uint_t off, uint32_t val);
59a9413143SRobert Mustacchi void pciehpc_led_init(pcie_hp_slot_t *slot_p);
60*ead3c390SKeith M Wesolowski extern bool pciehpc_slot_kstat_init(pcie_hp_slot_t *);
61*ead3c390SKeith M Wesolowski extern void pciehpc_slot_kstat_fini(pcie_hp_slot_t *);
6226947304SEvan Yan #if	defined(__i386) || defined(__amd64)
6326947304SEvan Yan extern void pciehpc_update_ops(pcie_hp_ctrl_t *ctrl_p);
6426947304SEvan Yan #endif	/* defined(__i386) || defined(__amd64) */
6570025d76Sjohnny 
66*ead3c390SKeith M Wesolowski #endif	/* _KERNEL */
67*ead3c390SKeith M Wesolowski 
6870025d76Sjohnny #ifdef	__cplusplus
6970025d76Sjohnny }
7070025d76Sjohnny #endif
7170025d76Sjohnny 
7270025d76Sjohnny #endif	/* _SYS_HOTPLUG_PCI_PCIEHPC_H */
73