aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / omega / platform / readback.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note Spark DSDT resource reader. No AML evaluator, mapping, register access or writes. |
| 3 | note Single consumer; transport supplies an acknowledged READ, never an arbitrary address. |
| 4 | note State: pending,sequence,space,address,bits,raw,valid,last-sequence. |
| 5 | global Pl ulong 8 |
| 6 | |
| 7 | fn pladdr zone ulong to ulong |
| 8 | if eq zone 0 |
| 9 | ret 472090648 |
| 10 | end |
| 11 | if lt zone 7 |
| 12 | ret add 472090652 mul zone 4 |
| 13 | end |
| 14 | ret 0 |
| 15 | end |
| 16 | |
| 17 | note CPPC fields are Linux cppc_regs indexes, excluding every writable control. |
| 18 | fn ploff field ulong to ulong |
| 19 | if lt field 5 |
| 20 | ret mul field 4 |
| 21 | end |
| 22 | if eq field 10 |
| 23 | ret 40 |
| 24 | end |
| 25 | if eq field 13 |
| 26 | ret 44 |
| 27 | end |
| 28 | if and ge field 18 le field 20 |
| 29 | ret add 88 mul sub field 18 4 |
| 30 | end |
| 31 | ret 4294967295 |
| 32 | end |
| 33 | |
| 34 | note kind 0 thermal, kind 1 CPPC; space 0 SystemMemory, space 127 FFixedHW. |
| 35 | note Return 0 ready, 1 unsupported, 2 pending, 3 invalid sequence or ACK, 4 I/O failure. |
| 36 | fn plstart kind ulong unit ulong field ulong seq ulong to uint |
| 37 | if ne get Pl 0 0 |
| 38 | ret 2 |
| 39 | end |
| 40 | put Pl 5 0 |
| 41 | put Pl 6 0 |
| 42 | if or eq seq 0 le seq get Pl 7 |
| 43 | ret 3 |
| 44 | end |
| 45 | addr = ulong 0 |
| 46 | space = ulong 0 |
| 47 | bits = ulong 32 |
| 48 | if eq kind 0 |
| 49 | if ne field 0 |
| 50 | ret 1 |
| 51 | end |
| 52 | addr = pladdr unit |
| 53 | if eq addr 0 |
| 54 | ret 1 |
| 55 | end |
| 56 | else |
| 57 | if ne kind 1 |
| 58 | ret 1 |
| 59 | end |
| 60 | if ge unit 20 |
| 61 | ret 1 |
| 62 | end |
| 63 | if or eq field 11 eq field 12 |
| 64 | space = 127 |
| 65 | bits = 64 |
| 66 | addr = sub 12 field |
| 67 | else |
| 68 | off = ploff field |
| 69 | if eq off 4294967295 |
| 70 | ret 1 |
| 71 | end |
| 72 | addr = add add 85771268 mul unit 232 off |
| 73 | end |
| 74 | end |
| 75 | put Pl 0 1 |
| 76 | put Pl 1 seq |
| 77 | put Pl 2 space |
| 78 | put Pl 3 addr |
| 79 | put Pl 4 bits |
| 80 | put Pl 7 seq |
| 81 | ret 0 |
| 82 | end |
| 83 | |
| 84 | note ACK must match the complete outstanding READ descriptor. A bad ACK consumes it. |
| 85 | note raw is an unsigned native word; 32-bit reads cannot smuggle high bits. |
| 86 | fn plack seq ulong space ulong addr ulong bits ulong raw ulong ok ulong to uint |
| 87 | put Pl 5 0 |
| 88 | put Pl 6 0 |
| 89 | if eq get Pl 0 0 |
| 90 | ret 3 |
| 91 | end |
| 92 | put Pl 0 0 |
| 93 | if or ne seq get Pl 1 ne space get Pl 2 |
| 94 | ret 3 |
| 95 | end |
| 96 | if or ne addr get Pl 3 ne bits get Pl 4 |
| 97 | ret 3 |
| 98 | end |
| 99 | if ne ok 1 |
| 100 | ret 4 |
| 101 | end |
| 102 | if eq bits 32 |
| 103 | if gt raw 4294967295 |
| 104 | ret 3 |
| 105 | end |
| 106 | end |
| 107 | put Pl 5 raw |
| 108 | put Pl 6 1 |
| 109 | ret 0 |
| 110 | end |