pmb.h revision 1.1
11.1Suwe/* $NetBSD: pmb.h,v 1.1 2020/07/25 22:26:59 uwe Exp $ */
21.1Suwe/*
31.1Suwe * Copyright (c) 2020 Valery Ushakov
41.1Suwe * All rights reserved.
51.1Suwe *
61.1Suwe * Redistribution and use in source and binary forms, with or without
71.1Suwe * modification, are permitted provided that the following conditions
81.1Suwe * are met:
91.1Suwe * 1. Redistributions of source code must retain the above copyright
101.1Suwe *    notice, this list of conditions and the following disclaimer.
111.1Suwe * 2. Redistributions in binary form must reproduce the above copyright
121.1Suwe *    notice, this list of conditions and the following disclaimer in the
131.1Suwe *    documentation and/or other materials provided with the distribution.
141.1Suwe *
151.1Suwe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
161.1Suwe * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171.1Suwe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
181.1Suwe * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191.1Suwe * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
201.1Suwe * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211.1Suwe * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
221.1Suwe * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
231.1Suwe * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
241.1Suwe * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251.1Suwe */
261.1Suwe
271.1Suwe#ifndef _SH3_PMB_H_
281.1Suwe#define	_SH3_PMB_H_
291.1Suwe/*
301.1Suwe * ST40 Privileged Mapping Buffer (PMB)
311.1Suwe *
321.1Suwe * Original SuperH can handle only 29-bit external memory space.
331.1Suwe * "The physical address space is permanently mapped onto 29-bit
341.1Suwe * external memory space."  See <sh3/cpu.h>.
351.1Suwe *
361.1Suwe * ST40-200, ST40-300 and ST40-500 have "space enhanced" SE mode where
371.1Suwe * the mapping from the physical address space P1 and P2 segments to
381.1Suwe * the 32-bit external memory space is defined via 16-entry PMB.
391.1Suwe */
401.1Suwe
411.1Suwe
421.1Suwe/* on ST40-200 and ST40-500 SE bit is in MMUCR */
431.1Suwe#define ST40_MMUCR_SE			0x00000010
441.1Suwe
451.1Suwe
461.1Suwe/* Physical address space control register (ST4-300) */
471.1Suwe#define ST40_PMB_PASCR			0xff000070
481.1Suwe#define   ST40_PASCR_UB_MASK		  0x0000000f
491.1Suwe#define   ST40_PASCR_SE			  0x80000000
501.1Suwe
511.1Suwe
521.1Suwe/* Memory-mapped PMB */
531.1Suwe#define ST40_PMB_ENTRY			16
541.1Suwe
551.1Suwe#define ST40_PMB_E_MASK			0x00000f00
561.1Suwe#define ST40_PMB_E_SHIFT		8
571.1Suwe
581.1Suwe
591.1Suwe/* PMB Address Array */
601.1Suwe#define ST40_PMB_AA			0xf6100000
611.1Suwe#define   ST40_PMB_AA_V			  0x00000100
621.1Suwe#define   ST40_PMB_AA_VPN_MASK		  0xff000000
631.1Suwe#define   ST40_PMB_AA_VPN_SHIFT		  24
641.1Suwe
651.1Suwe
661.1Suwe/* PMB Data Array */
671.1Suwe#define   ST40_PMB_DA			0xf7100000
681.1Suwe#define   ST40_PMB_DA_WT		0x00000001
691.1Suwe#define   ST40_PMB_DA_C			0x00000008
701.1Suwe#define   ST40_PMB_DA_UB		0x00000200
711.1Suwe#define   ST40_PMB_DA_SZ_MASK		0x00000090
721.1Suwe#define     ST40_PMB_DA_SZ_16M		0x00000000
731.1Suwe#define     ST40_PMB_DA_SZ_64M		0x00000010
741.1Suwe#define     ST40_PMB_DA_SZ_128M		0x00000080
751.1Suwe#define     ST40_PMB_DA_SZ_512M		0x00000090
761.1Suwe#define   ST40_PMB_DA_V			0x00000100
771.1Suwe#define   ST40_PMB_DA_PPN_MASK		0xff000000
781.1Suwe#define   ST40_PMB_DA_PPN_SHIFT		24
791.1Suwe
801.1Suwe#endif	/* !_SH3_PMB_H_ */
81