160727d8bSWarner Losh /*- 2f6a7723dSBenno Rice * Copyright (C) 2002 Benno Rice. 3f6a7723dSBenno Rice * All rights reserved. 4f6a7723dSBenno Rice * 5f6a7723dSBenno Rice * Redistribution and use in source and binary forms, with or without 6f6a7723dSBenno Rice * modification, are permitted provided that the following conditions 7f6a7723dSBenno Rice * are met: 8f6a7723dSBenno Rice * 1. Redistributions of source code must retain the above copyright 9f6a7723dSBenno Rice * notice, this list of conditions and the following disclaimer. 10f6a7723dSBenno Rice * 2. Redistributions in binary form must reproduce the above copyright 11f6a7723dSBenno Rice * notice, this list of conditions and the following disclaimer in the 12f6a7723dSBenno Rice * documentation and/or other materials provided with the distribution. 13f6a7723dSBenno Rice * 14f6a7723dSBenno Rice * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR 15f6a7723dSBenno Rice * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16f6a7723dSBenno Rice * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17f6a7723dSBenno Rice * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18f6a7723dSBenno Rice * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19f6a7723dSBenno Rice * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20f6a7723dSBenno Rice * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21f6a7723dSBenno Rice * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22f6a7723dSBenno Rice * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23f6a7723dSBenno Rice * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24f6a7723dSBenno Rice * 25f6a7723dSBenno Rice * $FreeBSD$ 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 32eaef5f0aSNathan Whitehorn #define MAX_PICS 5 33eaef5f0aSNathan Whitehorn 34eaef5f0aSNathan Whitehorn #define IGN_SHIFT 8 35eaef5f0aSNathan Whitehorn #define INTR_INTLINE(irq) (irq & ((1 << IGN_SHIFT) - 1)) 36eaef5f0aSNathan Whitehorn #define INTR_IGN(irq) (irq >> IGN_SHIFT) 37eaef5f0aSNathan Whitehorn 38755a660dSNathan Whitehorn #define INTR_VEC(pic_id, irq) ((powerpc_ign_lookup(pic_id) << IGN_SHIFT) | (irq)) 39f6a7723dSBenno Rice 40ca2c1931SNathan Whitehorn /* 41ca2c1931SNathan Whitehorn * Default base address for MSI messages on PowerPC 42ca2c1931SNathan Whitehorn */ 43ca2c1931SNathan Whitehorn #define MSI_INTEL_ADDR_BASE 0xfee00000 44ca2c1931SNathan Whitehorn 45eaef5f0aSNathan Whitehorn extern device_t root_pic; 46f6a7723dSBenno Rice 4777d40ffdSMarcel Moolenaar struct trapframe; 48f6a7723dSBenno Rice 4905c62b81SMarcel Moolenaar driver_filter_t powerpc_ipi_handler; 5005c62b81SMarcel Moolenaar 5105c62b81SMarcel Moolenaar void powerpc_register_pic(device_t, u_int); 52eaef5f0aSNathan Whitehorn int powerpc_ign_lookup(uint32_t pic_id); 534f5d8660SMarcel Moolenaar 5477d40ffdSMarcel Moolenaar void powerpc_dispatch_intr(u_int, struct trapframe *); 5577d40ffdSMarcel Moolenaar int powerpc_enable_intr(void); 56eaef5f0aSNathan Whitehorn int powerpc_setup_intr(const char *, u_int, driver_filter_t, driver_intr_t, 57eaef5f0aSNathan Whitehorn void *, enum intr_type, void **); 5877d40ffdSMarcel Moolenaar int powerpc_teardown_intr(void *); 59*08393b3eSNathan Whitehorn int powerpc_bind_intr(u_int irq, u_char cpu); 60d6f59297SMarcel Moolenaar int powerpc_config_intr(int, enum intr_trigger, enum intr_polarity); 61f6a7723dSBenno Rice 62f6a7723dSBenno Rice #endif /* _MACHINE_INTR_MACHDEP_H_ */ 63