/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Ross Harvey.
* 4. The name of Ross Harvey may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY ROSS HARVEY ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP0SE
* ARE DISCLAIMED. IN NO EVENT SHALL ROSS HARVEY BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*
* {LD,ST}QP: LoaD and STore Quad Physical
*/
#define LDQP(a) (*(volatile long *)ALPHA_PHYS_TO_K0SEG(a))
#define STQP(a) LDQP(a)
/*
* Define extraction functions for bit fields via length and left,right bitno
*/
#define TSFIELD(r,offs,len) (((r) >> (offs)) & (~0UL >> (64 - (len))))
#define TSFIELDBB(r,lb,rb) TSFIELD((r), (rb), (lb) - (rb) + 1)
/*
* EV6 has a new superpage which can pass through 44 address bits. (Umm, a
* superduperpage?) But, the firmware doesn't turn it on, so we use the old
* one and let the HW sign extend va/pa<40> to get us the pa<43> that makes
* the needed I/O space access. This is just as well; it means we don't have
* to worry about which GENERIC code might get called on other CPU models.
*
* E.g., we want this: 0x0801##a000##0000
* We use this: 0x0101##a000##0000
* ...mix in the old SP: 0xffff##fc00##0000##0000
* ...after PA sign ext: 0xffff##ff00##a000##0000
* (PA<42:41> ignored)
*/
/*
* This hack allows us to map the I/O address space without using
* the KSEG sign extension hack.
*/
#define TS_PHYSADDR(x) \
(((x) & ~0x0100##0000##0000) | 0x0800##0000##0000)
/*
* Cchip CSR Map
*/
#define TS_C_CSC 0x101##a000##0000UL /* Cchip System Configuration */