2016-07-07 04:37:02 +00:00
|
|
|
(*
|
|
|
|
* Copyright 2014, General Dynamics C4 Systems
|
|
|
|
*
|
|
|
|
* This software may be distributed and modified according to the terms of
|
|
|
|
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
|
|
|
|
* See "LICENSE_GPLv2.txt" for details.
|
|
|
|
*
|
|
|
|
* @TAG(GD_GPL)
|
|
|
|
*)
|
|
|
|
|
|
|
|
chapter "Platform Definitions"
|
|
|
|
|
|
|
|
theory Platform
|
|
|
|
imports
|
2018-06-13 07:55:36 +00:00
|
|
|
"Lib.Defs"
|
|
|
|
"Lib.Lib"
|
|
|
|
"Word_Lib.WordSetup"
|
2016-07-07 04:37:02 +00:00
|
|
|
"../Setup_Locale"
|
|
|
|
begin
|
|
|
|
|
2016-12-06 21:05:20 +00:00
|
|
|
context Arch begin global_naming ARM_HYP
|
2016-07-07 04:37:02 +00:00
|
|
|
|
2019-06-05 10:18:48 +00:00
|
|
|
text \<open>
|
2016-07-07 04:37:02 +00:00
|
|
|
This theory lists platform-specific types and basic constants, in particular
|
|
|
|
the types of interrupts and physical addresses, constants for the
|
|
|
|
kernel location, the offsets between physical and virtual kernel
|
|
|
|
addresses, as well as the range of IRQs on the platform.
|
2019-06-05 10:18:48 +00:00
|
|
|
\<close>
|
2016-07-07 04:37:02 +00:00
|
|
|
|
|
|
|
type_synonym irq = "10 word"
|
|
|
|
type_synonym paddr = word32
|
|
|
|
|
|
|
|
abbreviation (input) "toPAddr \<equiv> id"
|
|
|
|
abbreviation (input) "fromPAddr \<equiv> id"
|
|
|
|
|
|
|
|
definition
|
|
|
|
pageColourBits :: nat where
|
|
|
|
"pageColourBits \<equiv> 2"
|
|
|
|
|
|
|
|
definition
|
|
|
|
cacheLineBits :: nat where
|
2017-04-05 16:05:20 +00:00
|
|
|
"cacheLineBits = 6"
|
2016-07-07 04:37:02 +00:00
|
|
|
|
|
|
|
definition
|
|
|
|
cacheLine :: nat where
|
|
|
|
"cacheLine = 2^cacheLineBits"
|
|
|
|
|
|
|
|
definition
|
|
|
|
kernelBase_addr :: word32 where
|
|
|
|
"kernelBase_addr \<equiv> 0xe0000000"
|
|
|
|
|
|
|
|
(* Arch specific kernel base address used for haskell spec *)
|
|
|
|
definition
|
|
|
|
kernelBase :: word32 where
|
|
|
|
"kernelBase \<equiv> 0xe0000000"
|
|
|
|
|
|
|
|
definition
|
|
|
|
physBase :: word32 where
|
2017-04-06 13:34:48 +00:00
|
|
|
"physBase \<equiv> 0x80000000"
|
2016-07-07 04:37:02 +00:00
|
|
|
|
2019-11-28 01:36:01 +00:00
|
|
|
definition
|
|
|
|
pptrTop :: "32 word" where
|
|
|
|
"pptrTop \<equiv> 0xfff00000"
|
|
|
|
|
|
|
|
definition
|
|
|
|
paddrTop :: "32 word" where
|
|
|
|
"paddrTop \<equiv> pptrTop - (kernelBase - physBase)"
|
|
|
|
|
2016-07-07 04:37:02 +00:00
|
|
|
definition
|
|
|
|
physMappingOffset :: word32 where
|
|
|
|
"physMappingOffset \<equiv> kernelBase_addr - physBase"
|
|
|
|
|
|
|
|
definition
|
|
|
|
ptrFromPAddr :: "paddr \<Rightarrow> word32" where
|
|
|
|
"ptrFromPAddr paddr \<equiv> paddr + physMappingOffset"
|
|
|
|
|
|
|
|
definition
|
|
|
|
addrFromPPtr :: "word32 \<Rightarrow> paddr" where
|
|
|
|
"addrFromPPtr pptr \<equiv> pptr - physMappingOffset"
|
|
|
|
|
|
|
|
definition
|
|
|
|
minIRQ :: "irq" where
|
|
|
|
"minIRQ \<equiv> 0"
|
|
|
|
|
|
|
|
definition
|
|
|
|
maxIRQ :: "irq" where
|
2017-04-05 16:06:05 +00:00
|
|
|
"maxIRQ \<equiv> 191"
|
2016-07-07 04:37:02 +00:00
|
|
|
|
2016-07-27 11:51:07 +00:00
|
|
|
definition irqVGICMaintenance :: "irq"
|
|
|
|
where "irqVGICMaintenance \<equiv> 25"
|
|
|
|
|
2019-11-28 01:36:01 +00:00
|
|
|
definition irqVTimerEvent :: "irq"
|
|
|
|
where "irqVTimerEvent \<equiv> 27"
|
|
|
|
|
2016-07-07 04:37:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|