cpu.h revision 1.4
11.4Sws/* $NetBSD: cpu.h,v 1.4 1999/04/17 21:16:47 ws Exp $ */ 21.1Sws 31.1Sws/* 41.2Sthorpej * Copyright (C) 1995-1997 Wolfgang Solfrank. 51.2Sthorpej * Copyright (C) 1995-1997 TooLs GmbH. 61.1Sws * All rights reserved. 71.1Sws * 81.1Sws * Redistribution and use in source and binary forms, with or without 91.1Sws * modification, are permitted provided that the following conditions 101.1Sws * are met: 111.1Sws * 1. Redistributions of source code must retain the above copyright 121.1Sws * notice, this list of conditions and the following disclaimer. 131.1Sws * 2. Redistributions in binary form must reproduce the above copyright 141.1Sws * notice, this list of conditions and the following disclaimer in the 151.1Sws * documentation and/or other materials provided with the distribution. 161.1Sws * 3. All advertising materials mentioning features or use of this software 171.1Sws * must display the following acknowledgement: 181.1Sws * This product includes software developed by TooLs GmbH. 191.1Sws * 4. The name of TooLs GmbH may not be used to endorse or promote products 201.1Sws * derived from this software without specific prior written permission. 211.1Sws * 221.1Sws * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 231.1Sws * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 241.1Sws * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 251.1Sws * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 261.1Sws * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 271.1Sws * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 281.1Sws * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 291.1Sws * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 301.1Sws * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 311.1Sws * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 321.1Sws */ 331.1Sws#ifndef _MACHINE_CPU_H_ 341.1Sws#define _MACHINE_CPU_H_ 351.1Sws 361.1Sws#include <machine/frame.h> 371.1Sws 381.1Swsstruct machvec { 391.2Sthorpej int (*splhigh) __P((void)); 401.2Sthorpej int (*spl0) __P((void)); 411.2Sthorpej int (*splbio) __P((void)); 421.2Sthorpej int (*splnet) __P((void)); 431.2Sthorpej int (*spltty) __P((void)); 441.2Sthorpej int (*splimp) __P((void)); 451.2Sthorpej int (*splclock) __P((void)); 461.2Sthorpej int (*splsoftclock) __P((void)); 471.2Sthorpej int (*splsoftnet) __P((void)); 481.2Sthorpej int (*splx) __P((int)); 491.2Sthorpej void (*setsoftclock) __P((void)); 501.2Sthorpej void (*setsoftnet) __P((void)); 511.2Sthorpej void (*clock_return) __P((struct clockframe *, int)); 521.1Sws void (*irq_establish) __P((int, int, void (*)(void *), void *)); 531.1Sws}; 541.1Swsextern struct machvec machine_interface; 551.1Sws 561.1Sws#include <machine/psl.h> 571.1Sws 581.2Sthorpej#define splhigh() ((*machine_interface.splhigh)()) 591.2Sthorpej#define spl0() ((*machine_interface.spl0)()) 601.2Sthorpej#define splbio() ((*machine_interface.splbio)()) 611.2Sthorpej#define splnet() ((*machine_interface.splnet)()) 621.2Sthorpej#define spltty() ((*machine_interface.spltty)()) 631.2Sthorpej#define splimp() ((*machine_interface.splimp)()) 641.2Sthorpej#define splclock() ((*machine_interface.splclock)()) 651.2Sthorpej#define splsoftclock() ((*machine_interface.splsoftclock)()) 661.2Sthorpej#define splstatclock() splclock() 671.2Sthorpej#define splsoftnet() ((*machine_interface.splsoftnet)()) 681.2Sthorpej#define splx(new) ((*machine_interface.splx)(new)) 691.2Sthorpej#define setsoftclock() ((*machine_interface.setsoftclock)()) 701.2Sthorpej#define setsoftnet() ((*machine_interface.setsoftnet)()) 711.2Sthorpej#define clock_return(frame, level) \ 721.2Sthorpej ((*machine_interface.clock_return)((frame), (level))) 731.1Sws#define irq_establish(irq, level, handler, arg) \ 741.1Sws ((*machine_interface.irq_establish)((irq), (level), (handler), (arg))) 751.1Sws 761.1Sws#define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) 771.1Sws#define CLKF_BASEPRI(frame) ((frame)->pri == 0) 781.1Sws#define CLKF_PC(frame) ((frame)->srr0) 791.2Sthorpej#define CLKF_INTR(frame) ((frame)->depth >= 0) 801.1Sws 811.1Sws#define cpu_swapout(p) 821.1Sws#define cpu_wait(p) 831.1Sws 841.1Swsextern void delay __P((unsigned)); 851.1Sws#define DELAY(n) delay(n) 861.1Sws 871.3Sthorpejextern __volatile int want_resched; 881.3Sthorpejextern __volatile int astpending; 891.1Sws 901.1Sws#define need_resched() (want_resched = 1, astpending = 1) 911.1Sws#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) 921.1Sws#define signotify(p) (astpending = 1) 931.1Sws 941.4Swsextern char *bootpath; 951.1Sws 961.4Sws#ifdef _KERNEL 971.4Sws#define CACHELINESIZE 32 981.4Sws#endif 991.1Sws 1001.4Sws#include <powerpc/cpu.h> 1011.1Sws 1021.1Sws#endif /* _MACHINE_CPU_H_ */ 103