Fixup PSL handling to be tolerant of modules. Move evbppc psl changes

into powerpc psl.h
This commit is contained in:
matt 2011-06-20 07:23:36 +00:00
parent 7e37a13248
commit 544a61dd20
3 changed files with 29 additions and 35 deletions

View File

@ -1,28 +1,3 @@
/* $NetBSD: psl.h,v 1.3 2005/12/11 12:17:12 christos Exp $ */
#ifdef _KERNEL_OPT
#include "opt_ppcarch.h"
#endif
/* $NetBSD: psl.h,v 1.4 2011/06/20 07:23:36 matt Exp $ */
#include <powerpc/psl.h>
#ifdef PPC_IBM4XX
/* 4xx don't have PSL_RI */
#undef PSL_USERSET
#ifdef PPC_IBM403
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR)
#else
/* Apparently we get unexplained machine checks, so disable them. */
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR)
#endif
/*
* We also need to override the PSL_SE bit. 4xx have completely
* different debug register support.
*
* The SE bit is actually the DWE bit. We want to set the DE bit
* to enable the debug regs instead of the DWE bit.
*/
#undef PSL_SE
#define PSL_SE 0x00000200
#endif

View File

@ -38,6 +38,8 @@
#include <sys/cdefs.h>
#include "opt_modular.h"
#include <sys/param.h>
#include <sys/cpu.h>
#include <sys/device.h>
@ -61,6 +63,12 @@ paddr_t msgbuf_paddr;
psize_t pmemsize;
struct vm_map *phys_map;
#ifdef MODULAR
register_t cpu_psluserset = PSL_USERSET;
register_t cpu_pslusermod = PSL_USERMOD;
register_t cpu_pslusermask = PSL_USERMASK;
#endif
static bus_addr_t booke_dma_phys_to_bus_mem(bus_dma_tag_t, bus_addr_t);
static bus_addr_t booke_dma_bus_mem_to_phys(bus_dma_tag_t, bus_addr_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: psl.h,v 1.17 2011/05/02 02:01:33 matt Exp $ */
/* $NetBSD: psl.h,v 1.18 2011/06/20 07:23:36 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -102,23 +102,34 @@
#include "opt_ppcarch.h"
#endif /* _KERNEL_OPT */
#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE)
extern int cpu_psluserset, cpu_pslusermod;
#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined(_MODULE)
extern register_t cpu_psluserset, cpu_pslusermod, cpu_pslusermask;
#define PSL_USERSET cpu_psluserset
#define PSL_USERMOD cpu_pslusermod
#define PSL_USERMASK cpu_pslusermask
#elif defined(PPC_BOOKE)
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_ME | PSL_CE | PSL_DE | PSL_IS | PSL_DS)
#define PSL_USERSRR1 ((PSL_USERSET|PSL_USERMOD) & (PSL_SPV|PSL_CE|0xFFFF))
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_IS | PSL_DS | PSL_ME | PSL_CE | PSL_DE)
#define PSL_USERMASK (PSL_SPV | PSL_CE | 0xFFFF)
#define PSL_USERMOD (PSL_SPV)
#else /* PPC_IBM4XX */
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR)
#ifdef PPC_IBM403
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_ME)
#else /* Apparently we get unexplained machine checks, so disable them. */
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR)
#endif
#define PSL_USERMASK 0xFFFF
#define PSL_USERMOD (0)
/*
* We also need to override the PSL_SE bit. 4xx have completely different
* debug register support. The SE bit is actually the DWE bit. We want to
* set the DE bit to enable the debug regs instead of the DWE bit.
*/
#undef PSL_SE
#define PSL_SE PSL_DE
#endif /* PPC_OEA */
#ifndef PSL_USERSRR1
#define PSL_USERSRR1 ((PSL_USERSET|PSL_USERMOD) & 0xFFFF)
#endif
#define PSL_USERSRR1 ((PSL_USERSET|PSL_USERMOD) & PSL_USERMASK)
#define PSL_USEROK_P(psl) (((psl) & ~PSL_USERMOD) == PSL_USERSET)
#endif /* !_LOCORE */