18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
78c2ecf20Sopenharmony_ci * Copyright (C) 1999 by Ralf Baechle
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef _ASM_SN_SN0_HUB_H
108c2ecf20Sopenharmony_ci#define _ASM_SN_SN0_HUB_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* The secret password; used to release protection */
138c2ecf20Sopenharmony_ci#define HUB_PASSWORD		0x53474972756c6573ull
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define CHIPID_HUB		0
168c2ecf20Sopenharmony_ci#define CHIPID_ROUTER		1
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define HUB_REV_1_0		1
198c2ecf20Sopenharmony_ci#define HUB_REV_2_0		2
208c2ecf20Sopenharmony_ci#define HUB_REV_2_1		3
218c2ecf20Sopenharmony_ci#define HUB_REV_2_2		4
228c2ecf20Sopenharmony_ci#define HUB_REV_2_3		5
238c2ecf20Sopenharmony_ci#define HUB_REV_2_4		6
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define MAX_HUB_PATH		80
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#include <asm/sn/sn0/addrs.h>
288c2ecf20Sopenharmony_ci#include <asm/sn/sn0/hubpi.h>
298c2ecf20Sopenharmony_ci#include <asm/sn/sn0/hubmd.h>
308c2ecf20Sopenharmony_ci#include <asm/sn/sn0/hubio.h>
318c2ecf20Sopenharmony_ci#include <asm/sn/sn0/hubni.h>
328c2ecf20Sopenharmony_ci//#include <asm/sn/sn0/hubcore.h>
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Translation of uncached attributes */
358c2ecf20Sopenharmony_ci#define UATTR_HSPEC	0
368c2ecf20Sopenharmony_ci#define UATTR_IO	1
378c2ecf20Sopenharmony_ci#define UATTR_MSPEC	2
388c2ecf20Sopenharmony_ci#define UATTR_UNCAC	3
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#ifdef __ASSEMBLY__
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci * Returns the local nasid into res.
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci	.macro GET_NASID_ASM res
458c2ecf20Sopenharmony_ci	dli	\res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
468c2ecf20Sopenharmony_ci	ld	\res, (\res)
478c2ecf20Sopenharmony_ci	and	\res, NSRI_NODEID_MASK
488c2ecf20Sopenharmony_ci	dsrl	\res, NSRI_NODEID_SHFT
498c2ecf20Sopenharmony_ci	.endm
508c2ecf20Sopenharmony_ci#else
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/*
538c2ecf20Sopenharmony_ci * get_nasid() returns the physical node id number of the caller.
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_cistatic inline nasid_t get_nasid(void)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK)
588c2ecf20Sopenharmony_ci			 >> NSRI_NODEID_SHFT);
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci#endif
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#endif /* _ASM_SN_SN0_HUB_H */
63