diff --git a/Cargo.lock b/Cargo.lock index e6960a123..825e1b156 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -168,7 +168,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blitstr" version = "0.5.0" -source = "git+https://github.com/betrusted-io/blitstr.git?rev=cebcabb9a2b0686bb47f6e1508640941ae88469c#cebcabb9a2b0686bb47f6e1508640941ae88469c" +source = "git+https://github.com/betrusted-io/blitstr.git?rev=89675bf468fa51baaf0de94e806b85c92466ae64#89675bf468fa51baaf0de94e806b85c92466ae64" dependencies = [ "log", "rkyv 0.4.3", diff --git a/docs/memory.md b/docs/memory.md index 9e43fbf93..0ff8842c2 100644 --- a/docs/memory.md +++ b/docs/memory.md @@ -1,6 +1,8 @@ # Memory Layout +You definitely want to refer to the [Xous Book](https://betrusted.io/xous-book/ch03-01-memory-layout.html#virtual-memory-regions) if you're trying to debug a kernel panic, before reading on here. + Xous assumes a memory-mapped IO system. Furthermore, it assumes there is one section of "general-purpose RAM", and zero or more additional memory sections. Finally, it assumes there is an MMU. diff --git a/emulation/soc/renode.svd b/emulation/soc/renode.svd index 92f809719..92b3a4d32 100644 --- a/emulation/soc/renode.svd +++ b/emulation/soc/renode.svd @@ -3,7 +3,7 @@ litex SOC - + 8 32 @@ -1238,10 +1238,10 @@ register to disable individual events.]]> GIT_GITREV 0x0014 - 0x7528dee0 + 0xb481fff0 32 @@ -1258,7 +1258,7 @@ the exact git version used to build this firmware.]]> is ``1``, then the repository this was built from has one additional commit beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]> 0x0018 - 0x04 + 0x0e 32 @@ -2508,10 +2508,26 @@ a forced suspend (e.g. a timeout happened and a server may be unclean.]]> - INTERRUPT + WFI 0x0020 0x00 32 + + + override + 0 + [0:0] + 0 + + + + + + INTERRUPT + 0x0024 + 0x00 + 32 interrupt @@ -2527,7 +2543,7 @@ suspend/resume from an interrupt context.]]> EV_STATUS - 0x0024 + 0x0028 0x00 32 @@ -2544,7 +2560,7 @@ Writes to this register have no effect.]]> EV_PENDING - 0x0028 + 0x002c 0x00 32 @@ -2562,7 +2578,7 @@ edge.]]> EV_ENABLE - 0x002c + 0x0030 0x00 32 @@ -2578,7 +2594,7 @@ register to disable individual events.]]> 0 - 0x30 + 0x34 registers @@ -3568,7 +3584,7 @@ inject too fast.]]> SEED1 0x0000 - 0x1b3a25e4 + 0x4de9a155 32 @@ -3583,7 +3599,7 @@ inject too fast.]]> SEED0 0x0004 - 0x7b69dedc + 0x35aac807 32 diff --git a/imports/blitstr-ref/Cargo.toml b/imports/blitstr-ref/Cargo.toml index 980da83bc..978a63335 100644 --- a/imports/blitstr-ref/Cargo.toml +++ b/imports/blitstr-ref/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "blitstr import package" [dependencies] -blitstr = { git = "https://github.com/betrusted-io/blitstr.git", rev = "cebcabb9a2b0686bb47f6e1508640941ae88469c" } +blitstr = { git = "https://github.com/betrusted-io/blitstr.git", rev = "89675bf468fa51baaf0de94e806b85c92466ae64" } # blitstr = { path = "../blitstr" } # targeting hardware diff --git a/loader/src/main.rs b/loader/src/main.rs index 19f68d083..d92daed8f 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -1228,6 +1228,11 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! { } else { // resume path use utralib::generated::*; + // flip my self-power-on switch: otherwise, I might turn off before the whole sequence is finished. + let mut power_csr = CSR::new(utra::power::HW_POWER_BASE as *mut u32); + power_csr.rmwf(utra::power::POWER_STATE, 1); + power_csr.rmwf(utra::power::POWER_SELF, 1); + // TRNG virtual memory mapping already set up, but we pump values out just to make sure // the pipeline is fresh. Simulations show this isn't necessary, but I feel paranoid; // I worry a subtle bug in the reset logic could leave deterministic values in the pipeline. diff --git a/precursors/rom.db b/precursors/rom.db index c766b8d08..0aa545e2a 100755 --- a/precursors/rom.db +++ b/precursors/rom.db @@ -1,128 +1,128 @@ -KEYROM 0 A SLICE_X36Y50 b'2acc820c80a53ba8' -KEYROM 0 B SLICE_X36Y50 b'bd050a7d247c0555' -KEYROM 0 C SLICE_X36Y50 b'1fac0a566b5c70aa' -KEYROM 0 D SLICE_X36Y50 b'de0c850e53845597' -KEYROM 1 A SLICE_X37Y50 b'f7c8796960478f5d' -KEYROM 1 B SLICE_X37Y50 b'4bb5f05d13081848' -KEYROM 1 C SLICE_X37Y50 b'e8f74fd7beaad220' -KEYROM 1 D SLICE_X37Y50 b'fe3c72331ccf0d26' -KEYROM 2 A SLICE_X36Y51 b'6ecb85e77a7e346e' -KEYROM 2 B SLICE_X36Y51 b'5adae871549c3b3d' -KEYROM 2 C SLICE_X36Y51 b'eded500fb3e47391' -KEYROM 2 D SLICE_X36Y51 b'26f3b475a27c30ea' -KEYROM 3 A SLICE_X37Y51 b'0387f8f923117b3f' -KEYROM 3 B SLICE_X37Y51 b'584c229eddf91c13' -KEYROM 3 C SLICE_X37Y51 b'df98774e8853e9bb' -KEYROM 3 D SLICE_X37Y51 b'2d0ae409aee1c065' -KEYROM 4 A SLICE_X36Y52 b'ea6ba19234072cdd' -KEYROM 4 B SLICE_X36Y52 b'07d19b7ac684f520' -KEYROM 4 C SLICE_X36Y52 b'd6825b2ca8d1d759' -KEYROM 4 D SLICE_X36Y52 b'f445f79aeb3758e5' -KEYROM 5 A SLICE_X37Y52 b'c983e15659bab942' -KEYROM 5 B SLICE_X37Y52 b'4d1bc9070be26610' -KEYROM 5 C SLICE_X37Y52 b'6ddc4928ea425fd3' -KEYROM 5 D SLICE_X37Y52 b'c84345b0ff6f1516' -KEYROM 6 A SLICE_X36Y53 b'a1db478bc967a09a' -KEYROM 6 B SLICE_X36Y53 b'19353c088e785f2a' -KEYROM 6 C SLICE_X36Y53 b'48c55b2a8bb609a4' -KEYROM 6 D SLICE_X36Y53 b'36eb27a648abbc57' -KEYROM 7 A SLICE_X37Y53 b'44a79a2e00fcf830' -KEYROM 7 B SLICE_X37Y53 b'9a37ff3ed87c9071' -KEYROM 7 C SLICE_X37Y53 b'9b85c8507583b63d' -KEYROM 7 D SLICE_X37Y53 b'bbf7781e246e4c0e' -KEYROM 8 A SLICE_X36Y54 b'71e799a9f277d122' -KEYROM 8 B SLICE_X36Y54 b'7c28df3f53cd14e2' -KEYROM 8 C SLICE_X36Y54 b'16b12eb41de29102' -KEYROM 8 D SLICE_X36Y54 b'e75df88910af60e4' -KEYROM 9 A SLICE_X37Y54 b'f7ea9f2cdf131072' -KEYROM 9 B SLICE_X37Y54 b'f9dbe490080d6720' -KEYROM 9 C SLICE_X37Y54 b'5720dcc8b874cf7e' -KEYROM 9 D SLICE_X37Y54 b'd8377165764bd6fd' -KEYROM 10 A SLICE_X36Y55 b'a760aaef120e11fb' -KEYROM 10 B SLICE_X36Y55 b'84d6e2f1c8a29170' -KEYROM 10 C SLICE_X36Y55 b'a2842f2f37bd9ba4' -KEYROM 10 D SLICE_X36Y55 b'b90a185010054051' -KEYROM 11 A SLICE_X37Y55 b'6047f66b90eb4978' -KEYROM 11 B SLICE_X37Y55 b'484e19220672d423' -KEYROM 11 C SLICE_X37Y55 b'20581cd9b2617da5' -KEYROM 11 D SLICE_X37Y55 b'6c08b93d1f2080c7' -KEYROM 12 A SLICE_X36Y56 b'70e2cf71a4d05fc0' -KEYROM 12 B SLICE_X36Y56 b'147230f38f9cbcfe' -KEYROM 12 C SLICE_X36Y56 b'd78c1c35a48680cd' -KEYROM 12 D SLICE_X36Y56 b'a772440d19904627' -KEYROM 13 A SLICE_X37Y56 b'9e49bde5625fa75e' -KEYROM 13 B SLICE_X37Y56 b'bdfab4e7b6e4c80a' -KEYROM 13 C SLICE_X37Y56 b'10273aaf7425c52d' -KEYROM 13 D SLICE_X37Y56 b'794f4d5a98d95737' -KEYROM 14 A SLICE_X36Y57 b'da373b1a8ae45ae2' -KEYROM 14 B SLICE_X36Y57 b'792fdfb0cc756bc6' -KEYROM 14 C SLICE_X36Y57 b'7f1c7ca6f2405feb' -KEYROM 14 D SLICE_X36Y57 b'a5abc3512ca00572' -KEYROM 15 A SLICE_X37Y57 b'624a3bd238b25244' -KEYROM 15 B SLICE_X37Y57 b'b61ee04ae548069d' -KEYROM 15 C SLICE_X37Y57 b'df31d7b0c9d70da5' -KEYROM 15 D SLICE_X37Y57 b'054475d3009d332d' -KEYROM 16 A SLICE_X36Y58 b'ebdb2be439e86eb9' -KEYROM 16 B SLICE_X36Y58 b'fd04b2973d7e1a13' -KEYROM 16 C SLICE_X36Y58 b'c12a137938d99ce8' -KEYROM 16 D SLICE_X36Y58 b'53e00d01b1a8bb63' -KEYROM 17 A SLICE_X37Y58 b'95a1ebf6410f8fa5' -KEYROM 17 B SLICE_X37Y58 b'cc9b033d202d8a50' -KEYROM 17 C SLICE_X37Y58 b'7719494c68215271' -KEYROM 17 D SLICE_X37Y58 b'2f6a4747f6674dbd' -KEYROM 18 A SLICE_X36Y59 b'87e0391603dbcd98' -KEYROM 18 B SLICE_X36Y59 b'd162475ea83ba41e' -KEYROM 18 C SLICE_X36Y59 b'e96a30c8c9a69dee' -KEYROM 18 D SLICE_X36Y59 b'b784aa07e72f20ee' -KEYROM 19 A SLICE_X37Y59 b'd72f6063c4a01907' -KEYROM 19 B SLICE_X37Y59 b'6e0cc57509ce6d6f' -KEYROM 19 C SLICE_X37Y59 b'e233dc100d4e3e54' -KEYROM 19 D SLICE_X37Y59 b'28a2141b972b6bbc' -KEYROM 20 A SLICE_X36Y60 b'826fb656ffd25d16' -KEYROM 20 B SLICE_X36Y60 b'47e5620757db3f52' -KEYROM 20 C SLICE_X36Y60 b'f5a1f9e988eab0c8' -KEYROM 20 D SLICE_X36Y60 b'8b2116befb7e1423' -KEYROM 21 A SLICE_X37Y60 b'43451bfe64c37e24' -KEYROM 21 B SLICE_X37Y60 b'7c50d29284b3ba02' -KEYROM 21 C SLICE_X37Y60 b'34290a8b71ef119e' -KEYROM 21 D SLICE_X37Y60 b'903d0b912596bf0e' -KEYROM 22 A SLICE_X36Y61 b'7c31c6e85d7a8105' -KEYROM 22 B SLICE_X36Y61 b'efdd196db0845f15' -KEYROM 22 C SLICE_X36Y61 b'eb10887e3cae84ef' -KEYROM 22 D SLICE_X36Y61 b'5f3061ec5ccfddae' -KEYROM 23 A SLICE_X37Y61 b'433d32358bf3e698' -KEYROM 23 B SLICE_X37Y61 b'4675a35e71256f7e' -KEYROM 23 C SLICE_X37Y61 b'ea9987f2698c7150' -KEYROM 23 D SLICE_X37Y61 b'0ae4273d2013f794' -KEYROM 24 A SLICE_X36Y62 b'51635c76e2d84bba' -KEYROM 24 B SLICE_X36Y62 b'f2f34a2c68876a92' -KEYROM 24 C SLICE_X36Y62 b'df1b04e8ac3bc69f' -KEYROM 24 D SLICE_X36Y62 b'eb843f20abf196f7' -KEYROM 25 A SLICE_X37Y62 b'e0718e9fee6871e3' -KEYROM 25 B SLICE_X37Y62 b'fcb871d28134afb4' -KEYROM 25 C SLICE_X37Y62 b'37fa1361c1a9de1c' -KEYROM 25 D SLICE_X37Y62 b'21733538509598b4' -KEYROM 26 A SLICE_X36Y63 b'db2408270f3f92be' -KEYROM 26 B SLICE_X36Y63 b'b2446ed5ceee3603' -KEYROM 26 C SLICE_X36Y63 b'930832609ce506f8' -KEYROM 26 D SLICE_X36Y63 b'0dc4fa488dbe315d' -KEYROM 27 A SLICE_X37Y63 b'88eb940ccece20a6' -KEYROM 27 B SLICE_X37Y63 b'7447d754b6d33e8c' -KEYROM 27 C SLICE_X37Y63 b'0bc291fc56566c34' -KEYROM 27 D SLICE_X37Y63 b'3766fbd2ded140e5' -KEYROM 28 A SLICE_X36Y64 b'0ca4ff5d25722399' -KEYROM 28 B SLICE_X36Y64 b'e340e6be61d4f87f' -KEYROM 28 C SLICE_X36Y64 b'376f60c779ad2c7b' -KEYROM 28 D SLICE_X36Y64 b'0fe83d9799fe10a0' -KEYROM 29 A SLICE_X37Y64 b'00e1e3e09b504f3f' -KEYROM 29 B SLICE_X37Y64 b'a17f19b208724f8c' -KEYROM 29 C SLICE_X37Y64 b'2018adfa1f3ff97c' -KEYROM 29 D SLICE_X37Y64 b'c2b82e98be0ced1d' -KEYROM 30 A SLICE_X36Y65 b'7081b756a035ba6f' -KEYROM 30 B SLICE_X36Y65 b'd1f1f6164aaa4ea3' -KEYROM 30 C SLICE_X36Y65 b'7c6ec794ebbb27e0' -KEYROM 30 D SLICE_X36Y65 b'f2068eb22c6d95f9' -KEYROM 31 A SLICE_X37Y65 b'a4ac1a00520b69ae' -KEYROM 31 B SLICE_X37Y65 b'b012e7c57fe2967c' -KEYROM 31 C SLICE_X37Y65 b'6d6473c871acbcac' -KEYROM 31 D SLICE_X37Y65 b'0038adc3f3643aae' +KEYROM 0 A SLICE_X36Y50 b'b15b948858499af6' +KEYROM 0 B SLICE_X36Y50 b'7821752fbf541bd6' +KEYROM 0 C SLICE_X36Y50 b'7b5e83d85eca687a' +KEYROM 0 D SLICE_X36Y50 b'9a1699a88f642262' +KEYROM 1 A SLICE_X37Y50 b'bb039cd618157bcb' +KEYROM 1 B SLICE_X37Y50 b'8c46ea66e8e5e9d7' +KEYROM 1 C SLICE_X37Y50 b'0cd419ef497404c4' +KEYROM 1 D SLICE_X37Y50 b'c46ab62cc8c85dde' +KEYROM 2 A SLICE_X36Y51 b'd13a161dfe57d62b' +KEYROM 2 B SLICE_X36Y51 b'9c4c09dad1d7ff84' +KEYROM 2 C SLICE_X36Y51 b'28817088665f4f59' +KEYROM 2 D SLICE_X36Y51 b'721aded79246c10e' +KEYROM 3 A SLICE_X37Y51 b'3f2943ab982e9d86' +KEYROM 3 B SLICE_X37Y51 b'fc75e7bb90a30f64' +KEYROM 3 C SLICE_X37Y51 b'9e82e96a0aa963d2' +KEYROM 3 D SLICE_X37Y51 b'ced5b294d83fea26' +KEYROM 4 A SLICE_X36Y52 b'bade04cae8e713b5' +KEYROM 4 B SLICE_X36Y52 b'c3ccafa1f9a611b0' +KEYROM 4 C SLICE_X36Y52 b'a3823403d17c4782' +KEYROM 4 D SLICE_X36Y52 b'c4f9d11bd15ed764' +KEYROM 5 A SLICE_X37Y52 b'653ee33c41c5ace4' +KEYROM 5 B SLICE_X37Y52 b'868b0eabb87dac3f' +KEYROM 5 C SLICE_X37Y52 b'0ba3585e7d3004f4' +KEYROM 5 D SLICE_X37Y52 b'c5c433b7e222a49c' +KEYROM 6 A SLICE_X36Y53 b'001dbeb890c19249' +KEYROM 6 B SLICE_X36Y53 b'30b8f2df805daff3' +KEYROM 6 C SLICE_X36Y53 b'0641cfb851ec9853' +KEYROM 6 D SLICE_X36Y53 b'05ea4b5d42af6baf' +KEYROM 7 A SLICE_X37Y53 b'08caf1f3d7979abe' +KEYROM 7 B SLICE_X37Y53 b'9895c6d070175303' +KEYROM 7 C SLICE_X37Y53 b'9f79825ea460e6a4' +KEYROM 7 D SLICE_X37Y53 b'a8483aecf52b0475' +KEYROM 8 A SLICE_X36Y54 b'7de1009ad1b6cdca' +KEYROM 8 B SLICE_X36Y54 b'a10f1c2bbd72f667' +KEYROM 8 C SLICE_X36Y54 b'3ac098831fbb7b87' +KEYROM 8 D SLICE_X36Y54 b'4c71ca7f23bc6c82' +KEYROM 9 A SLICE_X37Y54 b'77e31b87a1888d3b' +KEYROM 9 B SLICE_X37Y54 b'38e1bb95230a1686' +KEYROM 9 C SLICE_X37Y54 b'822870083481a830' +KEYROM 9 D SLICE_X37Y54 b'e4a49bd21eb5daaa' +KEYROM 10 A SLICE_X36Y55 b'82db9d7cf1183a43' +KEYROM 10 B SLICE_X36Y55 b'53cb05695ff567e4' +KEYROM 10 C SLICE_X36Y55 b'a8cccfd47947b15a' +KEYROM 10 D SLICE_X36Y55 b'11f306d63e9d4495' +KEYROM 11 A SLICE_X37Y55 b'97cdf98f0b938daa' +KEYROM 11 B SLICE_X37Y55 b'8d1261af20f13f69' +KEYROM 11 C SLICE_X37Y55 b'd8aafd6c2dbea5b6' +KEYROM 11 D SLICE_X37Y55 b'1ae3210567e7d2dc' +KEYROM 12 A SLICE_X36Y56 b'3001c40510acbac5' +KEYROM 12 B SLICE_X36Y56 b'90fb6931ac1f58aa' +KEYROM 12 C SLICE_X36Y56 b'abde32073ed69435' +KEYROM 12 D SLICE_X36Y56 b'45e24850a2cabe38' +KEYROM 13 A SLICE_X37Y56 b'4132ecebf23bb952' +KEYROM 13 B SLICE_X37Y56 b'1c4e9600d860d044' +KEYROM 13 C SLICE_X37Y56 b'a90064999d321a43' +KEYROM 13 D SLICE_X37Y56 b'e71a9a76c55e99bb' +KEYROM 14 A SLICE_X36Y57 b'fe51d54d5a73cb7b' +KEYROM 14 B SLICE_X36Y57 b'28b9f3943c097696' +KEYROM 14 C SLICE_X36Y57 b'700de65df9dda4b8' +KEYROM 14 D SLICE_X36Y57 b'502b935ba5609210' +KEYROM 15 A SLICE_X37Y57 b'c96ce2c5d65e4334' +KEYROM 15 B SLICE_X37Y57 b'55f6ef5fb0dd034e' +KEYROM 15 C SLICE_X37Y57 b'af76d9a7e858a353' +KEYROM 15 D SLICE_X37Y57 b'01dc633bb76cb003' +KEYROM 16 A SLICE_X36Y58 b'67bdad785fbbb949' +KEYROM 16 B SLICE_X36Y58 b'bebef631eb4ea4f0' +KEYROM 16 C SLICE_X36Y58 b'98568d75da1e02fe' +KEYROM 16 D SLICE_X36Y58 b'1dd53e24dfaceb22' +KEYROM 17 A SLICE_X37Y58 b'5ed99284ca738350' +KEYROM 17 B SLICE_X37Y58 b'f3a69fb49f3a5334' +KEYROM 17 C SLICE_X37Y58 b'1b613146929e348f' +KEYROM 17 D SLICE_X37Y58 b'99b3ad406fe98155' +KEYROM 18 A SLICE_X36Y59 b'9de6d11fa6273f4b' +KEYROM 18 B SLICE_X36Y59 b'7d724052b870921d' +KEYROM 18 C SLICE_X36Y59 b'50b85a024e645a26' +KEYROM 18 D SLICE_X36Y59 b'7a6a4bfd4918e678' +KEYROM 19 A SLICE_X37Y59 b'9f3e9c3b7199917a' +KEYROM 19 B SLICE_X37Y59 b'259310ff58de4c72' +KEYROM 19 C SLICE_X37Y59 b'06acb3c84bbf63d6' +KEYROM 19 D SLICE_X37Y59 b'1e2c703f20977102' +KEYROM 20 A SLICE_X36Y60 b'9f883d2e25b3db08' +KEYROM 20 B SLICE_X36Y60 b'70035b7d6684da49' +KEYROM 20 C SLICE_X36Y60 b'78f8f5a7e97f9f35' +KEYROM 20 D SLICE_X36Y60 b'45e15cbcc5726838' +KEYROM 21 A SLICE_X37Y60 b'930b02de01c72f65' +KEYROM 21 B SLICE_X37Y60 b'1cc553eb5f198e87' +KEYROM 21 C SLICE_X37Y60 b'b9cf2883e45c00a4' +KEYROM 21 D SLICE_X37Y60 b'864deda8b37b29e9' +KEYROM 22 A SLICE_X36Y61 b'b347222bf51da1de' +KEYROM 22 B SLICE_X36Y61 b'6b0481128489fc68' +KEYROM 22 C SLICE_X36Y61 b'68ee272b741de7b9' +KEYROM 22 D SLICE_X36Y61 b'4dcd96093a3b5377' +KEYROM 23 A SLICE_X37Y61 b'cc71e20fc71ad4a2' +KEYROM 23 B SLICE_X37Y61 b'd54cca438b1b1197' +KEYROM 23 C SLICE_X37Y61 b'5389826854cdbcfc' +KEYROM 23 D SLICE_X37Y61 b'51ce8a49d1971bb5' +KEYROM 24 A SLICE_X36Y62 b'e62950ee65d30d45' +KEYROM 24 B SLICE_X36Y62 b'1aef2a0df61b18ab' +KEYROM 24 C SLICE_X36Y62 b'98eaf798bdb8c54d' +KEYROM 24 D SLICE_X36Y62 b'dc8b9929a63ea343' +KEYROM 25 A SLICE_X37Y62 b'a0e0d0d7a29cdbf7' +KEYROM 25 B SLICE_X37Y62 b'498a32d2b0a3b94e' +KEYROM 25 C SLICE_X37Y62 b'8811006afd09f8d8' +KEYROM 25 D SLICE_X37Y62 b'cc0120e789508a6c' +KEYROM 26 A SLICE_X36Y63 b'30af60e33bf7cd6a' +KEYROM 26 B SLICE_X36Y63 b'f7b935e1d1c1f381' +KEYROM 26 C SLICE_X36Y63 b'ade197ee470fe075' +KEYROM 26 D SLICE_X36Y63 b'ea42183a25f54bd7' +KEYROM 27 A SLICE_X37Y63 b'f00e6c1201b0ff73' +KEYROM 27 B SLICE_X37Y63 b'94a8a548d618bcb2' +KEYROM 27 C SLICE_X37Y63 b'e819d1f26fbcbb24' +KEYROM 27 D SLICE_X37Y63 b'37049aac3bfb56a9' +KEYROM 28 A SLICE_X36Y64 b'534e447baa64ee79' +KEYROM 28 B SLICE_X36Y64 b'162bea7553ffd73a' +KEYROM 28 C SLICE_X36Y64 b'19556384afa06a05' +KEYROM 28 D SLICE_X36Y64 b'875f9aaaaec6205c' +KEYROM 29 A SLICE_X37Y64 b'4e384b22934cf22d' +KEYROM 29 B SLICE_X37Y64 b'bc3b943960d28f26' +KEYROM 29 C SLICE_X37Y64 b'a3b351addce431ca' +KEYROM 29 D SLICE_X37Y64 b'af3441e6b7c6d2a0' +KEYROM 30 A SLICE_X36Y65 b'1d9780e85878e1fb' +KEYROM 30 B SLICE_X36Y65 b'395965439d6e1c90' +KEYROM 30 C SLICE_X36Y65 b'c6d3dde0e563edca' +KEYROM 30 D SLICE_X36Y65 b'a65dafc978fa9e28' +KEYROM 31 A SLICE_X37Y65 b'dfc6bf07c7ec553d' +KEYROM 31 B SLICE_X37Y65 b'2d5f5bf56a650782' +KEYROM 31 C SLICE_X37Y65 b'89f47f7f8e52e438' +KEYROM 31 D SLICE_X37Y65 b'7fa68ca830a7e48d' diff --git a/precursors/soc.svd b/precursors/soc.svd index 92f809719..4223bb566 100755 --- a/precursors/soc.svd +++ b/precursors/soc.svd @@ -3,7 +3,7 @@ litex SOC - + 8 32 @@ -1190,7 +1190,7 @@ register to disable individual events.]]> GIT_MAJOR +``v0.9.1``, so this value is ``0``.]]> 0x0008 0x00 32 @@ -1206,7 +1206,7 @@ register to disable individual events.]]> GIT_MINOR +``v0.9.1``, so this value is ``9``.]]> 0x000c 0x09 32 @@ -1222,9 +1222,9 @@ register to disable individual events.]]> GIT_REVISION +``v0.9.1``, so this value is ``1``.]]> 0x0010 - 0x00 + 0x01 32 @@ -1238,10 +1238,10 @@ register to disable individual events.]]> GIT_GITREV 0x0014 - 0x7528dee0 + 0xb481fff0 32 @@ -1258,7 +1258,7 @@ the exact git version used to build this firmware.]]> is ``1``, then the repository this was built from has one additional commit beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]> 0x0018 - 0x04 + 0x00 32 @@ -2508,10 +2508,26 @@ a forced suspend (e.g. a timeout happened and a server may be unclean.]]> - INTERRUPT + WFI 0x0020 0x00 32 + + + override + 0 + [0:0] + 0 + + + + + + INTERRUPT + 0x0024 + 0x00 + 32 interrupt @@ -2527,7 +2543,7 @@ suspend/resume from an interrupt context.]]> EV_STATUS - 0x0024 + 0x0028 0x00 32 @@ -2544,7 +2560,7 @@ Writes to this register have no effect.]]> EV_PENDING - 0x0028 + 0x002c 0x00 32 @@ -2562,7 +2578,7 @@ edge.]]> EV_ENABLE - 0x002c + 0x0030 0x00 32 @@ -2578,7 +2594,7 @@ register to disable individual events.]]> 0 - 0x30 + 0x34 registers @@ -3568,7 +3584,7 @@ inject too fast.]]> SEED1 0x0000 - 0x1b3a25e4 + 0x5e716c92 32 @@ -3583,7 +3599,7 @@ inject too fast.]]> SEED0 0x0004 - 0x7b69dedc + 0x7355f69a 32 diff --git a/precursors/soc_csr.bin b/precursors/soc_csr.bin index b22270f30..3341c0c95 100755 Binary files a/precursors/soc_csr.bin and b/precursors/soc_csr.bin differ diff --git a/services/keyboard/src/main.rs b/services/keyboard/src/main.rs index 99b34fac0..c5582fcce 100644 --- a/services/keyboard/src/main.rs +++ b/services/keyboard/src/main.rs @@ -861,6 +861,7 @@ fn xmain() -> ! { log::warn!("kbd server is overriding WFI for debugging, remember to disable for production"); llio.wfi_override(true).unwrap(); }*/ + let mut inject_esc = false; log::trace!("starting main loop"); loop { @@ -900,15 +901,46 @@ fn xmain() -> ! { Some(Opcode::SetChordInterval) => msg_scalar_unpack!(msg, delay, _, _, _, { kbd.set_chord_interval(delay as u32); }), - Some(Opcode::InjectKey) => msg_scalar_unpack!(msg, _k, _, _, _, { - let key = if let Some(a) = core::char::from_u32(_k as u32) { + Some(Opcode::InjectKey) => msg_scalar_unpack!(msg, k, _, _, _, { + // key substitutions to help things work better + // 5b31 = home + // 5b44 = left + // 5b43 = right + // 5b41 = up + // 5b42 = down + let k_prime = if !inject_esc { + match k { + 0x7f => 0x08, + 0x5b => { + inject_esc = true; + 0x00 + } + _ => k as u32 + } + } else { + inject_esc = false; + match k { + 0x31 => '∴' as u32, + 0x44 => '←' as u32, + 0x43 => '→' as u32, + 0x41 => '↑' as u32, + 0x42 => '↓' as u32, + _ => { + log::warn!("unknown escape sequence, ignoring: 0x5b{:x}", k); + 0 + } + } + }; + + let key = if let Some(a) = core::char::from_u32(k_prime) { a } else { + log::warn!("Uninterpreable key sequence, ignoring: 0x{:x}", k); '\u{0000}' }; log::trace!("got inject key, listener_conn: {:?}", listener_conn); if let Some(conn) = listener_conn { - info!("injecting key '{}'", key); // always be noisy about this, it's an exploit path + info!("injecting key '{}'({:x})", key, key as u32); // always be noisy about this, it's an exploit path xous::send_message(conn, xous::Message::new_scalar(listener_op.unwrap(), key as u32 as usize, diff --git a/services/llio/src/main.rs b/services/llio/src/main.rs index 8bd3c5441..a179d539d 100644 --- a/services/llio/src/main.rs +++ b/services/llio/src/main.rs @@ -242,6 +242,12 @@ mod implementation { } pub fn resume(&mut self) { self.power_susres.resume(); + + // reset these to "on" in case the "off" value was captured and stored on suspend + // (these "should" be redundant) + self.power_csr.rmwf(utra::power::POWER_SELF, 1); + self.power_csr.rmwf(utra::power::POWER_STATE, 1); + self.event_susres.resume(); self.gpio_susres.resume(); // restore the UART mux setting after resume diff --git a/services/shellchat/src/cmds/trng_cmd.rs b/services/shellchat/src/cmds/trng_cmd.rs index 42fc7b2fa..ec19ebbd6 100644 --- a/services/shellchat/src/cmds/trng_cmd.rs +++ b/services/shellchat/src/cmds/trng_cmd.rs @@ -34,7 +34,7 @@ impl<'a> ShellCmdApi<'a> for TrngCmd { let ht = env.trng.get_health_tests().unwrap(); for core in 0..4 { write!(ret, "RO {}: ", core).unwrap(); - for bin in 0..5 { + for bin in 0..4 { write!(ret, "{} ", ht.ro_miniruns[core].run_count[bin]).unwrap(); } write!(ret, "\n").unwrap(); diff --git a/services/susres/src/main.rs b/services/susres/src/main.rs index 30050e9ef..cc3750d4b 100644 --- a/services/susres/src/main.rs +++ b/services/susres/src/main.rs @@ -61,7 +61,7 @@ mod implementation { // on a clean suspend then resume, the loader will queue up this interrupt to be the first thing to // run on Xous resume, with a bit in the RESUME register set. fn susres_handler(_irq_no: usize, arg: *mut usize) { - println!("susres handler"); + //println!("susres handler"); let sr = unsafe{ &mut *(arg as *mut SusResHw) }; // clear the pending interrupt sr.csr.wfo(utra::susres::EV_PENDING_SOFT_INT, 1); @@ -73,7 +73,7 @@ mod implementation { } if sr.csr.rf(utra::susres::STATE_RESUME) == 0 { - println!("going into suspend"); + //println!("going into suspend"); if false { // this is just for testing, doing a quick full-soc boot instead of a power down let mut reboot_csr = CSR::new(REBOOT_CSR.load(Ordering::Relaxed) as *mut u32); reboot_csr.wfo(utra::reboot::SOC_RESET_SOC_RESET, 0xAC); @@ -87,12 +87,14 @@ mod implementation { } } + // prevent re-ordering + core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::Acquire); // power the system down - this should result in an almost immediate loss of power - sr.csr.wfo(utra::susres::POWERDOWN_POWERDOWN, 1); - - loop {} // block forever here + loop { + sr.csr.wfo(utra::susres::POWERDOWN_POWERDOWN, 1); + } // block forever here } else { - println!("going into resume"); + //println!("going into resume"); // this unblocks the threads waiting on the resume SHOULD_RESUME.store(true, Ordering::Relaxed); } @@ -192,6 +194,12 @@ mod implementation { sr } + pub fn ignore_wfi(&mut self) { + self.csr.wfo(utra::susres::WFI_OVERRIDE, 1); + } + pub fn restore_wfi(&mut self) { + self.csr.wfo(utra::susres::WFI_OVERRIDE, 0); + } pub fn reboot(&mut self, reboot_soc: bool) { if reboot_soc { @@ -217,7 +225,7 @@ mod implementation { xous::syscall::map_memory( None, None, - 128 * 1024, // this matches a 128k L2 cache + 512 * 1024, // L2 cache is 128k, but emperically it doesn't fully flush until 512k is written. Maybe has to do with write-back behavior?? xous::MemoryFlags::R | xous::MemoryFlags::W | xous::MemoryFlags::RESERVE, ).expect("couldn't allocate RAM for cache flushing") ); @@ -419,6 +427,8 @@ mod implementation { xous::Message::new_scalar(crate::TimeoutOpcode::SetCsr.to_usize().unwrap(), 0, 0, 0, 0) ).map(|_| ()) } + pub fn ignore_wfi(&mut self) {} + pub fn restore_wfi(&mut self) {} } } @@ -636,6 +646,7 @@ fn xmain() -> ! { // this now allows all other threads to commence log::trace!("low-level resume done, restoring execution"); RESUME_EXEC.store(true, Ordering::Relaxed); + susres_hw.restore_wfi(); } else { log::trace!("still waiting on callbacks, returning to main loop"); } @@ -647,6 +658,7 @@ fn xmain() -> ! { // if the 2-second timeout is still pending from a previous suspend, deny the suspend request. // ...just don't suspend that quickly after resuming??? if allow_suspend && !timeout_pending { + susres_hw.ignore_wfi(); suspend_requested = true; // clear the resume gate SHOULD_RESUME.store(false, Ordering::Relaxed); @@ -665,8 +677,9 @@ fn xmain() -> ! { ).expect("couldn't initiate timeout before suspend!"); send_event(&suspend_subscribers); + } else { + log::warn!("suspend requested, but the system was not allowed to suspend. Ignoring request.") } - // denied requests just silently fail. }, Some(Opcode::SuspendTimeout) => { if timeout_pending { diff --git a/tools/update_ci.sh b/tools/update_ci.sh index 9be0a7e34..f7b737f9a 100755 --- a/tools/update_ci.sh +++ b/tools/update_ci.sh @@ -22,6 +22,6 @@ rm /tmp/soc_csr.bin echo "waiting for device to reboot" sleep 5 -wget https://ci.betrusted.io/latest-ci/bt-ec.bin -O /tmp/bt-ec.bin -./usb_update.py -e /tmp/bt-ec.bin -rm /tmp/bt-ec.bin +wget https://ci.betrusted.io/latest-ci/ec_fw.bin -O /tmp/ec_fw.bin +./usb_update.py -e /tmp/ec_fw.bin +rm /tmp/ec_fw.bin