11.14Sryo/* $NetBSD: intr.h,v 1.14 2021/11/02 11:26:04 ryo Exp $ */ 21.5Such 31.5Such/*- 41.5Such * Copyright (c) 2002 The NetBSD Foundation, Inc. 51.5Such * All rights reserved. 61.5Such * 71.5Such * Redistribution and use in source and binary forms, with or without 81.5Such * modification, are permitted provided that the following conditions 91.5Such * are met: 101.5Such * 1. Redistributions of source code must retain the above copyright 111.5Such * notice, this list of conditions and the following disclaimer. 121.5Such * 2. Redistributions in binary form must reproduce the above copyright 131.5Such * notice, this list of conditions and the following disclaimer in the 141.5Such * documentation and/or other materials provided with the distribution. 151.5Such * 161.5Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.5Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.5Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.5Such * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.5Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.5Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.5Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.5Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.5Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.5Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.5Such * POSSIBILITY OF SUCH DAMAGE. 271.5Such */ 281.5Such 291.2Such#ifndef _HPCSH_INTR_H_ 301.2Such#define _HPCSH_INTR_H_ 311.1Sitojun 321.5Such#include <sh3/intr.h> 331.1Sitojun 341.7Suwe/* 351.7Suwe * See sys/arch/sh3/sh3/interrupt.c 361.7Suwe * This was 8 for TMU0, TMU1, TMU2, SCIF * 4, HD6446x. 371.7Suwe * 381.7Suwe * For now bump this to 16 so that it's possible to do experiments 391.7Suwe * with new drivers without hitting this limit. 401.7Suwe */ 411.7Suwe#define _INTR_N 16 421.5Such 431.12Sad#define IPL_VM 11 441.12Sad#define IPL_SCHED 14 451.5Such#define IPL_HIGH 15 /* everything */ 461.5Such 471.6Such#include <hpcsh/dev/hd6446x/hd6446xintcvar.h> 481.6Such 491.10Sadtypedef uint8_t ipl_t; 501.9Syamttypedef struct { 511.9Syamt ipl_t _ipl; 521.9Syamt} ipl_cookie_t; 531.9Syamt 541.14Sryostatic inline __always_inline ipl_cookie_t 551.9Syamtmakeiplcookie(ipl_t ipl) 561.9Syamt{ 571.9Syamt 581.9Syamt return (ipl_cookie_t){._ipl = ipl << 4}; 591.9Syamt} 601.9Syamt 611.14Sryostatic inline __always_inline int 621.9Syamtsplraiseipl(ipl_cookie_t icookie) 631.9Syamt{ 641.9Syamt 651.9Syamt return hd6446x_intr_raise(icookie._ipl); 661.9Syamt} 671.9Syamt 681.9Syamt#include <sys/spl.h> 691.1Sitojun 701.6Such#define spl0() hd6446x_intr_resume(0) 711.6Such#define splx(x) hd6446x_intr_resume(x) 721.1Sitojun 731.5Such#endif /* !_HPCSH_INTR_H_ */ 74