/*-1* Copyright (c) 2014 Andrew Turner2* Copyright (c) 2014-2015 The FreeBSD Foundation3* All rights reserved.4*5* This software was developed by Andrew Turner under6* sponsorship from the FreeBSD Foundation.7*8* Redistribution and use in source and binary forms, with or without9* modification, are permitted provided that the following conditions10* are met:11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13* 2. Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in the15* documentation and/or other materials provided with the distribution.16*17* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND18* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE21* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL22* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS23* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)24* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT25* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY26* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF27* SUCH DAMAGE.28*/2930#ifndef _ARM64_IOMMU_IOMMU_PTE_H_31#define _ARM64_IOMMU_IOMMU_PTE_H_3233/* Level 0 table, 512GiB per entry */34#define IOMMU_L0_SHIFT 3935#define IOMMU_L0_INVAL 0x0 /* An invalid address */36/* 0x1 Level 0 doesn't support block translation */37/* 0x2 also marks an invalid address */38#define IOMMU_L0_TABLE 0x3 /* A next-level table */3940/* Level 1 table, 1GiB per entry */41#define IOMMU_L1_SHIFT 3042#define IOMMU_L1_INVAL IOMMU_L0_INVAL43#define IOMMU_L1_BLOCK 0x144#define IOMMU_L1_TABLE IOMMU_L0_TABLE4546/* Level 2 table, 2MiB per entry */47#define IOMMU_L2_SHIFT 2148#define IOMMU_L2_INVAL IOMMU_L1_INVAL49#define IOMMU_L2_BLOCK IOMMU_L1_BLOCK50#define IOMMU_L2_TABLE IOMMU_L1_TABLE5152/* Level 3 table, 4KiB per entry */53#define IOMMU_L3_SHIFT 1254#define IOMMU_L3_SIZE (1 << IOMMU_L3_SHIFT)55#define IOMMU_L3_SHIFT 1256#define IOMMU_L3_INVAL 0x057/* 0x1 is reserved */58/* 0x2 also marks an invalid address */59#define IOMMU_L3_PAGE 0x360#define IOMMU_L3_BLOCK IOMMU_L2_BLOCK /* Mali GPU only. */6162#define IOMMU_L0_ENTRIES_SHIFT 963#define IOMMU_L0_ENTRIES (1 << IOMMU_L0_ENTRIES_SHIFT)64#define IOMMU_L0_ADDR_MASK (IOMMU_L0_ENTRIES - 1)6566#define IOMMU_Ln_ENTRIES_SHIFT 967#define IOMMU_Ln_ENTRIES (1 << IOMMU_Ln_ENTRIES_SHIFT)68#define IOMMU_Ln_ADDR_MASK (IOMMU_Ln_ENTRIES - 1)69#define IOMMU_Ln_TABLE_MASK ((1 << 12) - 1)7071#endif /* !_ARM64_IOMMU_IOMMU_PTE_H_ */727374