cpu.h revision 1.6
11.6Sthorpej/* $NetBSD: cpu.h,v 1.6 1999/08/10 21:08:08 thorpej 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.5Sthorpej int (*spllowersoftclock) __P((void)); 471.2Sthorpej int (*splsoftclock) __P((void)); 481.2Sthorpej int (*splsoftnet) __P((void)); 491.2Sthorpej int (*splx) __P((int)); 501.2Sthorpej void (*setsoftclock) __P((void)); 511.2Sthorpej void (*setsoftnet) __P((void)); 521.2Sthorpej void (*clock_return) __P((struct clockframe *, int)); 531.1Sws void (*irq_establish) __P((int, int, void (*)(void *), void *)); 541.1Sws}; 551.1Swsextern struct machvec machine_interface; 561.1Sws 571.1Sws#include <machine/psl.h> 581.1Sws 591.2Sthorpej#define splhigh() ((*machine_interface.splhigh)()) 601.2Sthorpej#define spl0() ((*machine_interface.spl0)()) 611.2Sthorpej#define splbio() ((*machine_interface.splbio)()) 621.2Sthorpej#define splnet() ((*machine_interface.splnet)()) 631.2Sthorpej#define spltty() ((*machine_interface.spltty)()) 641.2Sthorpej#define splimp() ((*machine_interface.splimp)()) 651.2Sthorpej#define splclock() ((*machine_interface.splclock)()) 661.5Sthorpej#define spllowersoftclock() ((*machine_interface.spllowersoftclock)()) 671.2Sthorpej#define splsoftclock() ((*machine_interface.splsoftclock)()) 681.2Sthorpej#define splstatclock() splclock() 691.2Sthorpej#define splsoftnet() ((*machine_interface.splsoftnet)()) 701.2Sthorpej#define splx(new) ((*machine_interface.splx)(new)) 711.2Sthorpej#define setsoftclock() ((*machine_interface.setsoftclock)()) 721.2Sthorpej#define setsoftnet() ((*machine_interface.setsoftnet)()) 731.2Sthorpej#define clock_return(frame, level) \ 741.2Sthorpej ((*machine_interface.clock_return)((frame), (level))) 751.1Sws#define irq_establish(irq, level, handler, arg) \ 761.1Sws ((*machine_interface.irq_establish)((irq), (level), (handler), (arg))) 771.1Sws 781.1Sws#define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) 791.1Sws#define CLKF_BASEPRI(frame) ((frame)->pri == 0) 801.1Sws#define CLKF_PC(frame) ((frame)->srr0) 811.2Sthorpej#define CLKF_INTR(frame) ((frame)->depth >= 0) 821.1Sws 831.1Sws#define cpu_swapout(p) 841.1Sws#define cpu_wait(p) 851.6Sthorpej#define cpu_number() 0 861.1Sws 871.1Swsextern void delay __P((unsigned)); 881.1Sws#define DELAY(n) delay(n) 891.1Sws 901.3Sthorpejextern __volatile int want_resched; 911.3Sthorpejextern __volatile int astpending; 921.1Sws 931.1Sws#define need_resched() (want_resched = 1, astpending = 1) 941.1Sws#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) 951.1Sws#define signotify(p) (astpending = 1) 961.1Sws 971.4Swsextern char *bootpath; 981.1Sws 991.4Sws#ifdef _KERNEL 1001.4Sws#define CACHELINESIZE 32 1011.4Sws#endif 1021.1Sws 1031.4Sws#include <powerpc/cpu.h> 1041.1Sws 1051.1Sws#endif /* _MACHINE_CPU_H_ */ 106