xref: /freebsd/sys/powerpc/include/intr_machdep.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
160727d8bSWarner Losh /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
371e3c308SPedro F. Giffuni  *
4f6a7723dSBenno Rice  * Copyright (C) 2002 Benno Rice.
5f6a7723dSBenno Rice  * All rights reserved.
6f6a7723dSBenno Rice  *
7f6a7723dSBenno Rice  * Redistribution and use in source and binary forms, with or without
8f6a7723dSBenno Rice  * modification, are permitted provided that the following conditions
9f6a7723dSBenno Rice  * are met:
10f6a7723dSBenno Rice  * 1. Redistributions of source code must retain the above copyright
11f6a7723dSBenno Rice  *    notice, this list of conditions and the following disclaimer.
12f6a7723dSBenno Rice  * 2. Redistributions in binary form must reproduce the above copyright
13f6a7723dSBenno Rice  *    notice, this list of conditions and the following disclaimer in the
14f6a7723dSBenno Rice  *    documentation and/or other materials provided with the distribution.
15f6a7723dSBenno Rice  *
16f6a7723dSBenno Rice  * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
17f6a7723dSBenno Rice  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18f6a7723dSBenno Rice  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19f6a7723dSBenno Rice  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20f6a7723dSBenno Rice  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21f6a7723dSBenno Rice  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22f6a7723dSBenno Rice  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23f6a7723dSBenno Rice  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24f6a7723dSBenno Rice  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25f6a7723dSBenno Rice  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26f6a7723dSBenno Rice  */
27f6a7723dSBenno Rice 
28f6a7723dSBenno Rice #ifndef	_MACHINE_INTR_MACHDEP_H_
29f6a7723dSBenno Rice #define	_MACHINE_INTR_MACHDEP_H_
30f6a7723dSBenno Rice 
3177d40ffdSMarcel Moolenaar #define	INTR_VECTORS	256
326d2d7b8cSMarcel Moolenaar 
3310b980e7SWojciech Macek #define	MAX_PICS		32
34607ebaafSMarcel Moolenaar #define	MAP_IRQ(node, pin)	powerpc_get_irq(node, pin)
35f6a7723dSBenno Rice 
36ca2c1931SNathan Whitehorn /*
37ca2c1931SNathan Whitehorn  * Default base address for MSI messages on PowerPC
38ca2c1931SNathan Whitehorn  */
39ca2c1931SNathan Whitehorn #define	MSI_INTEL_ADDR_BASE		0xfee00000
40ca2c1931SNathan Whitehorn 
41eaef5f0aSNathan Whitehorn extern device_t root_pic;
42f6a7723dSBenno Rice 
4377d40ffdSMarcel Moolenaar struct trapframe;
44f6a7723dSBenno Rice 
4505c62b81SMarcel Moolenaar driver_filter_t powerpc_ipi_handler;
4605c62b81SMarcel Moolenaar 
47707c2fb9SAlexander Motin void	intrcnt_add(const char *name, u_long **countp);
48707c2fb9SAlexander Motin 
49e5497948SNathan Whitehorn u_int	powerpc_register_pic(device_t, uint32_t, u_int, u_int, u_int);
506d2d7b8cSMarcel Moolenaar u_int	powerpc_get_irq(uint32_t, u_int);
514f5d8660SMarcel Moolenaar 
5277d40ffdSMarcel Moolenaar void	powerpc_dispatch_intr(u_int, struct trapframe *);
5377d40ffdSMarcel Moolenaar int	powerpc_enable_intr(void);
54eaef5f0aSNathan Whitehorn int	powerpc_setup_intr(const char *, u_int, driver_filter_t, driver_intr_t,
5549d9a597SJustin Hibbits 	    void *, enum intr_type, void **, int);
5677d40ffdSMarcel Moolenaar int	powerpc_teardown_intr(void *);
5708393b3eSNathan Whitehorn int	powerpc_bind_intr(u_int irq, u_char cpu);
58d6f59297SMarcel Moolenaar int	powerpc_config_intr(int, enum intr_trigger, enum intr_polarity);
5954423402SNathan Whitehorn int	powerpc_fw_config_intr(int irq, int sense_code);
60f6a7723dSBenno Rice 
610aeed3e9SJustin Hibbits void	powerpc_intr_mask(u_int irq);
620aeed3e9SJustin Hibbits void	powerpc_intr_unmask(u_int irq);
630aeed3e9SJustin Hibbits 
64f6a7723dSBenno Rice #endif /* _MACHINE_INTR_MACHDEP_H_ */
65