ofw_nexus.h revision 139825
1139825Simp/*-
286229Stmm * Copyright (c) 1998, 1999 Eduardo E. Horvath
386229Stmm * Copyright (c) 1999 Matthew R. Green
486229Stmm * All rights reserved.
586229Stmm *
686229Stmm * Redistribution and use in source and binary forms, with or without
786229Stmm * modification, are permitted provided that the following conditions
886229Stmm * are met:
986229Stmm * 1. Redistributions of source code must retain the above copyright
1086229Stmm *    notice, this list of conditions and the following disclaimer.
1186229Stmm * 2. Redistributions in binary form must reproduce the above copyright
1286229Stmm *    notice, this list of conditions and the following disclaimer in the
1386229Stmm *    documentation and/or other materials provided with the distribution.
1486229Stmm * 3. The name of the author may not be used to endorse or promote products
1586229Stmm *    derived from this software without specific prior written permission.
1686229Stmm *
1786229Stmm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1886229Stmm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1986229Stmm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2086229Stmm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2186229Stmm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2286229Stmm * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2386229Stmm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2486229Stmm * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2586229Stmm * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2686229Stmm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2786229Stmm * SUCH DAMAGE.
2886229Stmm *
2986229Stmm *	from: NetBSD: psychoreg.h,v 1.8 2001/09/10 16:17:06 eeh Exp
3086229Stmm *
3186229Stmm * $FreeBSD: head/sys/sparc64/include/ofw_nexus.h 139825 2005-01-07 02:29:27Z imp $
3286229Stmm */
3386229Stmm
3486229Stmm#ifndef _MACHINE_OFW_UPA_H_
3586229Stmm#define _MACHINE_OFW_UPA_H_
3686229Stmm
3786229Stmm/*
3886229Stmm * These are the regs and ranges property the psycho uses. They should be
3986229Stmm * applicable to all UPA devices. XXX: verify this.
4086229Stmm */
4186229Stmm
4286229Stmmstruct upa_regs {
4386229Stmm	u_int32_t	phys_hi;
4486229Stmm	u_int32_t	phys_lo;
4586229Stmm	u_int32_t	size_hi;
4686229Stmm	u_int32_t	size_lo;
4786229Stmm};
4886229Stmm
4986229Stmmstruct upa_ranges {
5086229Stmm	u_int32_t	cspace;
5186229Stmm	u_int32_t	child_hi;
5286229Stmm	u_int32_t	child_lo;
5386229Stmm	u_int32_t	phys_hi;
5486229Stmm	u_int32_t	phys_lo;
5586229Stmm	u_int32_t	size_hi;
5686229Stmm	u_int32_t	size_lo;
5786229Stmm};
5886229Stmm
5988823Stmm#define	UPA_REG_PHYS(r) \
6088823Stmm	(((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
6188823Stmm#define	UPA_REG_SIZE(r) \
6288823Stmm	(((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
6388823Stmm
6486229Stmm#define	UPA_RANGE_CHILD(r) \
6586229Stmm	(((u_int64_t)(r)->child_hi << 32) | (u_int64_t)(r)->child_lo)
6686229Stmm#define	UPA_RANGE_PHYS(r) \
6786229Stmm	(((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
6886229Stmm#define	UPA_RANGE_SIZE(r) \
6986229Stmm	(((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
7086229Stmm#define	UPA_RANGE_CS(r)		(((r)->cspace >> 24) & 0x03)
7186229Stmm
7286229Stmm#endif /* !_MACHINE_OFW_UPA_H_ */
73