Compare commits
1031 Commits
edk2-stabl
...
edk2-stabl
Author | SHA1 | Date | |
---|---|---|---|
|
b24306f15d | ||
|
8a57673316 | ||
|
c28e376edc | ||
|
85589ddbf6 | ||
|
1193aa2dfb | ||
|
42af706dfb | ||
|
c9b7c6e0cc | ||
|
b360b0b589 | ||
|
1f54eaa725 | ||
|
bd676f080a | ||
|
96b8b5fd10 | ||
|
f78b937c95 | ||
|
d4ac53aa91 | ||
|
c09dbc92e9 | ||
|
6fb09da89f | ||
|
a4b7aa362d | ||
|
33189f0527 | ||
|
007a95055b | ||
|
45b1612659 | ||
|
017564d637 | ||
|
5b3c682d91 | ||
|
17a02163bd | ||
|
312ef7a0a4 | ||
|
0dbd356983 | ||
|
dc1118fa0d | ||
|
5816bd3eab | ||
|
5751d60821 | ||
|
13136cc311 | ||
|
742dafd2cc | ||
|
103fa647d1 | ||
|
ba79becd55 | ||
|
49a2d8cbf5 | ||
|
55c05427b9 | ||
|
336da55ca8 | ||
|
7f25ddbc03 | ||
|
929804b172 | ||
|
e95b44c90e | ||
|
862ea6e836 | ||
|
ae35314e7b | ||
|
8542fc5f95 | ||
|
76b3d45b75 | ||
|
f4b7b473b4 | ||
|
a867f3a704 | ||
|
6777e67383 | ||
|
8cc5590eab | ||
|
1aa1ec4574 | ||
|
541a077bd1 | ||
|
ce37f45955 | ||
|
5b39832e18 | ||
|
ee67067f17 | ||
|
7e5c603cba | ||
|
21320ef669 | ||
|
7709988dd8 | ||
|
772c5bb8dc | ||
|
5801910013 | ||
|
59c48c9314 | ||
|
5302bd81d9 | ||
|
b66056ef21 | ||
|
e73d1bf96a | ||
|
7b6cbe0a81 | ||
|
196be601f9 | ||
|
71082d3d1b | ||
|
fdcea7ff6f | ||
|
1552050ce7 | ||
|
6ecdda71fe | ||
|
a2da72b2ca | ||
|
c712ce2bb1 | ||
|
7438a85bf1 | ||
|
6062002bd5 | ||
|
14a731096d | ||
|
9dd14fc91c | ||
|
079a58276b | ||
|
13d9e8ec98 | ||
|
45920941d9 | ||
|
d463c56ddd | ||
|
c095122d4b | ||
|
7935be0fbd | ||
|
e910f076ad | ||
|
6612ff8561 | ||
|
15c596aeeb | ||
|
ae8272ef78 | ||
|
9ec2cc1f31 | ||
|
de9e5b7dc7 | ||
|
ee1f8262b8 | ||
|
f129b1f06f | ||
|
c63a10ecb7 | ||
|
ab5ab2f603 | ||
|
195f011973 | ||
|
8ed8568922 | ||
|
b451c69088 | ||
|
45e3842970 | ||
|
a6c0418651 | ||
|
e6ea1464a8 | ||
|
4de8d61bce | ||
|
b819388772 | ||
|
5711ff4d0b | ||
|
b47575801e | ||
|
3a72ec71cd | ||
|
f14fff5135 | ||
|
38f6d78c3b | ||
|
5fe5b6f94f | ||
|
740e3bb634 | ||
|
2e2db65e39 | ||
|
b2d0ed20fd | ||
|
9006967c8d | ||
|
deb01dfd7f | ||
|
c67bf628c8 | ||
|
26bf034a59 | ||
|
7b6c8b30a5 | ||
|
d250d408cf | ||
|
b04cf355a0 | ||
|
0fa1217726 | ||
|
e366a41ef0 | ||
|
51941f7558 | ||
|
3ebe1ff5c9 | ||
|
8d2691c3d5 | ||
|
5d8b5d171c | ||
|
d59c5a20f8 | ||
|
90ad4b3b34 | ||
|
c039fa7ff0 | ||
|
4d30352445 | ||
|
7a6e6ae933 | ||
|
41d8bb3038 | ||
|
759e3c6d21 | ||
|
557dede8a6 | ||
|
ec37fd9c1f | ||
|
e35a746cf5 | ||
|
ce306e48eb | ||
|
69ddfee1c3 | ||
|
b2b8def4e3 | ||
|
fd5fc4bbb7 | ||
|
0e7147fe75 | ||
|
7f1861be2b | ||
|
e07d27e24d | ||
|
2a68abf6ee | ||
|
c802f8935c | ||
|
79dcaf7054 | ||
|
64ef0dd1d3 | ||
|
1203eba58e | ||
|
2722856a87 | ||
|
8b8ae609a7 | ||
|
04eacd3943 | ||
|
64bccda534 | ||
|
21ee379407 | ||
|
61be49e0f7 | ||
|
2686468c43 | ||
|
adf070ff56 | ||
|
8c06c53b58 | ||
|
a124cd4ef9 | ||
|
d5efc875ef | ||
|
2b20a34fd5 | ||
|
f6df289a1c | ||
|
7594c5bfe2 | ||
|
66bce05f6d | ||
|
d8ef774346 | ||
|
2ccefa32a6 | ||
|
9afcd48a94 | ||
|
e81a81e584 | ||
|
e139829dd6 | ||
|
b2bbe3df54 | ||
|
8cf2bdfcfb | ||
|
a50b65ce22 | ||
|
0077c22f6d | ||
|
30631f0a26 | ||
|
0f1d7477c0 | ||
|
06544455d0 | ||
|
67484aed69 | ||
|
ea3a12d970 | ||
|
b7b8872031 | ||
|
b928eb44d5 | ||
|
d4d7c9ad5f | ||
|
9c703bc0f1 | ||
|
2c354252be | ||
|
f5a6e1bab5 | ||
|
f4e3ce5f53 | ||
|
b95908e043 | ||
|
504ae26b80 | ||
|
26210f9436 | ||
|
8eb79b5f4f | ||
|
202fb22be6 | ||
|
d39f8d88ec | ||
|
11b15336f0 | ||
|
d706f8fec2 | ||
|
ade62c18f4 | ||
|
19914edc5a | ||
|
a19b648952 | ||
|
d2b998fbdc | ||
|
7c3b2892ea | ||
|
d9822304ce | ||
|
34819f2cac | ||
|
f2dc28f0b6 | ||
|
cca9cd3dd6 | ||
|
707c71a01b | ||
|
3053183d41 | ||
|
2fe8edfe55 | ||
|
e2289d19d8 | ||
|
2ddacfb6b8 | ||
|
c82ab4d8c1 | ||
|
d25b803e51 | ||
|
7b28310008 | ||
|
85a678bf76 | ||
|
965292135b | ||
|
ffdde9d719 | ||
|
2527723de9 | ||
|
94e0a7bddb | ||
|
b2f7ee2ded | ||
|
ca78281c25 | ||
|
1832eb15aa | ||
|
dc453b5164 | ||
|
7c0ad2c338 | ||
|
e5efcf8be8 | ||
|
053e878bfb | ||
|
91415a36ae | ||
|
c1e126b119 | ||
|
b878648967 | ||
|
47d20b54f9 | ||
|
c411b485b6 | ||
|
39de741e2d | ||
|
5220bd211d | ||
|
ac0a286f4d | ||
|
d1050b9dff | ||
|
2f88bd3a12 | ||
|
1436aea4d5 | ||
|
7c7184e201 | ||
|
111f2228dd | ||
|
45ce0a67bb | ||
|
bcdcc4160d | ||
|
a550d468a6 | ||
|
e7108d0e96 | ||
|
731c67e1d7 | ||
|
7c34237831 | ||
|
2b16a4fb91 | ||
|
40b0b23ed3 | ||
|
429309e0c6 | ||
|
7c2a6033c1 | ||
|
f9f4fb2329 | ||
|
deba54761a | ||
|
8e875037bf | ||
|
ed7f7c9168 | ||
|
098307e082 | ||
|
db52c7f755 | ||
|
4a9d411662 | ||
|
e3b855f283 | ||
|
ea85f0fe13 | ||
|
78bc3bdd2a | ||
|
e35dd32821 | ||
|
4ec586b9f6 | ||
|
902e76de19 | ||
|
f9c9215b55 | ||
|
18908e6131 | ||
|
9b8507cabe | ||
|
12710fe93b | ||
|
dc8fe5ec95 | ||
|
237295f46d | ||
|
79d49e162e | ||
|
8874fa199d | ||
|
d0e2f8232a | ||
|
e3917e22e7 | ||
|
9c721071d3 | ||
|
c69fc80c80 | ||
|
792433088c | ||
|
fe2d81892f | ||
|
c8f46130f8 | ||
|
9607597a74 | ||
|
2863ba97ca | ||
|
1871d28eaf | ||
|
96e1cba5c1 | ||
|
586fda4800 | ||
|
4a1aee13d8 | ||
|
e905fbb05a | ||
|
ca56749b0e | ||
|
47719926e8 | ||
|
c49ca4a29e | ||
|
5f289f3ae3 | ||
|
87000d7708 | ||
|
917e98f3e5 | ||
|
9c7da8d804 | ||
|
a1878955b2 | ||
|
c5b3a56e4f | ||
|
1d2482e1e3 | ||
|
a4a582e180 | ||
|
dfafa8e453 | ||
|
f0f3f5aae7 | ||
|
c057347977 | ||
|
c30c40d6c6 | ||
|
9944508e85 | ||
|
60fa40be45 | ||
|
df790cd6b3 | ||
|
9deb937076 | ||
|
d7d30e8f21 | ||
|
d5744ecba8 | ||
|
c97fee87f0 | ||
|
1939fc9569 | ||
|
365dced2c3 | ||
|
76a1ce4d5f | ||
|
99f84ff473 | ||
|
3019f1bbab | ||
|
854462bd34 | ||
|
69877614fd | ||
|
ef9a059cdb | ||
|
bb1bba3d77 | ||
|
4c7ce0d285 | ||
|
e1e7306b54 | ||
|
455b0347a7 | ||
|
466ebdd2e0 | ||
|
4c495e5e3d | ||
|
a92559671a | ||
|
22c3b5a865 | ||
|
8c8867c5da | ||
|
f826b20811 | ||
|
a7b35aae13 | ||
|
aab6bb3d32 | ||
|
c974257821 | ||
|
d6e6337cd6 | ||
|
8c1b1fe634 | ||
|
fd42dcb1fc | ||
|
d939a25d41 | ||
|
45137bca2f | ||
|
77dcd03ecf | ||
|
f331310a10 | ||
|
5948ec3647 | ||
|
48452993ad | ||
|
b5d4a35d90 | ||
|
d79df34beb | ||
|
4050c873b5 | ||
|
15e635d1b5 | ||
|
b0a03ca4a9 | ||
|
c1f2287635 | ||
|
e13e53cb2f | ||
|
0f4cdad25b | ||
|
b258f12889 | ||
|
6f9e83f757 | ||
|
939c2355da | ||
|
c8594a5311 | ||
|
91b772ab62 | ||
|
e7663fdd82 | ||
|
1bc232aae3 | ||
|
bb146ce32d | ||
|
9a95d11023 | ||
|
2f6f3329ad | ||
|
b80c17b62d | ||
|
242dcfe30f | ||
|
ae8acce8ae | ||
|
04714cef46 | ||
|
1d66480aa4 | ||
|
bed990aae6 | ||
|
e7e8ea27d4 | ||
|
87a34ca0cf | ||
|
8b76f23534 | ||
|
c9ec74a198 | ||
|
5a2411784b | ||
|
f079e9b450 | ||
|
6254037223 | ||
|
bd5ec03d87 | ||
|
2f286930a8 | ||
|
305fd6bee0 | ||
|
99325a8b65 | ||
|
6893865b30 | ||
|
4fdf843c75 | ||
|
37a33f02aa | ||
|
90246a6d9f | ||
|
6ef5797447 | ||
|
91a978ce7e | ||
|
36b561623a | ||
|
11a4af85a4 | ||
|
2108698346 | ||
|
f10a112f08 | ||
|
7e43d3e086 | ||
|
785cfd3305 | ||
|
f2400e06db | ||
|
e0c23cba5e | ||
|
b21c6794de | ||
|
9a7509e465 | ||
|
c6770f4b88 | ||
|
26aa241d2f | ||
|
f8d0501ded | ||
|
47bd85e9f9 | ||
|
d881c6ddf5 | ||
|
77e9b3a7c6 | ||
|
7d78a86ecf | ||
|
fb759b8b73 | ||
|
e40fefafa9 | ||
|
a7fcab7aa3 | ||
|
43b3840873 | ||
|
978d428ec3 | ||
|
6ed6abd6c1 | ||
|
4225a464c6 | ||
|
f22feb0e3b | ||
|
ba4ae92234 | ||
|
782d018703 | ||
|
19ee56c4b3 | ||
|
769e63999f | ||
|
f17ef10e63 | ||
|
a5e36ad9bc | ||
|
018a962d92 | ||
|
3e958e93ce | ||
|
e2d7b4950b | ||
|
de62ccbf4f | ||
|
ce15936f2f | ||
|
12e65fd258 | ||
|
1e33479b39 | ||
|
9454d1ebcb | ||
|
f995f8672b | ||
|
6d2777d85f | ||
|
37bd08176c | ||
|
2dd7dd3952 | ||
|
7b2022d39e | ||
|
74addfeab6 | ||
|
28b2df475f | ||
|
bfaf7c8b9e | ||
|
25cf58a163 | ||
|
71c3c9c0c4 | ||
|
30400318a2 | ||
|
5ece2ad36c | ||
|
b4da6c29f1 | ||
|
80e67bcb23 | ||
|
942c9bd357 | ||
|
f09dbf20b9 | ||
|
06a326caf1 | ||
|
862e814de4 | ||
|
55f47d2299 | ||
|
8456785986 | ||
|
2c467c9be2 | ||
|
1d3e89f349 | ||
|
bf02d73e74 | ||
|
8583b57c5c | ||
|
6a8e9ad24b | ||
|
76602f45dc | ||
|
27de86ae41 | ||
|
b9dd64b80e | ||
|
6073bf6cd8 | ||
|
06fa1f1931 | ||
|
0569c52b15 | ||
|
60d55c4156 | ||
|
2a49c19b9e | ||
|
4932f05a00 | ||
|
606340fba3 | ||
|
c806b76865 | ||
|
b3685956d2 | ||
|
282122ec5f | ||
|
c49cb8f30e | ||
|
4cc1458dbe | ||
|
22873f58c4 | ||
|
691c5f7762 | ||
|
7a8c037e9e | ||
|
235ff9fcd1 | ||
|
96e006b37e | ||
|
72ab552554 | ||
|
653113412f | ||
|
1ad5182500 | ||
|
20775950c6 | ||
|
0875443f7e | ||
|
422e5d2f7f | ||
|
2273799677 | ||
|
9e950cda6a | ||
|
8b4bb94f64 | ||
|
f86de75862 | ||
|
bd298d7593 | ||
|
8ab8fbc016 | ||
|
b8675deaa8 | ||
|
499c4608b1 | ||
|
442e46d3b6 | ||
|
c7d5b046d9 | ||
|
445c39f757 | ||
|
259c184c8f | ||
|
c214128a38 | ||
|
1ce6ceb75b | ||
|
2ea0a0a414 | ||
|
4a1899dd79 | ||
|
dc430ccf3f | ||
|
cc5a67269e | ||
|
b0f1b1c5fd | ||
|
f57040b038 | ||
|
46b4606ba2 | ||
|
d60915b751 | ||
|
7ea7f9c077 | ||
|
c0cd26f43c | ||
|
f2a7e24e38 | ||
|
fdeff3fdae | ||
|
79019c7a42 | ||
|
f334c5a41d | ||
|
542cba73d2 | ||
|
e3e47d7963 | ||
|
ac6388add4 | ||
|
60d8bb9f28 | ||
|
89f7ed8b29 | ||
|
010753b7e7 | ||
|
bda3546c55 | ||
|
f4e72cf9d6 | ||
|
c19d18136e | ||
|
6f501a7c9b | ||
|
6c80564b89 | ||
|
3b69fcf5f8 | ||
|
2fa89c8e11 | ||
|
a4867dea2a | ||
|
f108178c56 | ||
|
2906e572c6 | ||
|
ebbc8ab2cd | ||
|
4d5f39cd22 | ||
|
610d8073f2 | ||
|
dcd3d63f4f | ||
|
d96df7e993 | ||
|
cf7c650592 | ||
|
6c7d6d4a5e | ||
|
d248516b3a | ||
|
851785ea67 | ||
|
a7cf2c5664 | ||
|
4473834e7d | ||
|
edf8bc6d24 | ||
|
81d71fb86e | ||
|
c5e805ffe1 | ||
|
b6bc203375 | ||
|
e3ee8c8dbd | ||
|
63fddc98e0 | ||
|
12e33dca4c | ||
|
b170806518 | ||
|
3b3f882288 | ||
|
cdda3f74a1 | ||
|
5d34cc49d5 | ||
|
f0fe55bca4 | ||
|
9f3eda177a | ||
|
5b5f10d746 | ||
|
52e2dabc0f | ||
|
28152333bc | ||
|
cb0d24637d | ||
|
cae735f613 | ||
|
0f11537548 | ||
|
443300be46 | ||
|
dc995ce906 | ||
|
b04453d36b | ||
|
77d5fa8024 | ||
|
ae12188cf8 | ||
|
6a3e9576b8 | ||
|
537a724421 | ||
|
212a2b9bb8 | ||
|
08293e43da | ||
|
94e465e5cb | ||
|
a82bad9730 | ||
|
b9af5037b2 | ||
|
ab77b6031b | ||
|
80e67af9af | ||
|
8b15024dc7 | ||
|
82f7e315d6 | ||
|
7b4a99be8a | ||
|
8dd4fc5be6 | ||
|
ef56f55d19 | ||
|
6fdd1c13a7 | ||
|
ac826886c9 | ||
|
a776bbabd9 | ||
|
b7f0226a46 | ||
|
ca1773878d | ||
|
aee0098faf | ||
|
03e19e6bc8 | ||
|
7311e96417 | ||
|
3d359ff905 | ||
|
605c4a1ff2 | ||
|
1803757a9b | ||
|
75c4a8e10d | ||
|
0938f9235c | ||
|
7b17bcd9a0 | ||
|
357383bc4f | ||
|
c82d6dd4a3 | ||
|
ced4cb7609 | ||
|
ad3dea9861 | ||
|
d910e83299 | ||
|
4d7137f261 | ||
|
5963ce5d28 | ||
|
a7ddc7847c | ||
|
d02dbb53cd | ||
|
672bd1c711 | ||
|
ac6e5d6b41 | ||
|
d497eace3b | ||
|
b40bdd6ecd | ||
|
3c6107758b | ||
|
4de77ae989 | ||
|
97fdcbda4e | ||
|
0856cdc89e | ||
|
9abc60f9f7 | ||
|
6355287206 | ||
|
55266a9b8a | ||
|
45f3dd2ce9 | ||
|
19107590b6 | ||
|
94e065582b | ||
|
a97e9e327e | ||
|
db959018b6 | ||
|
b926956418 | ||
|
3d427c5f83 | ||
|
12a4d0cb9d | ||
|
9732659698 | ||
|
bb806a6e88 | ||
|
2b47aaecef | ||
|
03e77558d4 | ||
|
fc50df0d8e | ||
|
0b1b0a9674 | ||
|
2e1fb41339 | ||
|
3445058aea | ||
|
610bcc69ed | ||
|
8e6bb64fe4 | ||
|
514b3aa08e | ||
|
385b9d80a0 | ||
|
0deeab36d1 | ||
|
5ace477f34 | ||
|
d10ad8444f | ||
|
6bf5580a3d | ||
|
c73e31f54d | ||
|
0cb48007f7 | ||
|
a26a08dc1f | ||
|
35e267cb34 | ||
|
f05eb2dfe5 | ||
|
dc485c556d | ||
|
7f05102f65 | ||
|
b461d67639 | ||
|
ab796d3e2a | ||
|
ac70e71b1f | ||
|
147f34b56c | ||
|
878a92a887 | ||
|
4d28a1c2fd | ||
|
332632abf3 | ||
|
2f5ad3f451 | ||
|
28ef05ce10 | ||
|
8781b143de | ||
|
391cffcb61 | ||
|
097aeeb119 | ||
|
c32c5911c4 | ||
|
83b43c4cb1 | ||
|
885efcd3f9 | ||
|
fddb8d24ec | ||
|
4bac086e8e | ||
|
cac83b6f3b | ||
|
be282b1493 | ||
|
91f5d3b410 | ||
|
d0b6596b8e | ||
|
9bf4aee734 | ||
|
7d748705b1 | ||
|
fda5226aa3 | ||
|
fb5b6220a9 | ||
|
50672d2692 | ||
|
a050c599df | ||
|
22fe311bd2 | ||
|
40a9066439 | ||
|
3de3c24755 | ||
|
ad1009ec62 | ||
|
5ef08a49e3 | ||
|
b491eace37 | ||
|
84af6ea320 | ||
|
cc89d245f9 | ||
|
f47c4676dd | ||
|
b560e9d9b6 | ||
|
0e3b6bd0ee | ||
|
c28fc8ab3b | ||
|
31fcee6d99 | ||
|
4c051c2c65 | ||
|
d10e058016 | ||
|
0a6b303dce | ||
|
b3db0cb1f8 | ||
|
44ced03798 | ||
|
1e0c441c92 | ||
|
fea7901dba | ||
|
8697dc60cc | ||
|
bb33c27fbe | ||
|
47fea2abcb | ||
|
903ce1d8f8 | ||
|
7b6c2b2a26 | ||
|
7eba9f698e | ||
|
49eeda113a | ||
|
3cde0d553d | ||
|
939ed3a592 | ||
|
580b11201e | ||
|
55dee4947b | ||
|
b37cfdd280 | ||
|
9421f5ab8d | ||
|
cf20302474 | ||
|
24b0e9d128 | ||
|
932449710c | ||
|
5a2e030f73 | ||
|
d1fc3d7ef3 | ||
|
27b8a52957 | ||
|
abfff7c45d | ||
|
17143c4837 | ||
|
f0a3f6d9c3 | ||
|
333a866106 | ||
|
19a541d70e | ||
|
8efd912baf | ||
|
caa139fe17 | ||
|
3eb72b308a | ||
|
2db0ed93ff | ||
|
86e6948cfb | ||
|
6b69f73b59 | ||
|
27cb64fffc | ||
|
b208d37c73 | ||
|
0ff6de9358 | ||
|
d63595c3c9 | ||
|
a75c029f60 | ||
|
ea0bd5f6a7 | ||
|
82f727c4af | ||
|
12e34cd2f7 | ||
|
eba32695ee | ||
|
18b2272e4d | ||
|
20ca528828 | ||
|
7471751a4d | ||
|
1e5e58d39b | ||
|
4dda0f7ab4 | ||
|
5959879e92 | ||
|
d9a7612f8d | ||
|
6cfeeb71c4 | ||
|
a63914d3f6 | ||
|
1162ae8297 | ||
|
2847c72fda | ||
|
cdf7544703 | ||
|
04ddd1271e | ||
|
610385fa3b | ||
|
9cf9de668f | ||
|
1b380aa603 | ||
|
ab2b389e7a | ||
|
fe471d4a57 | ||
|
c511426abe | ||
|
fa24b6ed26 | ||
|
8c0d678063 | ||
|
761329ee27 | ||
|
75293330ea | ||
|
302a8f353c | ||
|
70e8c9c3bc | ||
|
9d53e01efe | ||
|
99de2e7e03 | ||
|
b597b6e24c | ||
|
d8c18ba3f4 | ||
|
d58016b768 | ||
|
11b1c1d4b9 | ||
|
1ad794b627 | ||
|
288bd74a22 | ||
|
b8649cf2a3 | ||
|
54e90edaed | ||
|
47b76780b4 | ||
|
dc469f1371 | ||
|
d90fff40cb | ||
|
cf01b2dc8f | ||
|
e8f28b09e6 | ||
|
95616b8661 | ||
|
29cab43bb7 | ||
|
83761337ec | ||
|
702ba436ed | ||
|
beb443fde0 | ||
|
558d83ab1a | ||
|
ddb3fdbef3 | ||
|
51adb689e1 | ||
|
ce270905bf | ||
|
d4a8aaee73 | ||
|
9d84e74ca0 | ||
|
a8ab14424e | ||
|
4db374562f | ||
|
5072593738 | ||
|
7e25086a00 | ||
|
8af38170b5 | ||
|
4c81178cf0 | ||
|
33d4f3e39e | ||
|
242678da2a | ||
|
307763c3da | ||
|
c2f24ba321 | ||
|
e120c962f5 | ||
|
32fef03563 | ||
|
984c93ece3 | ||
|
8c8f886f27 | ||
|
b005f9f1f5 | ||
|
e43cca74ad | ||
|
2833589ad0 | ||
|
8899e3fe6a | ||
|
d06eb2d1d9 | ||
|
3357ac7380 | ||
|
e7641171b6 | ||
|
d491c88a0c | ||
|
4174c5c787 | ||
|
8f8d3d90c5 | ||
|
3f975ee570 | ||
|
d6ba8aa6ef | ||
|
4115840c28 | ||
|
a31fcb5096 | ||
|
c9bba52fc7 | ||
|
cc302b799e | ||
|
747b1ef725 | ||
|
6d1e56e715 | ||
|
180f1908b3 | ||
|
2a85d9b07e | ||
|
ae4aa4a346 | ||
|
d697037446 | ||
|
7bc04a75a7 | ||
|
aa7f19f480 | ||
|
e25566cd2b | ||
|
924c2b847f | ||
|
e1636fe18f | ||
|
4b56ad2049 | ||
|
cf9959adff | ||
|
c6b872c6ab | ||
|
c1aa3bab12 | ||
|
c410ad4da4 | ||
|
75e9154f81 | ||
|
1f515342d8 | ||
|
039e07f626 | ||
|
b5379899b3 | ||
|
b233eb1849 | ||
|
fdf3666f01 | ||
|
197e27c90a | ||
|
d3ff5dbe1d | ||
|
fe5da0927a | ||
|
adfa3327d4 | ||
|
b4a8de5d27 | ||
|
8ee4e52ba8 | ||
|
c394fa4c9e | ||
|
901a9bfc3a | ||
|
2b5b2ff04d | ||
|
5a7cbd54a1 | ||
|
dfd41aef78 | ||
|
4665fa6503 | ||
|
f0983b2074 | ||
|
34e16ff883 | ||
|
f828fc9876 | ||
|
0095070e70 | ||
|
dbc22a1785 | ||
|
b8ed8c0fb2 | ||
|
e1999b264f | ||
|
cfa6ffb113 | ||
|
1fb80369b7 | ||
|
04ae17218d | ||
|
15ee7b7689 | ||
|
4c79f9bc20 | ||
|
aecfbc81a9 | ||
|
42ec0a315b | ||
|
29e300ff81 | ||
|
1fbf5e30ae | ||
|
d2e0c473e6 | ||
|
9cd854e19d | ||
|
e0cb5e1814 | ||
|
32928415e3 | ||
|
d82c4693f8 | ||
|
eec44cdd00 | ||
|
22ac5cc9d9 | ||
|
5531fd48de | ||
|
6933c78e4d | ||
|
4e5ecdbac8 | ||
|
9301e5644c | ||
|
ef3840c1ff | ||
|
375f2d8e68 | ||
|
f297b7f200 | ||
|
8c8f49f0dc | ||
|
1e6b0394d6 | ||
|
8e7edbbf5d | ||
|
a3f12cd471 | ||
|
cc71bd9709 | ||
|
75d1a7903d | ||
|
ab957f036f | ||
|
612edbe6cd | ||
|
01c0ab90be | ||
|
7c4f05dc05 | ||
|
ec9683ec0f | ||
|
a4cf19597f | ||
|
2942cb5815 | ||
|
1cb1087749 | ||
|
f11252e9fd | ||
|
b8de64bede | ||
|
c2bd8a1a82 | ||
|
a145d5f240 | ||
|
3093c95de8 | ||
|
ecfe47968e | ||
|
d03f71dd8b | ||
|
fd9cc2052e | ||
|
cc15a619a6 | ||
|
5b90b8abb4 | ||
|
13f32d4a64 | ||
|
bbeb1bea41 | ||
|
bf2b99990e | ||
|
8d2012035d | ||
|
5396354b86 | ||
|
f2f4c6be2d | ||
|
61680cac5e | ||
|
d3b0d007a1 | ||
|
0bbc207275 | ||
|
c3dcbce26f | ||
|
64138c95db | ||
|
8c75a07208 | ||
|
a300f2a3f5 | ||
|
c8cf71ec9c | ||
|
10bf6c40f6 | ||
|
99e7e48cc7 | ||
|
9abc447b72 | ||
|
96479947bc | ||
|
063f8483b9 | ||
|
bd8efb4f8e | ||
|
1f93d0c5a3 | ||
|
84262ca3d9 | ||
|
dc6c6397b8 | ||
|
68c1868565 | ||
|
462f95ec5b | ||
|
2f2c0a8b9f | ||
|
60e49aac4e | ||
|
39b3e14c99 | ||
|
3c0c1d3fae | ||
|
f21e72135d | ||
|
152015fa65 | ||
|
74b41d5648 | ||
|
22693153d1 | ||
|
11bd8e249f | ||
|
29bf905976 | ||
|
a563c84779 | ||
|
d9f0b84c1d | ||
|
aec0ce7ca8 | ||
|
d892336899 | ||
|
ea61e597e1 | ||
|
0fc54a6a55 | ||
|
b9d4976998 | ||
|
a4d95d7cf9 | ||
|
8948fb0974 | ||
|
890e6d466c | ||
|
5a5440d0dc | ||
|
3c13938079 | ||
|
251f9b3906 | ||
|
d0bf83e1cc | ||
|
db2338af0d | ||
|
7cc8cd7b58 | ||
|
2ad22420a7 | ||
|
c055be5b82 | ||
|
037090cb7c | ||
|
83876950ab | ||
|
cc00dbcb19 | ||
|
71cdb91f31 | ||
|
c75c640512 | ||
|
51e0bd28bb | ||
|
9d6861494a | ||
|
896e689841 | ||
|
44ad51d6b1 | ||
|
29280c7084 | ||
|
16136f218d | ||
|
54211ab10f | ||
|
f8e6bcb6e7 | ||
|
4b59b22fed | ||
|
a7d8e28b29 | ||
|
2072c22a0d | ||
|
7e7b729f6c | ||
|
5eb2de2d98 | ||
|
97336fdee4 | ||
|
efa7f4df0f | ||
|
bce0328431 | ||
|
83c7f8178b | ||
|
030f71dfc4 | ||
|
1a957f17bc | ||
|
19d5bccc76 | ||
|
dc4d42302c | ||
|
38c8be123a | ||
|
9c08b3e7d5 | ||
|
4ac0296201 | ||
|
f95cdd316c | ||
|
8c89229885 | ||
|
8c10a2c014 | ||
|
32976569af | ||
|
62bad17dca | ||
|
08c65f7c4d | ||
|
3c3a0dd9d7 | ||
|
349cd45b5f | ||
|
42a492fb3e | ||
|
df79bfb87b | ||
|
25b77b5090 | ||
|
0d03ffc766 | ||
|
d2263c06c9 | ||
|
389b3b83e4 | ||
|
d4ab7201f2 | ||
|
d04b47962d | ||
|
821e042f42 | ||
|
e0df328f6f | ||
|
2b46d175cb | ||
|
2ee287b9fd | ||
|
8e03191dde | ||
|
8cb0edc689 | ||
|
991c898775 | ||
|
edc37612f7 | ||
|
e2158c4a09 | ||
|
ae25aeaf55 | ||
|
c8a5d99302 | ||
|
96afc54688 | ||
|
83d4afa4db | ||
|
98ff7e3c63 | ||
|
1c11e7a214 | ||
|
b33cf5bfcb | ||
|
fe66288873 | ||
|
4bf2a5b045 | ||
|
30691a4b40 | ||
|
aa75965349 | ||
|
f037af6ecb | ||
|
0ecdcb6142 | ||
|
3d0df0f076 | ||
|
ca31888271 | ||
|
eb07bfb09e | ||
|
87a80dc4f2 | ||
|
9fd7e88c23 | ||
|
f9c53a69ed | ||
|
ce6c2b0016 | ||
|
313d86c956 | ||
|
773b0bc283 | ||
|
030ba3097a | ||
|
e4ff3773b7 | ||
|
2e51b27fed | ||
|
66a31de7ee | ||
|
f3bdfc4186 | ||
|
f053288863 | ||
|
30c69d2cfa | ||
|
af9c77e151 | ||
|
b6d5996706 | ||
|
8ade9d425a | ||
|
15e6ae8ea4 | ||
|
2d92e052c3 | ||
|
a752dd0746 | ||
|
0cb242e336 | ||
|
4751a48aeb | ||
|
54ba08c6b6 | ||
|
edd46cd407 | ||
|
e542e05d4f | ||
|
2002e950ea | ||
|
61dc3b3399 | ||
|
3e062ea498 | ||
|
94fa95c874 | ||
|
d28a681534 | ||
|
dd6c0a0ba3 | ||
|
8c61f1934d | ||
|
2fba7d4ee4 | ||
|
e59760f87e | ||
|
b8a92fa2fe | ||
|
59a3ccb09e | ||
|
8802583c48 | ||
|
3c2dc30d1b | ||
|
e2d6833c11 | ||
|
f463dbaded | ||
|
05a757c9c6 | ||
|
7cda5d9e3a | ||
|
c5740f3606 |
@@ -51,9 +51,6 @@ steps:
|
||||
# Set default
|
||||
- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
||||
|
||||
# Use altername cmocka repo
|
||||
- bash: git config --global url.https://github.com/neverware-mirrors/cmocka.git.insteadOf https://git.cryptomilk.org/projects/cmocka.git
|
||||
|
||||
# Fetch the target branch so that pr_eval can diff them.
|
||||
# Seems like azure pipelines/github changed checkout process in nov 2020.
|
||||
- script: git fetch origin $(System.PullRequest.targetBranch)
|
||||
|
@@ -17,10 +17,13 @@ parameters:
|
||||
jobs:
|
||||
|
||||
- job: Build_${{ parameters.tool_chain_tag }}
|
||||
|
||||
timeoutInMinutes: 120
|
||||
#Use matrix to speed up the build process
|
||||
strategy:
|
||||
matrix:
|
||||
TARGET_ARM_ARMPLATFORM:
|
||||
Build.Pkgs: 'ArmPkg,ArmPlatformPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
||||
TARGET_MDE_CPU:
|
||||
Build.Pkgs: 'MdePkg,UefiCpuPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
||||
@@ -45,6 +48,9 @@ jobs:
|
||||
TARGET_SECURITY:
|
||||
Build.Pkgs: 'SecurityPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
TARGET_UEFIPAYLOAD:
|
||||
Build.Pkgs: 'UefiPayloadPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
TARGET_PLATFORMS:
|
||||
# For Platforms only check code. Leave it to Platform CI
|
||||
# to build them.
|
||||
@@ -64,23 +70,3 @@ jobs:
|
||||
build_pkgs: $(Build.Pkgs)
|
||||
build_targets: $(Build.Targets)
|
||||
build_archs: ${{ parameters.arch_list }}
|
||||
|
||||
- job: FINISHED
|
||||
dependsOn: Build_${{ parameters.tool_chain_tag }}
|
||||
condition: succeeded()
|
||||
steps:
|
||||
- checkout: none
|
||||
- script: |
|
||||
echo FINISHED
|
||||
sleep 10
|
||||
displayName: FINISHED
|
||||
|
||||
- job: FAILED
|
||||
dependsOn: Build_${{ parameters.tool_chain_tag }}
|
||||
condition: failed()
|
||||
steps:
|
||||
- checkout: none
|
||||
- script: |
|
||||
echo FAILED
|
||||
sleep 10
|
||||
displayName: FAILED
|
||||
|
@@ -31,9 +31,6 @@ steps:
|
||||
echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
|
||||
echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
||||
|
||||
# Use altername cmocka repo
|
||||
- bash: git config --global url.https://github.com/neverware-mirrors/cmocka.git.insteadOf https://git.cryptomilk.org/projects/cmocka.git
|
||||
|
||||
# Fetch the target branch so that pr_eval can diff them.
|
||||
# Seems like azure pipelines/github changed checkout process in nov 2020.
|
||||
- script: git fetch origin $(System.PullRequest.targetBranch)
|
||||
|
@@ -13,7 +13,7 @@ parameters:
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '10.x'
|
||||
versionSpec: '14.x'
|
||||
#checkLatest: false # Optional
|
||||
condition: and(gt(variables.pkg_count, 0), succeeded())
|
||||
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -6,7 +6,7 @@
|
||||
url = https://github.com/ucb-bar/berkeley-softfloat-3.git
|
||||
[submodule "UnitTestFrameworkPkg/Library/CmockaLib/cmocka"]
|
||||
path = UnitTestFrameworkPkg/Library/CmockaLib/cmocka
|
||||
url = https://git.cryptomilk.org/projects/cmocka.git
|
||||
url = https://github.com/tianocore/edk2-cmocka.git
|
||||
[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"]
|
||||
path = MdeModulePkg/Universal/RegularExpressionDxe/oniguruma
|
||||
url = https://github.com/kkos/oniguruma
|
||||
|
@@ -16,7 +16,7 @@
|
||||
# * This file must be checked into the 'default' branch of a repo. Copies
|
||||
# of this file on other branches of a repo are ignored by Mergify.
|
||||
#
|
||||
# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
# https://github.com/apps/mergify
|
||||
@@ -24,74 +24,27 @@
|
||||
#
|
||||
##
|
||||
|
||||
pull_request_rules:
|
||||
queue_rules:
|
||||
- name: default
|
||||
conditions:
|
||||
- base~=(^main|^master|^stable/)
|
||||
- label=push
|
||||
|
||||
pull_request_rules:
|
||||
- name: Automatically merge a PR when all required checks pass and 'push' label is present
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- base~=(^main|^master|^stable/)
|
||||
- label=push
|
||||
- author=@tianocore/edk-ii-maintainers
|
||||
- status-success=tianocore.PatchCheck
|
||||
- status-success=Ubuntu GCC5 PR
|
||||
- status-success=Windows VS2019 PR
|
||||
actions:
|
||||
merge:
|
||||
strict: true
|
||||
queue:
|
||||
method: rebase
|
||||
|
||||
- name: Automatically close a PR when all required checks pass and 'push' label is not present
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- -label=push
|
||||
- -closed
|
||||
- status-success=tianocore.PatchCheck
|
||||
- status-success=Ubuntu GCC5 PR
|
||||
- status-success=Windows VS2019 PR
|
||||
- status-success=Ubuntu GCC5 PR (FINISHED)
|
||||
- status-success=Windows VS2019 PR (FINISHED)
|
||||
actions:
|
||||
close:
|
||||
message: All checks passed. Auto close personal build.
|
||||
rebase_fallback: none
|
||||
name: default
|
||||
|
||||
- name: Post a comment on a PR that can not be merged due to a merge conflict
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- base~=(^main|^master|^stable/)
|
||||
- conflict
|
||||
actions:
|
||||
comment:
|
||||
message: PR can not be merged due to conflict. Please rebase and resubmit
|
||||
|
||||
- name: Automatically close a PR that fails the EDK II Maintainers membership check and 'push' label is present
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- label=push
|
||||
- -author=@tianocore/edk-ii-maintainers
|
||||
actions:
|
||||
close:
|
||||
message: PR submitter is not a member of the Tianocore EDK II Maintainers team
|
||||
|
||||
- name: Post a comment on a PR if PatchCheck fails
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- status-failure=tianocore.PatchCheck
|
||||
actions:
|
||||
comment:
|
||||
message: PR can not be merged due to a PatchCheck failure. Please resolve and resubmit
|
||||
|
||||
- name: Post a comment on a PR if Ubuntu GCC5 fails
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- status-failure=Ubuntu GCC5 PR
|
||||
- status-success=Ubuntu GCC5 PR (FAILED)
|
||||
actions:
|
||||
comment:
|
||||
message: PR can not be merged due to an Ubuntu GCC5 failure. Please resolve and resubmit
|
||||
|
||||
- name: Post a comment on a PR if Windows VS2019 fails
|
||||
conditions:
|
||||
- base~=(^master|^stable/)
|
||||
- status-failure=Windows VS2019 PR
|
||||
- status-success=Windows VS2019 PR (FAILED)
|
||||
actions:
|
||||
comment:
|
||||
message: PR can not be merged due to a Windows VS2019 failure. Please resolve and resubmit
|
||||
|
@@ -49,7 +49,9 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
||||
''' return iterable of edk2 packages supported by this build.
|
||||
These should be edk2 workspace relative paths '''
|
||||
|
||||
return ("ArmVirtPkg",
|
||||
return ("ArmPkg",
|
||||
"ArmPlatformPkg",
|
||||
"ArmVirtPkg",
|
||||
"DynamicTablesPkg",
|
||||
"EmulatorPkg",
|
||||
"MdePkg",
|
||||
@@ -65,7 +67,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
||||
"CryptoPkg",
|
||||
"UnitTestFrameworkPkg",
|
||||
"OvmfPkg",
|
||||
"RedfishPkg"
|
||||
"RedfishPkg",
|
||||
"UefiPayloadPkg"
|
||||
)
|
||||
|
||||
def GetArchitecturesSupported(self):
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# @file EccCheck.py
|
||||
#
|
||||
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
@@ -29,7 +30,6 @@ class EccCheck(ICiBuildPlugin):
|
||||
},
|
||||
"""
|
||||
|
||||
ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
|
||||
FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
|
||||
LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
|
||||
LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
|
||||
@@ -60,83 +60,182 @@ class EccCheck(ICiBuildPlugin):
|
||||
# - Junit Logger
|
||||
# - output_stream the StringIO output stream from this plugin via logging
|
||||
def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):
|
||||
edk2_path = Edk2pathObj.WorkspacePath
|
||||
python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
|
||||
workspace_path = Edk2pathObj.WorkspacePath
|
||||
basetools_path = environment.GetValue("EDK_TOOLS_PATH")
|
||||
python_path = os.path.join(basetools_path, "Source", "Python")
|
||||
env = shell_environment.GetEnvironment()
|
||||
env.set_shell_var('PYTHONPATH', python_path)
|
||||
env.set_shell_var('WORKSPACE', edk2_path)
|
||||
env.set_shell_var('WORKSPACE', workspace_path)
|
||||
env.set_shell_var('PACKAGES_PATH', os.pathsep.join(Edk2pathObj.PackagePathList))
|
||||
self.ECC_PASS = True
|
||||
self.ApplyConfig(pkgconfig, edk2_path, packagename)
|
||||
modify_dir_list = self.GetModifyDir(packagename)
|
||||
patch = self.GetDiff(packagename)
|
||||
ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
|
||||
self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
|
||||
ecc_log = os.path.join(edk2_path, "Ecc.log")
|
||||
self.RevertCode()
|
||||
|
||||
# Create temp directory
|
||||
temp_path = os.path.join(workspace_path, 'Build', '.pytool', 'Plugin', 'EccCheck')
|
||||
try:
|
||||
# Delete temp directory
|
||||
if os.path.exists(temp_path):
|
||||
shutil.rmtree(temp_path)
|
||||
# Copy package being scanned to temp_path
|
||||
shutil.copytree (
|
||||
os.path.join(workspace_path, packagename),
|
||||
os.path.join(temp_path, packagename),
|
||||
symlinks=True
|
||||
)
|
||||
# Copy exception.xml to temp_path
|
||||
shutil.copyfile (
|
||||
os.path.join(basetools_path, "Source", "Python", "Ecc", "exception.xml"),
|
||||
os.path.join(temp_path, "exception.xml")
|
||||
)
|
||||
# Output file to use for git diff operations
|
||||
temp_diff_output = os.path.join (temp_path, 'diff.txt')
|
||||
|
||||
self.ApplyConfig(pkgconfig, temp_path, packagename)
|
||||
modify_dir_list = self.GetModifyDir(packagename, temp_diff_output)
|
||||
patch = self.GetDiff(packagename, temp_diff_output)
|
||||
ecc_diff_range = self.GetDiffRange(patch, packagename, temp_path)
|
||||
#
|
||||
# Use temp_path as working directory when running ECC tool
|
||||
#
|
||||
self.GenerateEccReport(modify_dir_list, ecc_diff_range, temp_path, basetools_path)
|
||||
ecc_log = os.path.join(temp_path, "Ecc.log")
|
||||
if self.ECC_PASS:
|
||||
# Delete temp directory
|
||||
if os.path.exists(temp_path):
|
||||
shutil.rmtree(temp_path)
|
||||
tc.SetSuccess()
|
||||
self.RemoveFile(ecc_log)
|
||||
return 0
|
||||
else:
|
||||
with open(ecc_log, encoding='utf8') as output:
|
||||
ecc_output = output.readlines()
|
||||
for line in ecc_output:
|
||||
logging.error(line.strip())
|
||||
self.RemoveFile(ecc_log)
|
||||
tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc detected issues")
|
||||
# Delete temp directory
|
||||
if os.path.exists(temp_path):
|
||||
shutil.rmtree(temp_path)
|
||||
tc.SetFailed("EccCheck failed for {0}".format(packagename), "CHECK FAILED")
|
||||
return 1
|
||||
except KeyboardInterrupt:
|
||||
# If EccCheck is interrupted by keybard interrupt, then return failure
|
||||
# Delete temp directory
|
||||
if os.path.exists(temp_path):
|
||||
shutil.rmtree(temp_path)
|
||||
tc.SetFailed("EccCheck interrupted for {0}".format(packagename), "CHECK FAILED")
|
||||
return 1
|
||||
else:
|
||||
# If EccCheck fails for any other exception type, raise the exception
|
||||
# Delete temp directory
|
||||
if os.path.exists(temp_path):
|
||||
shutil.rmtree(temp_path)
|
||||
tc.SetFailed("EccCheck exception for {0}".format(packagename), "CHECK FAILED")
|
||||
raise
|
||||
return 1
|
||||
|
||||
def RevertCode(self) -> None:
|
||||
submoudle_params = "submodule update --init"
|
||||
RunCmd("git", submoudle_params)
|
||||
reset_params = "reset HEAD --hard"
|
||||
RunCmd("git", reset_params)
|
||||
|
||||
def GetDiff(self, pkg: str) -> List[str]:
|
||||
return_buffer = StringIO()
|
||||
params = "diff --unified=0 origin/master HEAD"
|
||||
RunCmd("git", params, outstream=return_buffer)
|
||||
p = return_buffer.getvalue().strip()
|
||||
patch = p.split("\n")
|
||||
return_buffer.close()
|
||||
|
||||
def GetDiff(self, pkg: str, temp_diff_output: str) -> List[str]:
|
||||
patch = []
|
||||
#
|
||||
# Generate unified diff between origin/master and HEAD.
|
||||
#
|
||||
params = "diff --output={} --unified=0 origin/master HEAD".format(temp_diff_output)
|
||||
RunCmd("git", params)
|
||||
with open(temp_diff_output) as file:
|
||||
patch = file.read().strip().split('\n')
|
||||
return patch
|
||||
|
||||
def RemoveFile(self, file: str) -> None:
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
return
|
||||
def GetModifyDir(self, pkg: str, temp_diff_output: str) -> List[str]:
|
||||
#
|
||||
# Generate diff between origin/master and HEAD using --diff-filter to
|
||||
# exclude deleted and renamed files that do not need to be scanned by
|
||||
# ECC. Also use --name-status to only generate the names of the files
|
||||
# with differences. The output format of this git diff command is a
|
||||
# list of files with the change status and the filename. The filename
|
||||
# is always at the end of the line. Examples:
|
||||
#
|
||||
# M MdeModulePkg/Application/CapsuleApp/CapsuleApp.h
|
||||
# M MdeModulePkg/Application/UiApp/FrontPage.h
|
||||
#
|
||||
params = "diff --output={} --diff-filter=dr --name-status origin/master HEAD".format(temp_diff_output)
|
||||
RunCmd("git", params)
|
||||
dir_list = []
|
||||
with open(temp_diff_output) as file:
|
||||
dir_list = file.read().strip().split('\n')
|
||||
|
||||
def GetModifyDir(self, pkg: str) -> List[str]:
|
||||
return_buffer = StringIO()
|
||||
params = "diff --name-status" + ' HEAD' + ' origin/master'
|
||||
RunCmd("git", params, outstream=return_buffer)
|
||||
p1 = return_buffer.getvalue().strip()
|
||||
dir_list = p1.split("\n")
|
||||
return_buffer.close()
|
||||
modify_dir_list = []
|
||||
for modify_dir in dir_list:
|
||||
file_path = self.ReModifyFile.findall(modify_dir)
|
||||
if file_path:
|
||||
file_dir = os.path.dirname(file_path[0])
|
||||
else:
|
||||
#
|
||||
# Parse file name from the end of the line
|
||||
#
|
||||
file_path = modify_dir.strip().split()
|
||||
#
|
||||
# Skip lines that do not have at least 2 elements (status and file name)
|
||||
#
|
||||
if len(file_path) < 2:
|
||||
continue
|
||||
if pkg in file_dir and file_dir != pkg:
|
||||
modify_dir_list.append('%s' % file_dir)
|
||||
else:
|
||||
#
|
||||
# Parse the directory name from the file name
|
||||
#
|
||||
file_dir = os.path.dirname(file_path[-1])
|
||||
#
|
||||
# Skip directory names that do not start with the package being scanned.
|
||||
#
|
||||
if file_dir.split('/')[0] != pkg:
|
||||
continue
|
||||
#
|
||||
# Skip directory names that are identical to the package being scanned.
|
||||
# The assumption here is that there are no source files at the package
|
||||
# root. Instead, the only expected files in the package root are
|
||||
# EDK II meta data files (DEC, DSC, FDF).
|
||||
#
|
||||
if file_dir == pkg:
|
||||
continue
|
||||
#
|
||||
# Skip directory names that are already in the modified dir list
|
||||
#
|
||||
if file_dir in modify_dir_list:
|
||||
continue
|
||||
#
|
||||
# Add the candidate directory to scan to the modified dir list
|
||||
#
|
||||
modify_dir_list.append(file_dir)
|
||||
|
||||
modify_dir_list = list(set(modify_dir_list))
|
||||
return modify_dir_list
|
||||
#
|
||||
# Remove duplicates from modify_dir_list
|
||||
# Given a folder path, ECC performs a recursive scan of that folder.
|
||||
# If a parent and child folder are both present in modify_dir_list,
|
||||
# then ECC will perform redudanct scans of source files. In order
|
||||
# to prevent redundant scans, if a parent and child folder are both
|
||||
# present, then remove all the child folders.
|
||||
#
|
||||
# For example, if modified_dir_list contains the following elements:
|
||||
# MdeModulePkg/Core/Dxe
|
||||
# MdeModulePkg/Core/Dxe/Hand
|
||||
# MdeModulePkg/Core/Dxe/Mem
|
||||
#
|
||||
# Then MdeModulePkg/Core/Dxe/Hand and MdeModulePkg/Core/Dxe/Mem should
|
||||
# be removed because the files in those folders are covered by a scan
|
||||
# of MdeModulePkg/Core/Dxe.
|
||||
#
|
||||
filtered_list = []
|
||||
for dir1 in modify_dir_list:
|
||||
Append = True
|
||||
for dir2 in modify_dir_list:
|
||||
if dir1 == dir2:
|
||||
continue
|
||||
common = os.path.commonpath([dir1, dir2])
|
||||
if os.path.normpath(common) == os.path.normpath(dir2):
|
||||
Append = False
|
||||
break
|
||||
if Append and dir1 not in filtered_list:
|
||||
filtered_list.append(dir1)
|
||||
return filtered_list
|
||||
|
||||
def GetDiffRange(self, patch_diff: List[str], pkg: str, workingdir: str) -> Dict[str, List[Tuple[int, int]]]:
|
||||
def GetDiffRange(self, patch_diff: List[str], pkg: str, temp_path: str) -> Dict[str, List[Tuple[int, int]]]:
|
||||
IsDelete = True
|
||||
StartCheck = False
|
||||
range_directory: Dict[str, List[Tuple[int, int]]] = {}
|
||||
for line in patch_diff:
|
||||
modify_file = self.FindModifyFile.findall(line)
|
||||
if modify_file and pkg in modify_file[0] and not StartCheck and os.path.isfile(modify_file[0]):
|
||||
modify_file_comment_dic = self.GetCommentRange(modify_file[0], workingdir)
|
||||
modify_file_comment_dic = self.GetCommentRange(modify_file[0], temp_path)
|
||||
IsDelete = False
|
||||
StartCheck = True
|
||||
modify_file_dic = modify_file[0]
|
||||
@@ -155,11 +254,13 @@ class EccCheck(ICiBuildPlugin):
|
||||
range_directory[modify_file_dic].append(i)
|
||||
return range_directory
|
||||
|
||||
def GetCommentRange(self, modify_file: str, workingdir: str) -> List[Tuple[int, int]]:
|
||||
modify_file_path = os.path.join(workingdir, modify_file)
|
||||
def GetCommentRange(self, modify_file: str, temp_path: str) -> List[Tuple[int, int]]:
|
||||
comment_range: List[Tuple[int, int]] = []
|
||||
modify_file_path = os.path.join(temp_path, modify_file)
|
||||
if not os.path.exists (modify_file_path):
|
||||
return comment_range
|
||||
with open(modify_file_path) as f:
|
||||
line_no = 1
|
||||
comment_range: List[Tuple[int, int]] = []
|
||||
Start = False
|
||||
for line in f:
|
||||
if line.startswith('/**'):
|
||||
@@ -176,39 +277,36 @@ class EccCheck(ICiBuildPlugin):
|
||||
return comment_range
|
||||
|
||||
def GenerateEccReport(self, modify_dir_list: List[str], ecc_diff_range: Dict[str, List[Tuple[int, int]]],
|
||||
edk2_path: str) -> None:
|
||||
temp_path: str, basetools_path: str) -> None:
|
||||
ecc_need = False
|
||||
ecc_run = True
|
||||
config = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "config.ini")
|
||||
exception = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")
|
||||
report = os.path.join(edk2_path, "Ecc.csv")
|
||||
config = os.path.normpath(os.path.join(basetools_path, "Source", "Python", "Ecc", "config.ini"))
|
||||
exception = os.path.normpath(os.path.join(temp_path, "exception.xml"))
|
||||
report = os.path.normpath(os.path.join(temp_path, "Ecc.csv"))
|
||||
for modify_dir in modify_dir_list:
|
||||
target = os.path.join(edk2_path, modify_dir)
|
||||
target = os.path.normpath(os.path.join(temp_path, modify_dir))
|
||||
logging.info('Run ECC tool for the commit in %s' % modify_dir)
|
||||
ecc_need = True
|
||||
ecc_params = "-c {0} -e {1} -t {2} -r {3}".format(config, exception, target, report)
|
||||
return_code = RunCmd("Ecc", ecc_params, workingdir=edk2_path)
|
||||
return_code = RunCmd("Ecc", ecc_params, workingdir=temp_path)
|
||||
if return_code != 0:
|
||||
ecc_run = False
|
||||
break
|
||||
if not ecc_run:
|
||||
logging.error('Fail to run ECC tool')
|
||||
self.ParseEccReport(ecc_diff_range, edk2_path)
|
||||
self.ParseEccReport(ecc_diff_range, temp_path)
|
||||
|
||||
if not ecc_need:
|
||||
logging.info("Doesn't need run ECC check")
|
||||
|
||||
revert_params = "checkout -- {}".format(exception)
|
||||
RunCmd("git", revert_params)
|
||||
return
|
||||
|
||||
def ParseEccReport(self, ecc_diff_range: Dict[str, List[Tuple[int, int]]], edk2_path: str) -> None:
|
||||
ecc_log = os.path.join(edk2_path, "Ecc.log")
|
||||
ecc_csv = "Ecc.csv"
|
||||
file = os.listdir(edk2_path)
|
||||
def ParseEccReport(self, ecc_diff_range: Dict[str, List[Tuple[int, int]]], temp_path: str) -> None:
|
||||
ecc_log = os.path.join(temp_path, "Ecc.log")
|
||||
ecc_csv = os.path.join(temp_path, "Ecc.csv")
|
||||
row_lines = []
|
||||
ignore_error_code = self.GetIgnoreErrorCode()
|
||||
if ecc_csv in file:
|
||||
if os.path.exists(ecc_csv):
|
||||
with open(ecc_csv) as csv_file:
|
||||
reader = csv.reader(csv_file)
|
||||
for row in reader:
|
||||
@@ -234,16 +332,16 @@ class EccCheck(ICiBuildPlugin):
|
||||
log.writelines(all_line)
|
||||
return
|
||||
|
||||
def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, pkg: str) -> None:
|
||||
def ApplyConfig(self, pkgconfig: Dict[str, List[str]], temp_path: str, pkg: str) -> None:
|
||||
if "IgnoreFiles" in pkgconfig:
|
||||
for a in pkgconfig["IgnoreFiles"]:
|
||||
a = os.path.join(edk2_path, pkg, a)
|
||||
a = os.path.join(temp_path, pkg, a)
|
||||
a = a.replace(os.sep, "/")
|
||||
|
||||
logging.info("Ignoring Files {0}".format(a))
|
||||
if os.path.exists(a):
|
||||
if os.path.isfile(a):
|
||||
self.RemoveFile(a)
|
||||
os.remove(a)
|
||||
elif os.path.isdir(a):
|
||||
shutil.rmtree(a)
|
||||
else:
|
||||
@@ -251,7 +349,7 @@ class EccCheck(ICiBuildPlugin):
|
||||
|
||||
if "ExceptionList" in pkgconfig:
|
||||
exception_list = pkgconfig["ExceptionList"]
|
||||
exception_xml = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")
|
||||
exception_xml = os.path.join(temp_path, "exception.xml")
|
||||
try:
|
||||
logging.info("Appending exceptions")
|
||||
self.AppendException(exception_list, exception_xml)
|
||||
|
@@ -5,6 +5,7 @@
|
||||
##
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import logging
|
||||
import re
|
||||
from io import StringIO
|
||||
@@ -61,12 +62,19 @@ class LicenseCheck(ICiBuildPlugin):
|
||||
# - Junit Logger
|
||||
# - output_stream the StringIO output stream from this plugin via logging
|
||||
def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):
|
||||
return_buffer = StringIO()
|
||||
params = "diff --unified=0 origin/master HEAD"
|
||||
RunCmd("git", params, outstream=return_buffer)
|
||||
p = return_buffer.getvalue().strip()
|
||||
patch = p.split("\n")
|
||||
return_buffer.close()
|
||||
# Create temp directory
|
||||
temp_path = os.path.join(Edk2pathObj.WorkspacePath, 'Build', '.pytool', 'Plugin', 'LicenseCheck')
|
||||
if not os.path.exists(temp_path):
|
||||
os.makedirs(temp_path)
|
||||
# Output file to use for git diff operations
|
||||
temp_diff_output = os.path.join (temp_path, 'diff.txt')
|
||||
params = "diff --output={} --unified=0 origin/master HEAD".format(temp_diff_output)
|
||||
RunCmd("git", params)
|
||||
with open(temp_diff_output) as file:
|
||||
patch = file.read().strip().split("\n")
|
||||
# Delete temp directory
|
||||
if os.path.exists(temp_path):
|
||||
shutil.rmtree(temp_path)
|
||||
|
||||
ignore_files = []
|
||||
if "IgnoreFiles" in pkgconfig:
|
||||
|
@@ -37,12 +37,12 @@ class SpellCheck(ICiBuildPlugin):
|
||||
#
|
||||
# A package can remove any of these using IgnoreStandardPaths
|
||||
#
|
||||
STANDARD_PLUGIN_DEFINED_PATHS = ["*.c", "*.h",
|
||||
STANDARD_PLUGIN_DEFINED_PATHS = ("*.c", "*.h",
|
||||
"*.nasm", "*.asm", "*.masm", "*.s",
|
||||
"*.asl",
|
||||
"*.dsc", "*.dec", "*.fdf", "*.inf",
|
||||
"*.md", "*.txt"
|
||||
]
|
||||
)
|
||||
|
||||
def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
|
||||
""" Provide the testcase name and classname for use in reporting
|
||||
@@ -107,7 +107,8 @@ class SpellCheck(ICiBuildPlugin):
|
||||
version_aggregator.GetVersionAggregator().ReportVersion(
|
||||
"CSpell", cspell_version, version_aggregator.VersionTypes.INFO)
|
||||
|
||||
package_relative_paths_to_spell_check = SpellCheck.STANDARD_PLUGIN_DEFINED_PATHS
|
||||
# copy the default as a list
|
||||
package_relative_paths_to_spell_check = list(SpellCheck.STANDARD_PLUGIN_DEFINED_PATHS)
|
||||
|
||||
#
|
||||
# Allow the ci.yaml to remove any of the above standard paths
|
||||
@@ -133,7 +134,8 @@ class SpellCheck(ICiBuildPlugin):
|
||||
#
|
||||
relpath = os.path.relpath(abs_pkg_path)
|
||||
cpsell_paths = " ".join(
|
||||
[f"{relpath}/**/{x}" for x in package_relative_paths_to_spell_check])
|
||||
# Double quote each path to defer expansion to cspell parameters
|
||||
[f'"{relpath}/**/{x}"' for x in package_relative_paths_to_spell_check])
|
||||
|
||||
# Make the config file
|
||||
config_file_path = os.path.join(
|
||||
|
120
.pytool/Plugin/UncrustifyCheck/Readme.md
Normal file
120
.pytool/Plugin/UncrustifyCheck/Readme.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# UncrustifyCheck Plugin
|
||||
|
||||
This CiBuildPlugin scans all the files in a given package and checks for coding standard compliance issues.
|
||||
|
||||
This plugin is enabled by default. If a package would like to prevent the plugin from reporting errors, it can do
|
||||
so by enabling [`AuditOnly`](#auditonly) mode.
|
||||
|
||||
This plugin requires the directory containing the Uncrustify executable that should be used for this plugin to
|
||||
be specified in an environment variable named `UNCRUSTIFY_CI_PATH`. This unique variable name is used to avoid confusion
|
||||
with other paths to Uncrustify which might not be the expected build for use by this plugin.
|
||||
|
||||
By default, an Uncrustify configuration file named "uncrustify.cfg" located in the same directory as the plugin is
|
||||
used. The value can be overridden to a package-specific path with the `ConfigFilePath` configuration file option.
|
||||
|
||||
* Uncrustify source code and documentation: https://github.com/uncrustify/uncrustify
|
||||
* Project Mu Uncrustify fork source code and documentation: https://dev.azure.com/projectmu/Uncrustify
|
||||
|
||||
## Files Checked in a Package
|
||||
|
||||
By default, this plugin will discover all files in the package with the following default paths:
|
||||
|
||||
```python
|
||||
[
|
||||
# C source
|
||||
"*.c",
|
||||
"*.h"
|
||||
]
|
||||
```
|
||||
|
||||
From this list of files, any files ignored by Git or residing in a Git submodule will be removed. If Git is not
|
||||
found, submodules are not found, or ignored files are not found no changes are made to the list of discovered files.
|
||||
|
||||
To control the paths checked in a given package, review the configuration options described in this file.
|
||||
|
||||
## Configuration
|
||||
|
||||
The plugin can be configured with a few optional configuration options.
|
||||
|
||||
``` yaml
|
||||
"UncrustifyCheck": {
|
||||
"AdditionalIncludePaths": [], # Additional paths to check formatting (wildcards supported).
|
||||
"AuditOnly": False, # Don't fail the build if there are errors. Just log them.
|
||||
"ConfigFilePath": "", # Custom path to an Uncrustify config file.
|
||||
"IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignored.
|
||||
"OutputFileDiffs": False, # Output chunks of formatting diffs in the test case log.
|
||||
# This can significantly slow down the plugin on very large packages.
|
||||
"SkipGitExclusions": False # Don't exclude git ignored files and files in git submodules.
|
||||
}
|
||||
```
|
||||
|
||||
### `AdditionalIncludePaths`
|
||||
|
||||
A package configuration file can specify any additional paths to be included with this option.
|
||||
|
||||
At this time, it is recommended all files run against the plugin be written in the C or C++ language.
|
||||
|
||||
### `AuditOnly`
|
||||
|
||||
`Boolean` - Default is `False`.
|
||||
|
||||
If `True`, run the test in an "audit only mode" which will log all errors but instead of failing the build, it will set
|
||||
the test as skipped. This allows visibility into the failures without breaking the build.
|
||||
|
||||
### `ConfigFilePath`
|
||||
|
||||
`String` - Default is `"uncrustify.cfg"`
|
||||
|
||||
When specified in the config file, this is a package relative path to the Uncrustify configuration file.
|
||||
|
||||
### `IgnoreStandardPaths`
|
||||
|
||||
This plugin by default will check the below standard paths. A package configuration file can specify any of these paths
|
||||
to be ignored.
|
||||
|
||||
```python
|
||||
[
|
||||
# C source
|
||||
"*.c",
|
||||
"*.h"
|
||||
]
|
||||
```
|
||||
|
||||
### `OutputFileDiffs`
|
||||
|
||||
`Boolean` - Default is `False`.
|
||||
|
||||
If `True`, output diffs of formatting changes into the test case log. This is helpful to exactly understand what changes
|
||||
need to be made to the source code in order to fix a coding standard compliance issue.
|
||||
|
||||
Note that calculating the file diffs on a very large set of of results (e.g. >100 files) can significantly slow down
|
||||
plugin execution.
|
||||
|
||||
### `SkipGitExclusions`
|
||||
|
||||
`Boolean` - Default is `False`.
|
||||
|
||||
By default, files in paths matched in a .gitignore file or a recognized git submodule are excluded. If this option
|
||||
is `True`, the plugin will not attempt to recognize these files and exclude them.
|
||||
|
||||
## High-Level Plugin Operation
|
||||
|
||||
This plugin generates two main sets of temporary files:
|
||||
|
||||
1. A working directory in the directory `Build/.pytool/Plugin/Uncrustify`
|
||||
2. For each source file with formatting errors, a sibling file with the `.uncrustify_plugin` extension
|
||||
|
||||
The working directory contains temporary files unique to operation of the plugin. All of these files are removed on
|
||||
exit of the plugin including successful or unsuccessful execution (such as a Python exception occurring). If for any
|
||||
reason, any files in the package exist prior to running the plugin with the `.uncrustify_plugin` extension, the plugin
|
||||
will inform the user to remove these files and exit before running Uncrustify. This is to ensure the accuracy of the
|
||||
results reported from each execution instance of the plugin.
|
||||
|
||||
The plugin determines the list of relevant files to check with Uncrustify and then invokes Uncrustify with that file
|
||||
list. For any files not compliant to the configuration file provided, Uncrustify will generate a corresponding file
|
||||
with the `.uncrustify_plugin` extension. The plugin discovers all of these files. If any such files are present, this
|
||||
indicates a formatting issue was found and the test is marked failed (unless `AuditOnly` mode is enabled).
|
||||
|
||||
The test case log will contain a report of which files failed to format properly, allowing the user to run Uncrustify
|
||||
against the file locally to fix the issue. If the `OutputFileDiffs` configuration option is set to `True`, the plugin
|
||||
will output diff chunks for all code formatting issues in the test case log.
|
618
.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
Normal file
618
.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
Normal file
@@ -0,0 +1,618 @@
|
||||
# @file UncrustifyCheck.py
|
||||
#
|
||||
# An edk2-pytool based plugin wrapper for Uncrustify
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
import configparser
|
||||
import difflib
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import timeit
|
||||
from edk2toolext.environment import version_aggregator
|
||||
from edk2toolext.environment.plugin_manager import PluginManager
|
||||
from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
|
||||
from edk2toolext.environment.plugintypes.uefi_helper_plugin import HelperFunctions
|
||||
from edk2toolext.environment.var_dict import VarDict
|
||||
from edk2toollib.log.junit_report_format import JunitReportTestCase
|
||||
from edk2toollib.uefi.edk2.path_utilities import Edk2Path
|
||||
from edk2toollib.utility_functions import RunCmd
|
||||
from io import StringIO
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
#
|
||||
# Provide more user friendly messages for certain scenarios
|
||||
#
|
||||
class UncrustifyException(Exception):
|
||||
def __init__(self, message, exit_code):
|
||||
super().__init__(message)
|
||||
self.exit_code = exit_code
|
||||
|
||||
|
||||
class UncrustifyAppEnvVarNotFoundException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -101)
|
||||
|
||||
|
||||
class UncrustifyAppVersionErrorException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -102)
|
||||
|
||||
|
||||
class UncrustifyAppExecutionException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -103)
|
||||
|
||||
|
||||
class UncrustifyStalePluginFormattedFilesException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -120)
|
||||
|
||||
|
||||
class UncrustifyInputFileCreationErrorException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -121)
|
||||
|
||||
class UncrustifyInvalidIgnoreStandardPathsException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -122)
|
||||
|
||||
class UncrustifyGitIgnoreFileException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -140)
|
||||
|
||||
|
||||
class UncrustifyGitSubmoduleException(UncrustifyException):
|
||||
def __init__(self, message):
|
||||
super().__init__(message, -141)
|
||||
|
||||
|
||||
class UncrustifyCheck(ICiBuildPlugin):
|
||||
"""
|
||||
A CiBuildPlugin that uses Uncrustify to check the source files in the
|
||||
package being tested for coding standard issues.
|
||||
|
||||
By default, the plugin runs against standard C source file extensions but
|
||||
its configuration can be modified through its configuration file.
|
||||
|
||||
Configuration options:
|
||||
"UncrustifyCheck": {
|
||||
"AdditionalIncludePaths": [], # Additional paths to check formatting (wildcards supported).
|
||||
"AuditOnly": False, # Don't fail the build if there are errors. Just log them.
|
||||
"ConfigFilePath": "", # Custom path to an Uncrustify config file.
|
||||
"IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignored.
|
||||
"OutputFileDiffs": False, # Output chunks of formatting diffs in the test case log.
|
||||
# This can significantly slow down the plugin on very large packages.
|
||||
"SkipGitExclusions": False # Don't exclude git ignored files and files in git submodules.
|
||||
}
|
||||
"""
|
||||
|
||||
#
|
||||
# By default, use an "uncrustify.cfg" config file in the plugin directory
|
||||
# A package can override this path via "ConfigFilePath"
|
||||
#
|
||||
# Note: Values specified via "ConfigFilePath" are relative to the package
|
||||
#
|
||||
DEFAULT_CONFIG_FILE_PATH = os.path.join(
|
||||
pathlib.Path(__file__).parent.resolve(), "uncrustify.cfg")
|
||||
|
||||
#
|
||||
# The extension used for formatted files produced by this plugin
|
||||
#
|
||||
FORMATTED_FILE_EXTENSION = ".uncrustify_plugin"
|
||||
|
||||
#
|
||||
# A package can add any additional paths with "AdditionalIncludePaths"
|
||||
# A package can remove any of these paths with "IgnoreStandardPaths"
|
||||
#
|
||||
STANDARD_PLUGIN_DEFINED_PATHS = ("*.c", "*.h")
|
||||
|
||||
#
|
||||
# The Uncrustify application path should set in this environment variable
|
||||
#
|
||||
UNCRUSTIFY_PATH_ENV_KEY = "UNCRUSTIFY_CI_PATH"
|
||||
|
||||
def GetTestName(self, packagename: str, environment: VarDict) -> Tuple:
|
||||
""" Provide the testcase name and classname for use in reporting
|
||||
|
||||
Args:
|
||||
packagename: string containing name of package to build
|
||||
environment: The VarDict for the test to run in
|
||||
Returns:
|
||||
A tuple containing the testcase name and the classname
|
||||
(testcasename, classname)
|
||||
testclassname: a descriptive string for the testcase can include whitespace
|
||||
classname: should be patterned <packagename>.<plugin>.<optionally any unique condition>
|
||||
"""
|
||||
return ("Check file coding standard compliance in " + packagename, packagename + ".UncrustifyCheck")
|
||||
|
||||
def RunBuildPlugin(self, package_rel_path: str, edk2_path: Edk2Path, package_config: Dict[str, List[str]], environment_config: Any, plugin_manager: PluginManager, plugin_manager_helper: HelperFunctions, tc: JunitReportTestCase, output_stream=None) -> int:
|
||||
"""
|
||||
External function of plugin. This function is used to perform the task of the CiBuild Plugin.
|
||||
|
||||
Args:
|
||||
- package_rel_path: edk2 workspace relative path to the package
|
||||
- edk2_path: Edk2Path object with workspace and packages paths
|
||||
- package_config: Dictionary with the package configuration
|
||||
- environment_config: Environment configuration
|
||||
- plugin_manager: Plugin Manager Instance
|
||||
- plugin_manager_helper: Plugin Manager Helper Instance
|
||||
- tc: JUnit test case
|
||||
- output_stream: The StringIO output stream from this plugin (logging)
|
||||
|
||||
Returns
|
||||
>0 : Number of errors found
|
||||
0 : Passed successfully
|
||||
-1 : Skipped for missing prereq
|
||||
"""
|
||||
try:
|
||||
# Initialize plugin and check pre-requisites.
|
||||
self._initialize_environment_info(
|
||||
package_rel_path, edk2_path, package_config, tc)
|
||||
self._initialize_configuration()
|
||||
self._check_for_preexisting_formatted_files()
|
||||
|
||||
# Log important context information.
|
||||
self._log_uncrustify_app_info()
|
||||
|
||||
# Get template file contents if specified
|
||||
self._get_template_file_contents()
|
||||
|
||||
# Create meta input files & directories
|
||||
self._create_temp_working_directory()
|
||||
self._create_uncrustify_file_list_file()
|
||||
|
||||
self._run_uncrustify()
|
||||
|
||||
# Post-execution actions.
|
||||
self._process_uncrustify_results()
|
||||
|
||||
except UncrustifyException as e:
|
||||
self._tc.LogStdError(
|
||||
f"Uncrustify error {e.exit_code}. Details:\n\n{str(e)}")
|
||||
logging.warning(
|
||||
f"Uncrustify error {e.exit_code}. Details:\n\n{str(e)}")
|
||||
return -1
|
||||
else:
|
||||
if self._formatted_file_error_count > 0:
|
||||
if self._audit_only_mode:
|
||||
logging.info(
|
||||
"Setting test as skipped since AuditOnly is enabled")
|
||||
self._tc.SetSkipped()
|
||||
return -1
|
||||
else:
|
||||
self._tc.SetFailed(
|
||||
f"{self._plugin_name} failed due to {self._formatted_file_error_count} incorrectly formatted files.", "CHECK_FAILED")
|
||||
else:
|
||||
self._tc.SetSuccess()
|
||||
return self._formatted_file_error_count
|
||||
finally:
|
||||
self._cleanup_temporary_formatted_files()
|
||||
self._cleanup_temporary_directory()
|
||||
|
||||
def _initialize_configuration(self) -> None:
|
||||
"""
|
||||
Initializes plugin configuration.
|
||||
"""
|
||||
self._initialize_app_info()
|
||||
self._initialize_config_file_info()
|
||||
self._initialize_file_to_format_info()
|
||||
self._initialize_test_case_output_options()
|
||||
|
||||
def _check_for_preexisting_formatted_files(self) -> None:
|
||||
"""
|
||||
Checks if any formatted files from prior execution are present.
|
||||
|
||||
Existence of such files is an unexpected condition. This might result
|
||||
from an error that occurred during a previous run or a premature exit from a debug scenario. In any case, the package should be clean before starting a new run.
|
||||
"""
|
||||
pre_existing_formatted_file_count = len(
|
||||
[str(path.resolve()) for path in pathlib.Path(self._abs_package_path).rglob(f'*{UncrustifyCheck.FORMATTED_FILE_EXTENSION}')])
|
||||
|
||||
if pre_existing_formatted_file_count > 0:
|
||||
raise UncrustifyStalePluginFormattedFilesException(
|
||||
f"{pre_existing_formatted_file_count} formatted files already exist. To prevent overwriting these files, please remove them before running this plugin.")
|
||||
|
||||
def _cleanup_temporary_directory(self) -> None:
|
||||
"""
|
||||
Cleans up the temporary directory used for this execution instance.
|
||||
|
||||
This removes the directory and all files created during this instance.
|
||||
"""
|
||||
if hasattr(self, '_working_dir'):
|
||||
self._remove_tree(self._working_dir)
|
||||
|
||||
def _cleanup_temporary_formatted_files(self) -> None:
|
||||
"""
|
||||
Cleans up the temporary formmatted files produced by Uncrustify.
|
||||
|
||||
This will recursively remove all formatted files generated by Uncrustify
|
||||
during this execution instance.
|
||||
"""
|
||||
if hasattr(self, '_abs_package_path'):
|
||||
formatted_files = [str(path.resolve()) for path in pathlib.Path(
|
||||
self._abs_package_path).rglob(f'*{UncrustifyCheck.FORMATTED_FILE_EXTENSION}')]
|
||||
|
||||
for formatted_file in formatted_files:
|
||||
os.remove(formatted_file)
|
||||
|
||||
def _create_temp_working_directory(self) -> None:
|
||||
"""
|
||||
Creates the temporary directory used for this execution instance.
|
||||
"""
|
||||
self._working_dir = os.path.join(
|
||||
self._abs_workspace_path, "Build", ".pytool", "Plugin", f"{self._plugin_name}")
|
||||
|
||||
try:
|
||||
pathlib.Path(self._working_dir).mkdir(parents=True, exist_ok=True)
|
||||
except OSError as e:
|
||||
raise UncrustifyInputFileCreationErrorException(
|
||||
f"Error creating plugin directory {self._working_dir}.\n\n{repr(e)}.")
|
||||
|
||||
def _create_uncrustify_file_list_file(self) -> None:
|
||||
"""
|
||||
Creates the file with the list of source files for Uncrustify to process.
|
||||
"""
|
||||
self._app_input_file_path = os.path.join(
|
||||
self._working_dir, "uncrustify_file_list.txt")
|
||||
|
||||
with open(self._app_input_file_path, 'w', encoding='utf8') as f:
|
||||
f.writelines(f"\n".join(self._abs_file_paths_to_format))
|
||||
|
||||
def _execute_uncrustify(self) -> None:
|
||||
"""
|
||||
Executes Uncrustify with the initialized configuration.
|
||||
"""
|
||||
output = StringIO()
|
||||
self._app_exit_code = RunCmd(
|
||||
self._app_path,
|
||||
f"-c {self._app_config_file} -F {self._app_input_file_path} --if-changed --suffix {UncrustifyCheck.FORMATTED_FILE_EXTENSION}", outstream=output)
|
||||
self._app_output = output.getvalue().strip().splitlines()
|
||||
|
||||
def _get_git_ignored_paths(self) -> List[str]:
|
||||
""""
|
||||
Returns a list of file absolute path strings to all files ignored in this git repository.
|
||||
|
||||
If git is not found, an empty list will be returned.
|
||||
"""
|
||||
if not shutil.which("git"):
|
||||
logging.warn(
|
||||
"Git is not found on this system. Git submodule paths will not be considered.")
|
||||
return []
|
||||
|
||||
outstream_buffer = StringIO()
|
||||
exit_code = RunCmd("git", "ls-files --other",
|
||||
workingdir=self._abs_workspace_path, outstream=outstream_buffer, logging_level=logging.NOTSET)
|
||||
if (exit_code != 0):
|
||||
raise UncrustifyGitIgnoreFileException(
|
||||
f"An error occurred reading git ignore settings. This will prevent Uncrustify from running against the expected set of files.")
|
||||
|
||||
# Note: This will potentially be a large list, but at least sorted
|
||||
return outstream_buffer.getvalue().strip().splitlines()
|
||||
|
||||
def _get_git_submodule_paths(self) -> List[str]:
|
||||
"""
|
||||
Returns a list of directory absolute path strings to the root of each submodule in the workspace repository.
|
||||
|
||||
If git is not found, an empty list will be returned.
|
||||
"""
|
||||
if not shutil.which("git"):
|
||||
logging.warn(
|
||||
"Git is not found on this system. Git submodule paths will not be considered.")
|
||||
return []
|
||||
|
||||
if os.path.isfile(os.path.join(self._abs_workspace_path, ".gitmodules")):
|
||||
logging.info(
|
||||
f".gitmodules file found. Excluding submodules in {self._package_name}.")
|
||||
|
||||
outstream_buffer = StringIO()
|
||||
exit_code = RunCmd("git", "config --file .gitmodules --get-regexp path", workingdir=self._abs_workspace_path, outstream=outstream_buffer, logging_level=logging.NOTSET)
|
||||
if (exit_code != 0):
|
||||
raise UncrustifyGitSubmoduleException(
|
||||
f".gitmodule file detected but an error occurred reading the file. Cannot proceed with unknown submodule paths.")
|
||||
|
||||
submodule_paths = []
|
||||
for line in outstream_buffer.getvalue().strip().splitlines():
|
||||
submodule_paths.append(
|
||||
os.path.normpath(os.path.join(self._abs_workspace_path, line.split()[1])))
|
||||
|
||||
return submodule_paths
|
||||
else:
|
||||
return []
|
||||
|
||||
def _get_template_file_contents(self) -> None:
|
||||
"""
|
||||
Gets the contents of Uncrustify template files if they are specified
|
||||
in the Uncrustify configuration file.
|
||||
"""
|
||||
|
||||
self._file_template_contents = None
|
||||
self._func_template_contents = None
|
||||
|
||||
# Allow no value to allow "set" statements in the config file which do
|
||||
# not specify value assignment
|
||||
parser = configparser.ConfigParser(allow_no_value=True)
|
||||
with open(self._app_config_file, 'r') as cf:
|
||||
parser.read_string("[dummy_section]\n" + cf.read())
|
||||
|
||||
try:
|
||||
file_template_name = parser["dummy_section"]["cmt_insert_file_header"]
|
||||
|
||||
file_template_path = pathlib.Path(file_template_name)
|
||||
|
||||
if not file_template_path.is_file():
|
||||
file_template_path = pathlib.Path(os.path.join(self._plugin_path, file_template_name))
|
||||
self._file_template_contents = file_template_path.read_text()
|
||||
except KeyError:
|
||||
logging.warn("A file header template is not specified in the config file.")
|
||||
except FileNotFoundError:
|
||||
logging.warn("The specified file header template file was not found.")
|
||||
try:
|
||||
func_template_name = parser["dummy_section"]["cmt_insert_func_header"]
|
||||
|
||||
func_template_path = pathlib.Path(func_template_name)
|
||||
|
||||
if not func_template_path.is_file():
|
||||
func_template_path = pathlib.Path(os.path.join(self._plugin_path, func_template_name))
|
||||
self._func_template_contents = func_template_path.read_text()
|
||||
except KeyError:
|
||||
logging.warn("A function header template is not specified in the config file.")
|
||||
except FileNotFoundError:
|
||||
logging.warn("The specified function header template file was not found.")
|
||||
|
||||
def _initialize_app_info(self) -> None:
|
||||
"""
|
||||
Initialize Uncrustify application information.
|
||||
|
||||
This function will determine the application path and version.
|
||||
"""
|
||||
# Verify Uncrustify is specified in the environment.
|
||||
if UncrustifyCheck.UNCRUSTIFY_PATH_ENV_KEY not in os.environ:
|
||||
raise UncrustifyAppEnvVarNotFoundException(
|
||||
f"Uncrustify environment variable {UncrustifyCheck.UNCRUSTIFY_PATH_ENV_KEY} is not present.")
|
||||
|
||||
self._app_path = shutil.which('uncrustify', path=os.environ[UncrustifyCheck.UNCRUSTIFY_PATH_ENV_KEY])
|
||||
|
||||
if self._app_path is None:
|
||||
raise FileNotFoundError(
|
||||
errno.ENOENT, os.strerror(errno.ENOENT), self._app_path)
|
||||
|
||||
self._app_path = os.path.normcase(os.path.normpath(self._app_path))
|
||||
|
||||
if not os.path.isfile(self._app_path):
|
||||
raise FileNotFoundError(
|
||||
errno.ENOENT, os.strerror(errno.ENOENT), self._app_path)
|
||||
|
||||
# Verify Uncrustify is present at the expected path.
|
||||
return_buffer = StringIO()
|
||||
ret = RunCmd(self._app_path, "--version", outstream=return_buffer)
|
||||
if (ret != 0):
|
||||
raise UncrustifyAppVersionErrorException(
|
||||
f"Error occurred executing --version: {ret}.")
|
||||
|
||||
# Log Uncrustify version information.
|
||||
self._app_version = return_buffer.getvalue().strip()
|
||||
self._tc.LogStdOut(f"Uncrustify version: {self._app_version}")
|
||||
version_aggregator.GetVersionAggregator().ReportVersion(
|
||||
"Uncrustify", self._app_version, version_aggregator.VersionTypes.INFO)
|
||||
|
||||
def _initialize_config_file_info(self) -> None:
|
||||
"""
|
||||
Initialize Uncrustify configuration file info.
|
||||
|
||||
The config file path is relative to the package root.
|
||||
"""
|
||||
self._app_config_file = UncrustifyCheck.DEFAULT_CONFIG_FILE_PATH
|
||||
if "ConfigFilePath" in self._package_config:
|
||||
self._app_config_file = self._package_config["ConfigFilePath"].strip()
|
||||
|
||||
self._app_config_file = os.path.normpath(
|
||||
os.path.join(self._abs_package_path, self._app_config_file))
|
||||
|
||||
if not os.path.isfile(self._app_config_file):
|
||||
raise FileNotFoundError(
|
||||
errno.ENOENT, os.strerror(errno.ENOENT), self._app_config_file)
|
||||
|
||||
def _initialize_environment_info(self, package_rel_path: str, edk2_path: Edk2Path, package_config: Dict[str, List[str]], tc: JunitReportTestCase) -> None:
|
||||
"""
|
||||
Initializes plugin environment information.
|
||||
"""
|
||||
self._abs_package_path = edk2_path.GetAbsolutePathOnThisSytemFromEdk2RelativePath(
|
||||
package_rel_path)
|
||||
self._abs_workspace_path = edk2_path.WorkspacePath
|
||||
self._package_config = package_config
|
||||
self._package_name = os.path.basename(
|
||||
os.path.normpath(package_rel_path))
|
||||
self._plugin_name = self.__class__.__name__
|
||||
self._plugin_path = os.path.dirname(os.path.realpath(__file__))
|
||||
self._rel_package_path = package_rel_path
|
||||
self._tc = tc
|
||||
|
||||
def _initialize_file_to_format_info(self) -> None:
|
||||
"""
|
||||
Forms the list of source files for Uncrustify to process.
|
||||
"""
|
||||
# Create a list of all the package relative file paths in the package to run against Uncrustify.
|
||||
rel_file_paths_to_format = list(
|
||||
UncrustifyCheck.STANDARD_PLUGIN_DEFINED_PATHS)
|
||||
|
||||
# Allow the ci.yaml to remove any of the pre-defined standard paths
|
||||
if "IgnoreStandardPaths" in self._package_config:
|
||||
for a in self._package_config["IgnoreStandardPaths"]:
|
||||
if a.strip() in rel_file_paths_to_format:
|
||||
self._tc.LogStdOut(
|
||||
f"Ignoring standard path due to ci.yaml ignore: {a}")
|
||||
rel_file_paths_to_format.remove(a.strip())
|
||||
else:
|
||||
raise UncrustifyInvalidIgnoreStandardPathsException(f"Invalid IgnoreStandardPaths value: {a}")
|
||||
|
||||
# Allow the ci.yaml to specify additional include paths for this package
|
||||
if "AdditionalIncludePaths" in self._package_config:
|
||||
rel_file_paths_to_format.extend(
|
||||
self._package_config["AdditionalIncludePaths"])
|
||||
|
||||
self._abs_file_paths_to_format = []
|
||||
for path in rel_file_paths_to_format:
|
||||
self._abs_file_paths_to_format.extend(
|
||||
[str(path.resolve()) for path in pathlib.Path(self._abs_package_path).rglob(path)])
|
||||
|
||||
if not "SkipGitExclusions" in self._package_config or not self._package_config["SkipGitExclusions"]:
|
||||
# Remove files ignored by git
|
||||
logging.info(
|
||||
f"{self._package_name} file count before git ignore file exclusion: {len(self._abs_file_paths_to_format)}")
|
||||
|
||||
ignored_paths = self._get_git_ignored_paths()
|
||||
self._abs_file_paths_to_format = list(
|
||||
set(self._abs_file_paths_to_format).difference(ignored_paths))
|
||||
|
||||
logging.info(
|
||||
f"{self._package_name} file count after git ignore file exclusion: {len(self._abs_file_paths_to_format)}")
|
||||
|
||||
# Remove files in submodules
|
||||
logging.info(
|
||||
f"{self._package_name} file count before submodule exclusion: {len(self._abs_file_paths_to_format)}")
|
||||
|
||||
submodule_paths = tuple(self._get_git_submodule_paths())
|
||||
for path in submodule_paths:
|
||||
logging.info(f" submodule path: {path}")
|
||||
|
||||
self._abs_file_paths_to_format = [
|
||||
f for f in self._abs_file_paths_to_format if not f.startswith(submodule_paths)]
|
||||
|
||||
logging.info(
|
||||
f"{self._package_name} file count after submodule exclusion: {len(self._abs_file_paths_to_format)}")
|
||||
|
||||
# Sort the files for more consistent results
|
||||
self._abs_file_paths_to_format.sort()
|
||||
|
||||
def _initialize_test_case_output_options(self) -> None:
|
||||
"""
|
||||
Initializes options that influence test case output.
|
||||
"""
|
||||
self._audit_only_mode = False
|
||||
self._output_file_diffs = False
|
||||
|
||||
if "AuditOnly" in self._package_config and self._package_config["AuditOnly"]:
|
||||
self._audit_only_mode = True
|
||||
|
||||
if "OutputFileDiffs" in self._package_config and self._package_config["OutputFileDiffs"]:
|
||||
self._output_file_diffs = True
|
||||
|
||||
def _log_uncrustify_app_info(self) -> None:
|
||||
"""
|
||||
Logs Uncrustify application information.
|
||||
"""
|
||||
self._tc.LogStdOut(f"Found Uncrustify at {self._app_path}")
|
||||
self._tc.LogStdOut(f"Uncrustify version: {self._app_version}")
|
||||
self._tc.LogStdOut('\n')
|
||||
logging.info(f"Found Uncrustify at {self._app_path}")
|
||||
logging.info(f"Uncrustify version: {self._app_version}")
|
||||
logging.info('\n')
|
||||
|
||||
def _process_uncrustify_results(self) -> None:
|
||||
"""
|
||||
Process the results from Uncrustify.
|
||||
|
||||
Determines whether formatting errors are present and logs failures.
|
||||
"""
|
||||
formatted_files = [str(path.resolve()) for path in pathlib.Path(
|
||||
self._abs_package_path).rglob(f'*{UncrustifyCheck.FORMATTED_FILE_EXTENSION}')]
|
||||
|
||||
self._formatted_file_error_count = len(formatted_files)
|
||||
|
||||
if self._formatted_file_error_count > 0:
|
||||
self._tc.LogStdError("Files with formatting errors:\n")
|
||||
|
||||
if self._output_file_diffs:
|
||||
logging.info("Calculating file diffs. This might take a while...")
|
||||
|
||||
for formatted_file in formatted_files:
|
||||
pre_formatted_file = formatted_file[:-
|
||||
len(UncrustifyCheck.FORMATTED_FILE_EXTENSION)]
|
||||
logging.error(pre_formatted_file)
|
||||
|
||||
if (self._output_file_diffs or
|
||||
self._file_template_contents is not None or
|
||||
self._func_template_contents is not None):
|
||||
self._tc.LogStdError(
|
||||
f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")
|
||||
|
||||
with open(formatted_file) as ff:
|
||||
formatted_file_text = ff.read()
|
||||
|
||||
if (self._file_template_contents is not None and
|
||||
self._file_template_contents in formatted_file_text):
|
||||
self._tc.LogStdError(f"File header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")
|
||||
|
||||
if (self._func_template_contents is not None and
|
||||
self._func_template_contents in formatted_file_text):
|
||||
self._tc.LogStdError(f"A function header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")
|
||||
|
||||
if self._output_file_diffs:
|
||||
with open(pre_formatted_file) as pf:
|
||||
pre_formatted_file_text = pf.read()
|
||||
|
||||
for line in difflib.unified_diff(pre_formatted_file_text.split('\n'), formatted_file_text.split('\n'), fromfile=pre_formatted_file, tofile=formatted_file, n=3):
|
||||
self._tc.LogStdError(line)
|
||||
|
||||
self._tc.LogStdError('\n')
|
||||
else:
|
||||
self._tc.LogStdError(pre_formatted_file)
|
||||
|
||||
def _remove_tree(self, dir_path: str, ignore_errors: bool = False) -> None:
|
||||
"""
|
||||
Helper for removing a directory. Over time there have been
|
||||
many private implementations of this due to reliability issues in the
|
||||
shutil implementations. To consolidate on a single function this helper is added.
|
||||
|
||||
On error try to change file attributes. Also add retry logic.
|
||||
|
||||
This function is temporarily borrowed from edk2toollib.utility_functions
|
||||
since the version used in edk2 is not recent enough to include the
|
||||
function.
|
||||
|
||||
This function should be replaced by "RemoveTree" when it is available.
|
||||
|
||||
Args:
|
||||
- dir_path: Path to directory to remove.
|
||||
- ignore_errors: Whether to ignore errors during removal
|
||||
"""
|
||||
|
||||
def _remove_readonly(func, path, _):
|
||||
"""
|
||||
Private function to attempt to change permissions on file/folder being deleted.
|
||||
"""
|
||||
os.chmod(path, os.stat.S_IWRITE)
|
||||
func(path)
|
||||
|
||||
for _ in range(3): # retry up to 3 times
|
||||
try:
|
||||
shutil.rmtree(dir_path, ignore_errors=ignore_errors, onerror=_remove_readonly)
|
||||
except OSError as err:
|
||||
logging.warning(f"Failed to fully remove {dir_path}: {err}")
|
||||
else:
|
||||
break
|
||||
else:
|
||||
raise RuntimeError(f"Failed to remove {dir_path}")
|
||||
|
||||
def _run_uncrustify(self) -> None:
|
||||
"""
|
||||
Runs Uncrustify for this instance of plugin execution.
|
||||
"""
|
||||
logging.info("Executing Uncrustify. This might take a while...")
|
||||
start_time = timeit.default_timer()
|
||||
self._execute_uncrustify()
|
||||
end_time = timeit.default_timer() - start_time
|
||||
|
||||
execution_summary = f"Uncrustify executed against {len(self._abs_file_paths_to_format)} files in {self._package_name} in {end_time:.2f} seconds.\n"
|
||||
|
||||
self._tc.LogStdOut(execution_summary)
|
||||
logging.info(execution_summary)
|
||||
|
||||
if self._app_exit_code != 0 and self._app_exit_code != 1:
|
||||
raise UncrustifyAppExecutionException(
|
||||
f"Error {str(self._app_exit_code)} returned from Uncrustify:\n\n{str(self._app_output)}")
|
9
.pytool/Plugin/UncrustifyCheck/default_file_header.txt
Normal file
9
.pytool/Plugin/UncrustifyCheck/default_file_header.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
/** @file
|
||||
Brief description of the file's purpose.
|
||||
|
||||
Detailed description of the file's contents and other useful
|
||||
information for a person viewing the file for the first time.
|
||||
|
||||
<<Copyright>>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
15
.pytool/Plugin/UncrustifyCheck/default_function_header.txt
Normal file
15
.pytool/Plugin/UncrustifyCheck/default_function_header.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
Brief description of this function's purpose.
|
||||
|
||||
Follow it immediately with the detailed description.
|
||||
|
||||
@param[in] Arg1 Description of Arg1.
|
||||
@param[in] Arg2 Description of Arg2 This is complicated and requires
|
||||
multiple lines to describe.
|
||||
@param[out] Arg3 Description of Arg3.
|
||||
@param[in, out] Arg4 Description of Arg4.
|
||||
|
||||
@retval VAL_ONE Description of what VAL_ONE signifies.
|
||||
@retval OTHER This is the only other return value. If there were other
|
||||
return values, they would be listed.
|
||||
**/
|
462
.pytool/Plugin/UncrustifyCheck/uncrustify.cfg
Normal file
462
.pytool/Plugin/UncrustifyCheck/uncrustify.cfg
Normal file
@@ -0,0 +1,462 @@
|
||||
## @file
|
||||
# Uncrustify Configuration File for EDK II C Code
|
||||
#
|
||||
# Coding Standard: https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/
|
||||
#
|
||||
# This configuration file is meant to be a "best attempt" to align with the
|
||||
# definitions in the EDK II C Coding Standards Specification.
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
# Force UTF-8 encoding (no UTF-16)
|
||||
enable_digraphs = false
|
||||
utf8_byte = false
|
||||
utf8_force = true
|
||||
|
||||
# Code width / line splitting
|
||||
#code_width =120 # TODO: This causes non-deterministic behaviour in some cases when code wraps
|
||||
ls_code_width =false
|
||||
ls_for_split_full =true
|
||||
ls_func_split_full =true
|
||||
pos_comma =trail
|
||||
|
||||
# 5.1.7 All files must end with CRLF
|
||||
newlines = crlf
|
||||
|
||||
# 5.1.2 Do not use tab characters
|
||||
|
||||
cmt_convert_tab_to_spaces = true # Whether to convert all tabs to spaces in comments. If false, tabs in
|
||||
# comments are left alone, unless used for indenting.
|
||||
indent_columns = 2 # Number of spaces for indentation
|
||||
indent_with_tabs = 0 # Do not use TAB characters
|
||||
string_replace_tab_chars = true # Replace TAB with SPACE
|
||||
# Note: This will break .robot files but is needed for edk2 style
|
||||
|
||||
# 5.2.1.1 There shall be only one statement on a line (statement ends with ;)
|
||||
nl_multi_line_cond = true # Add a newline between ')' and '{' if the ')' is on a different line than
|
||||
# the if/for/etc.
|
||||
nl_after_semicolon = true # Whether to add a newline after semicolons, except in 'for' statements.
|
||||
|
||||
# 5.2.1.3 An open brace '{' goes on the same line as the closing parenthesis ')' of simple predicate expressions
|
||||
mod_full_brace_do = add # Add or remove braces on a single-line 'do' statement.
|
||||
mod_full_brace_for = add
|
||||
mod_full_brace_function = add # Add or remove braces on a single-line function definition.
|
||||
mod_full_brace_if = add # Add or remove braces on a single-line 'if' statement. Braces will not be
|
||||
# removed if the braced statement contains an 'else'.
|
||||
mod_full_brace_if_chain = false
|
||||
mod_full_brace_while = add
|
||||
|
||||
# 5.2.1.4 A close brace '}' always goes at the beginning of the last line of the body
|
||||
eat_blanks_after_open_brace = true
|
||||
eat_blanks_before_close_brace = true # Whether to remove blank lines before '}'.
|
||||
|
||||
# 5.2.2.2 Always put space before and after binary operators.
|
||||
sp_assign = add # Add or remove space around assignment operator '=', '+=', etc.
|
||||
sp_assign_default = add
|
||||
sp_bool = add # Add or remove space around boolean operators '&&' and '||'.
|
||||
sp_compare = add # Add or remove space around compare operator '<', '>', '==', etc.
|
||||
|
||||
# 5.2.2.3 Do not put space between unary operators and their object
|
||||
sp_addr = remove # A or remove space after the '&' (address-of) unary operator.
|
||||
sp_incdec = remove # Add or remove space between '++' and '--' the word to which it is being
|
||||
# applied, as in '(--x)' or 'y++;'.
|
||||
sp_inv = remove # Add or remove space after the '~' (invert) unary operator.
|
||||
sp_not = remove # Add or remove space after the '!' (not) unary operator.
|
||||
sp_sign = remove # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'.
|
||||
|
||||
# 5.2.2.4 Subsequent lines of multi-line function calls should line up two spaces from the beginning of the function
|
||||
# name
|
||||
nl_func_call_args_multi_line = true # Whether to add a newline after each ',' in a function call if '(' and ')'
|
||||
# are in different lines.
|
||||
nl_func_call_args_multi_line_ignore_closures = false
|
||||
|
||||
# - Indent each argument 2 spaces from the start of the function name. If a
|
||||
# function is called through a structure or union member, of type
|
||||
# pointer-to-function, then indent each argument 2 spaces from the start of the
|
||||
# member name.
|
||||
indent_func_call_edk2_style = true # Use EDK2 indentation style for function calls (**CUSTOM SETTING**)
|
||||
indent_paren_after_func_call = true # Whether to indent the open parenthesis of a function call, if the
|
||||
# parenthesis is on its own line.
|
||||
|
||||
# - Align the close parenthesis with the start of the last argument
|
||||
indent_paren_close = 0 # How to indent a close parenthesis after a newline.
|
||||
# (0: Body, 1: Openparenthesis, 2: Brace level)
|
||||
|
||||
|
||||
# 5.2.2.5 Always put space after commas or semicolons that separate items
|
||||
sp_after_comma = force # Add or remove space after ',', i.e. 'a,b' vs. 'a, b'.
|
||||
sp_before_comma = remove # Add or remove space before ','.
|
||||
|
||||
# 5.2.2.6 Always put space before an open parenthesis
|
||||
sp_after_sparen = add # Add or remove space after ')' of control statements.
|
||||
sp_attribute_paren = add # Add or remove space between '__attribute__' and '('.
|
||||
sp_before_sparen = force # Add or remove space before '(' of control statements
|
||||
# ('if', 'for', 'switch', 'while', etc.).
|
||||
sp_defined_paren = force # Add or remove space between 'defined' and '(' in '#if defined (FOO)'.
|
||||
sp_func_call_paren = force # Add or remove space between function name and '(' on function calls.
|
||||
sp_func_call_paren_empty = force # Add or remove space between function name and '()' on function calls
|
||||
# without parameters. If set to ignore (the default), sp_func_call_paren is
|
||||
# used.
|
||||
sp_func_def_paren = add # Add or remove space between alias name and '(' of a non-pointer function
|
||||
# type typedef.
|
||||
sp_func_proto_paren = add # Add or remove space between function name and '()' on function declaration
|
||||
sp_sizeof_paren = force # Add or remove space between 'sizeof' and '('.
|
||||
sp_type_func = add # Add or remove space between return type and function name. A minimum of 1
|
||||
# is forced except for pointer return types.
|
||||
|
||||
# Not specified, but also good style to remove spaces inside parentheses (Optional)
|
||||
sp_cparen_oparen = remove # Add or remove space between back-to-back parentheses, i.e. ')(' vs. ') ('.
|
||||
sp_inside_fparen = remove # Add or remove space inside function '(' and ')'.
|
||||
sp_inside_fparens = remove # Add or remove space inside empty function '()'.
|
||||
sp_inside_paren = remove # Add or remove space inside '(' and ')'.
|
||||
sp_inside_paren_cast = remove # Add or remove spaces inside cast parentheses. '(int)x'
|
||||
sp_inside_square = remove # Add or remove space inside a non-empty '[' and ']'.
|
||||
sp_paren_paren = remove # Add or remove space between nested parentheses, i.e. '((' vs. ') )'.
|
||||
sp_square_fparen = remove # Add or remove space between ']' and '(' when part of a function call.
|
||||
|
||||
# 5.2.2.7 Put a space before an open brace if it is not on its own line
|
||||
sp_do_brace_open = force # Add or remove space between 'do' and '{'.
|
||||
sp_paren_brace = force # Add or remove space between ')' and '{'.
|
||||
sp_sparen_brace = force # Add or remove space between ')' and '{' of of control statements.
|
||||
|
||||
# 5.2.2.8 Do not put spaces around structure member and pointer operators
|
||||
sp_after_byref = remove # Add or remove space after reference sign '&', if followed by a word.
|
||||
sp_before_byref = add # Add or remove space before a reference sign '&'.
|
||||
sp_deref = remove # Add or remove space after the '*' (dereference) unary operator. This does
|
||||
# not affect the spacing after a '*' that is part of a type.
|
||||
sp_member = remove # Add or remove space around the '.' or '->' operators.
|
||||
|
||||
# 5.2.2.9 Do not put spaces before open brackets of array subscripts
|
||||
sp_before_square = remove # Add or remove space before '[' (except '[]').
|
||||
sp_before_squares = remove # Add or remove space before '[]'.
|
||||
sp_before_vardef_square = remove # Add or remove space before '[' for a variable definition.
|
||||
|
||||
# 5.2.2.10 Use extra parentheses rather than depending on in-depth knowledge of the order of precedence of C
|
||||
mod_full_paren_if_bool = true # Whether to fully parenthesize Boolean expressions in 'while' and 'if'
|
||||
# statement, as in 'if (a && b > c)' => 'if (a && (b > c))'.
|
||||
|
||||
# 5.2.2.11 Align a continuation line with the part of the line that it continues.
|
||||
use_indent_continue_only_once = true
|
||||
|
||||
# Additional '{}' bracing rules (Optional)
|
||||
# NOTE - The style guide specifies two different styles for braces,
|
||||
# so these are ignored for now to allow developers some flexibility.
|
||||
nl_after_brace_close = true # Whether to add a newline after '}'. Does not apply if followed by a
|
||||
# necessary ';'.
|
||||
nl_brace_else = remove # Add or remove newline between '}' and 'else'.
|
||||
nl_brace_while = remove # Add or remove newline between '}' and 'while' of 'do' statement.
|
||||
nl_do_brace = remove # Add or remove newline between 'do' and '{'.
|
||||
nl_else_brace = remove # Add or remove newline between 'else' and '{'.
|
||||
nl_else_if = remove # Add or remove newline between 'else' and 'if'.
|
||||
nl_elseif_brace = remove # Add or remove newline between 'else if' and '{'.
|
||||
nl_enum_brace = remove # Add or remove newline between 'enum' and '{'.
|
||||
nl_fcall_brace = remove # Add or remove newline between a function call's ')' and '{',
|
||||
# as in 'list_for_each(item, &list) { }'.
|
||||
nl_for_brace = remove # Add or remove newline between 'for' and '{'.
|
||||
nl_if_brace = remove # Add or remove newline between 'if' and '{'.
|
||||
nl_struct_brace = remove # Add or remove newline between 'struct and '{'.
|
||||
nl_switch_brace = remove # Add or remove newline between 'switch' and '{'.
|
||||
nl_union_brace = remove # Add or remove newline between 'union' and '{'.
|
||||
nl_while_brace = remove # Add or remove newline between 'while' and '{'.
|
||||
|
||||
# Additional whitespace rules (Optional)
|
||||
sp_after_ptr_star = remove # Add or remove space after pointer star '*', if followed by a word.
|
||||
# Useful when paired with align_var_def_star_style==2
|
||||
sp_after_ptr_star_func = remove # Add or remove space after a pointer star '*', if followed by a function
|
||||
# prototype or function definition.
|
||||
sp_after_semi = remove # Add or remove space after ';', except when followed by a comment.
|
||||
sp_before_case_colon = remove # Add or remove space before case ':'.
|
||||
sp_before_ptr_star = add # Add or remove space before pointer star '*'.
|
||||
sp_before_ptr_star_func = add # Add or remove space before a pointer star '*', if followed by a function
|
||||
# prototype or function definition.
|
||||
sp_before_semi = remove # Add or remove space before ';'
|
||||
sp_before_semi_for = remove # Add or remove space before ';' in non-empty 'for' statements.
|
||||
sp_before_semi_for_empty = add # Add or remove space before a semicolon of an empty part of a for statement
|
||||
sp_between_ptr_star = remove # Add or remove space between pointer stars '*'. (ie, 'VOID **')
|
||||
sp_brace_close_while = force # Add or remove space between '}' and 'while'.
|
||||
|
||||
sp_after_cast = remove
|
||||
sp_after_type = add
|
||||
sp_balance_nested_parens = false
|
||||
sp_before_nl_cont = add
|
||||
sp_before_square_asm_block = ignore
|
||||
sp_before_unnamed_byref = add
|
||||
sp_brace_brace = ignore
|
||||
sp_brace_else = force
|
||||
sp_brace_typedef = add
|
||||
sp_case_label = force
|
||||
sp_cmt_cpp_doxygen = true
|
||||
sp_cond_colon = add
|
||||
sp_cond_question = add
|
||||
sp_cpp_cast_paren = force
|
||||
sp_else_brace = force
|
||||
sp_endif_cmt = force
|
||||
sp_enum_assign = add
|
||||
sp_inside_braces = force
|
||||
sp_inside_braces_empty = force
|
||||
sp_inside_braces_enum = force
|
||||
sp_inside_braces_struct = force
|
||||
sp_pp_concat = add
|
||||
sp_pp_stringify = add
|
||||
sp_return_paren = add
|
||||
sp_special_semi = force
|
||||
sp_while_paren_open = force
|
||||
|
||||
# Additional Indentation Rules
|
||||
indent_access_spec = 1
|
||||
indent_access_spec_body = false
|
||||
indent_align_assign = true
|
||||
indent_align_string = true
|
||||
indent_bool_paren = true
|
||||
indent_brace_parent = false
|
||||
indent_braces = false
|
||||
indent_braces_no_class = false
|
||||
indent_braces_no_func = true
|
||||
indent_braces_no_struct = false
|
||||
indent_class = false
|
||||
indent_class_colon = false
|
||||
indent_cmt_with_tabs = false # Whether to indent comments that are not at a brace level with tabs on
|
||||
# a tabstop. Requires indent_with_tabs=2. If false, will use spaces.
|
||||
indent_col1_comment = true
|
||||
indent_col1_multi_string_literal= true
|
||||
indent_comma_paren = true
|
||||
indent_else_if = true
|
||||
indent_extern = false
|
||||
indent_first_bool_expr = true
|
||||
|
||||
indent_func_def_param_paren_pos_threshold = 0
|
||||
indent_func_param_double = false
|
||||
indent_func_proto_param = true
|
||||
indent_ignore_asm_block = true
|
||||
indent_label = 1
|
||||
indent_member = 2
|
||||
indent_namespace = false
|
||||
indent_param = 2
|
||||
indent_paren_nl = false
|
||||
indent_paren_open_brace = false
|
||||
indent_preserve_sql = false
|
||||
indent_relative_single_line_comments = false
|
||||
indent_sing_line_comments = 0
|
||||
indent_single_newlines = false
|
||||
indent_square_nl = false
|
||||
indent_switch_case = 2
|
||||
indent_template_param = true
|
||||
indent_var_def_blk = 0
|
||||
indent_var_def_cont = false
|
||||
|
||||
# Tidy-up rules (Optional)
|
||||
mod_move_case_break = true # Whether to move a 'break' that appears after a fully braced 'case'
|
||||
# before the close brace, as in 'case X: { ... } break;' =>
|
||||
# 'case X: { ... break; }'.
|
||||
mod_pawn_semicolon = false
|
||||
mod_remove_empty_return = false # Whether to remove a void 'return;' that appears as the last statement
|
||||
# in a function.
|
||||
mod_remove_extra_semicolon = true
|
||||
mod_sort_import = false
|
||||
mod_sort_include = false
|
||||
mod_sort_using = false
|
||||
nl_after_case = false # Whether to add a newline after a 'case' statement.
|
||||
nl_end_of_file = force # Add or remove newline at the end of the file.
|
||||
nl_end_of_file_min = 1 # The minimum number of newlines at the end of the file
|
||||
nl_max = 2 # The maximum number of consecutive newlines (3 = 2 blank lines).
|
||||
nl_start_of_file = remove # Add or remove newlines at the start of the file.
|
||||
|
||||
# Code alignment rules (Optional)
|
||||
align_asm_colon = false
|
||||
align_assign_span = 1 # The span for aligning on '=' in assignments.
|
||||
align_assign_thresh = 0
|
||||
align_edk2_style = true # Whether to apply edk2-specific alignment formatting
|
||||
align_enum_equ_span = 1 # The span for aligning on '=' in enums.
|
||||
align_func_params = true # Whether to align variable definitions in prototypes and functions.
|
||||
align_func_params_gap = 2
|
||||
align_func_params_span = 2 # The span for aligning parameter definitions in function on parameter name.
|
||||
align_func_params_thresh = 0
|
||||
align_func_proto_span = 0
|
||||
align_keep_tabs = false
|
||||
align_left_shift = false
|
||||
align_mix_var_proto = false
|
||||
align_nl_cont = false
|
||||
align_oc_decl_colon = false
|
||||
align_on_operator = false
|
||||
align_on_tabstop = false
|
||||
align_pp_define_gap = 2
|
||||
align_pp_define_span = 1
|
||||
align_right_cmt_at_col = 0 # Align trailing comment at or beyond column N; 'pulls in' comments as
|
||||
# a bonus side effect (0=ignore)
|
||||
align_right_cmt_gap = 0 # If a trailing comment is more than this number of columns away from the
|
||||
# text it follows,
|
||||
# it will qualify for being aligned. This has to be > 0 to do anything.
|
||||
align_right_cmt_mix = false # If aligning comments, mix with comments after '}' and #endif with less
|
||||
# than 3 spaces before the comment
|
||||
align_right_cmt_same_level = true # Whether to only align trailing comments that are at the same brace level.
|
||||
align_right_cmt_span = 2 # The span for aligning comments that end lines.
|
||||
align_same_func_call_params = false
|
||||
align_single_line_brace = true
|
||||
align_single_line_func = true
|
||||
align_struct_init_span = 1 # The span for aligning struct initializer values.
|
||||
align_typedef_amp_style = 1
|
||||
align_typedef_func = 1 # How to align typedef'd functions with other typedefs.
|
||||
# (0: No align, 1: Align open paranthesis, 2: Align function type name)
|
||||
align_typedef_gap = 2
|
||||
align_typedef_span = 1 # The span for aligning single-line typedefs.
|
||||
align_typedef_star_style = 1
|
||||
align_var_def_amp_style = 1
|
||||
align_var_def_attribute = true
|
||||
align_var_def_colon = true # Whether to align the colon in struct bit fields.
|
||||
align_var_def_gap = 2 # The gap (minimum spacing for aligned items) for variable definitions.
|
||||
align_var_def_inline = false
|
||||
align_var_def_span = 1 # The span (lines needed to align) for aligning variable definitions.
|
||||
align_var_def_star_style = 1 # How to consider (or treat) the '*' in the alignment of variable
|
||||
# definitions.
|
||||
# 0: Part of the type 'void * foo;' (default)
|
||||
# 1: Part of the variable 'void *foo;'
|
||||
# 2: Dangling 'void *foo;'
|
||||
# (Note - should also set sp_after_ptr_star=remove)
|
||||
align_var_struct_gap = 4
|
||||
align_var_struct_span = 8 # The span for aligning struct/union member definitions.
|
||||
align_var_struct_thresh = 0
|
||||
align_with_tabs = false
|
||||
|
||||
# Comment formatting
|
||||
cmt_align_doxygen_javadoc_tags = true # Whether to align doxygen javadoc-style tags ('@param', '@return', etc.)
|
||||
# TODO: Eats '[' in '[in]'
|
||||
cmt_c_group = false
|
||||
cmt_c_nl_end = true # Whether to add a newline before the closing '*/' of the combined c-comment.
|
||||
cmt_c_nl_start = true
|
||||
cmt_cpp_group = false
|
||||
cmt_cpp_nl_end = true
|
||||
cmt_cpp_nl_start = true
|
||||
cmt_cpp_to_c = false
|
||||
cmt_indent_multi = false # Whether to apply changes to multi-line comments, including cmt_width,
|
||||
# keyword substitution and leading chars.
|
||||
cmt_insert_before_preproc = false
|
||||
#cmt_insert_file_header = default_file_header.txt
|
||||
#cmt_insert_func_header = default_function_header.txt
|
||||
cmt_multi_check_last = false
|
||||
cmt_multi_first_len_minimum = 2
|
||||
cmt_reflow_mode = 1 # How to reflow comments.
|
||||
# (0:No reflow, 1:No touching at all, 2: Full reflow)
|
||||
cmt_sp_after_star_cont = 0 # The number of spaces to insert after the star on subsequent comment lines.
|
||||
cmt_sp_before_star_cont = 0 # The number of spaces to insert at the start of subsequent comment lines.
|
||||
cmt_star_cont = false # Whether to put a star on subsequent comment lines.
|
||||
cmt_width = 120 # Try to wrap comments at N columns.
|
||||
sp_cmt_cpp_start = add # Add or remove space after the opening of a C++ comment, as in
|
||||
# '// <here> A'. NOTE: Breaks indentation within comments.
|
||||
|
||||
# Function definitions / declarations
|
||||
indent_func_call_param = false # Whether to indent continued function call parameters one indent level,
|
||||
# rather than aligning parameters under the open parenthesis.
|
||||
indent_func_class_param = false # Whether to indent continued function call declaration one indent level,
|
||||
# rather than aligning parameters under the open parenthesis.
|
||||
indent_func_ctor_var_param = false # Whether to indent continued class variable constructors one indent level,
|
||||
# rather than aligning parameters under the open parenthesis.
|
||||
indent_func_def_param = true # Whether to indent continued function definition parameters one indent
|
||||
# level, rather than aligning parameters under the open parenthesis.
|
||||
nl_fdef_brace = add # Add or remove newline between function signature and '{'.
|
||||
nl_func_call_end_multi_line = true # Whether to add a newline before ')' in a function call if '(' and ')' are
|
||||
# in different lines.
|
||||
nl_func_call_paren = remove # Add or remove newline between a function name and the opening '(' in the
|
||||
# call.
|
||||
nl_func_call_start_multi_line = true # Whether to add a newline after '(' in a function call if '(' and ')' are
|
||||
# in different lines.
|
||||
nl_func_decl_args = force # Add or remove newline after each ',' in a function declaration.
|
||||
nl_func_decl_empty = add # Add or remove newline between '()' in a function declaration.
|
||||
nl_func_def_args = force # Add or remove newline after each ',' in a function definition.
|
||||
nl_func_def_empty = add # Add or remove newline between '()' in a function definition.
|
||||
nl_func_def_paren = remove # Add or remove newline between a function name and the opening '('
|
||||
# in the definition.
|
||||
nl_func_paren = remove # Add or remove newline between a function name and the opening '(' in
|
||||
# the declaration.
|
||||
nl_func_type_name = add # Add or remove newline between return type and function name in a function
|
||||
# definition.
|
||||
sp_fparen_brace = force # Add or remove space between ')' and '{' of function.
|
||||
use_indent_func_call_param = true # indent_func_call_param will be used
|
||||
|
||||
# Additional Newline Rules
|
||||
nl_after_brace_open = true # Whether to add a newline after '{'. This also adds a newline
|
||||
# before the matching '}'.
|
||||
nl_after_brace_open_cmt = true # Whether to add a newline between the open brace and a
|
||||
# trailing single-line comment.
|
||||
# Requires nl_after_brace_open = true.
|
||||
nl_after_do = add # Add or remove blank line after 'do/while' statement.
|
||||
nl_after_for = add # Add or remove blank line after 'for' statement.
|
||||
nl_after_func_body = 2 # The number of newlines after '}' of a multi-line function body
|
||||
nl_after_func_body_one_liner = 2
|
||||
nl_after_func_proto = 2
|
||||
nl_after_func_proto_group = 2
|
||||
nl_after_if = add
|
||||
nl_after_multiline_comment = false
|
||||
nl_after_return = false
|
||||
nl_after_struct = 2
|
||||
nl_after_switch = add
|
||||
nl_after_vbrace_close = true
|
||||
nl_after_vbrace_open = true
|
||||
nl_after_vbrace_open_empty = true
|
||||
nl_after_while = add
|
||||
nl_assign_leave_one_liners = true
|
||||
nl_before_block_comment = 2
|
||||
nl_before_case = false
|
||||
nl_before_do = ignore
|
||||
nl_before_for = ignore
|
||||
nl_before_if = ignore
|
||||
nl_before_switch = ignore
|
||||
nl_before_while = ignore
|
||||
nl_before_whole_file_ifdef = 2
|
||||
nl_brace_brace = force
|
||||
nl_brace_struct_var = remove
|
||||
nl_case_colon_brace = add
|
||||
nl_class_leave_one_liners = false
|
||||
nl_collapse_empty_body = false
|
||||
nl_comment_func_def = 1
|
||||
nl_create_for_one_liner = false
|
||||
nl_create_if_one_liner = false
|
||||
nl_create_while_one_liner = false
|
||||
nl_define_macro = false
|
||||
nl_ds_struct_enum_close_brace = true
|
||||
nl_ds_struct_enum_cmt = false
|
||||
nl_enum_leave_one_liners = false
|
||||
nl_func_decl_end = add
|
||||
nl_func_decl_start = add
|
||||
nl_func_def_end = add
|
||||
nl_func_def_start = add
|
||||
nl_func_leave_one_liners = false
|
||||
nl_func_proto_type_name = add
|
||||
nl_func_var_def_blk = 1
|
||||
nl_getset_leave_one_liners = false
|
||||
nl_if_leave_one_liners = false
|
||||
nl_multi_line_define = false
|
||||
nl_squeeze_ifdef = false
|
||||
nl_var_def_blk_end = 0
|
||||
nl_var_def_blk_start = 0
|
||||
|
||||
# Preprocessor Rules
|
||||
pp_define_at_level = true
|
||||
pp_if_indent_code = false
|
||||
pp_indent_func_def = false
|
||||
pp_indent_extern = false
|
||||
pp_ignore_define_body = true # Workaround: Turn off processing for #define body
|
||||
# (current rules do not work for some defines)
|
||||
pp_indent = add
|
||||
pp_indent_at_level = true
|
||||
pp_indent_count = 2
|
||||
pp_indent_if = 2
|
||||
pp_indent_region = 2
|
||||
pp_region_indent_code = false
|
||||
pp_space = remove
|
||||
|
||||
#
|
||||
# The tokens below are assigned specific types so they are always recognized properly.
|
||||
#
|
||||
|
||||
# Explicitly define EDK II qualifiers
|
||||
set QUALIFIER CONST
|
||||
set QUALIFIER EFIAPI
|
||||
set QUALIFIER IN
|
||||
set QUALIFIER OPTIONAL
|
||||
set QUALIFIER OUT
|
||||
|
||||
# Explicitly define EDK II types
|
||||
set TYPE EFI_STATUS
|
||||
set TYPE VOID
|
16
.pytool/Plugin/UncrustifyCheck/uncrustify_ext_dep.yaml
Normal file
16
.pytool/Plugin/UncrustifyCheck/uncrustify_ext_dep.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
## @file
|
||||
# Downloads the Uncrustify application from a Project Mu NuGet package.
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
"id": "uncrustify-ci-1",
|
||||
"scope": "cibuild",
|
||||
"type": "nuget",
|
||||
"name": "mu-uncrustify-release",
|
||||
"source": "https://pkgs.dev.azure.com/projectmu/Uncrustify/_packaging/mu_uncrustify/nuget/v3/index.json",
|
||||
"version": "73.0.3",
|
||||
"flags": ["set_shell_var", "host_specific"],
|
||||
"var_name": "UNCRUSTIFY_CI_PATH"
|
||||
}
|
11
.pytool/Plugin/UncrustifyCheck/uncrustify_plug_in.yaml
Normal file
11
.pytool/Plugin/UncrustifyCheck/uncrustify_plug_in.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
## @file
|
||||
# CiBuildPlugin used to check coding standard compliance of EDK II style C source code
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
"scope": "cibuild",
|
||||
"name": "Uncrustify Coding Standard Test",
|
||||
"module": "UncrustifyCheck"
|
||||
}
|
@@ -4,8 +4,8 @@
|
||||
|
||||
| Package | Windows VS2019 (IA32/X64)| Ubuntu GCC (IA32/X64/ARM/AARCH64) | Known Issues |
|
||||
| :---- | :----- | :---- | :--- |
|
||||
| ArmPkg |
|
||||
| ArmPlatformPkg |
|
||||
| ArmPkg | | :heavy_check_mark: |
|
||||
| ArmPlatformPkg | | :heavy_check_mark: |
|
||||
| ArmVirtPkg | SEE PACKAGE README | SEE PACKAGE README |
|
||||
| CryptoPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
|
||||
| DynamicTablesPkg | | :heavy_check_mark: |
|
||||
@@ -254,6 +254,20 @@ Install
|
||||
|
||||
More cspell info: https://github.com/streetsidesoftware/cspell
|
||||
|
||||
### License Checking - LicenseCheck
|
||||
|
||||
Scans all new added files in a package to make sure code is contributed under
|
||||
BSD-2-Clause-Patent.
|
||||
|
||||
### Ecc tool - EccCheck
|
||||
|
||||
Run the Ecc tool on the package. The Ecc tool is available in the BaseTools
|
||||
package. It checks that the code complies to the EDKII coding standard.
|
||||
|
||||
### Coding Standard Compliance - UncrustifyCheck
|
||||
|
||||
Runs the Uncrustify application to check for coding standard compliance issues.
|
||||
|
||||
## PyTool Scopes
|
||||
|
||||
Scopes are how the PyTool ext_dep, path_env, and plugins are activated. Meaning
|
||||
|
243
ArmPkg/ArmPkg.ci.yaml
Normal file
243
ArmPkg/ArmPkg.ci.yaml
Normal file
@@ -0,0 +1,243 @@
|
||||
## @file
|
||||
# CI configuration for ArmPkg
|
||||
#
|
||||
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
## options defined .pytool/Plugin/LicenseCheck
|
||||
"LicenseCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
|
||||
"EccCheck": {
|
||||
## Exception sample looks like below:
|
||||
## "ExceptionList": [
|
||||
## "<ErrorID>", "<KeyWord>"
|
||||
## ]
|
||||
"ExceptionList": [
|
||||
],
|
||||
## Both file path and directory path are accepted.
|
||||
"IgnoreFiles": [
|
||||
"Library/ArmSoftFloatLib/berkeley-softfloat-3",
|
||||
"Library/ArmSoftFloatLib/ArmSoftFloatLib.c",
|
||||
"Library/CompilerIntrinsicsLib",
|
||||
"Universal/Smbios/SmbiosMiscDxe"
|
||||
]
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/CompilerPlugin
|
||||
"CompilerPlugin": {
|
||||
"DscPath": "ArmPkg.dsc"
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
|
||||
"HostUnitTestCompilerPlugin": {
|
||||
"DscPath": "" # Don't support this test
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/CharEncodingCheck
|
||||
"CharEncodingCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/DependencyCheck
|
||||
"DependencyCheck": {
|
||||
"AcceptableDependencies": [
|
||||
"ArmPlatformPkg/ArmPlatformPkg.dec",
|
||||
"ArmPkg/ArmPkg.dec",
|
||||
"EmbeddedPkg/EmbeddedPkg.dec",
|
||||
"MdeModulePkg/MdeModulePkg.dec",
|
||||
"MdePkg/MdePkg.dec",
|
||||
"ShellPkg/ShellPkg.dec"
|
||||
],
|
||||
# For host based unit tests
|
||||
"AcceptableDependencies-HOST_APPLICATION":[
|
||||
"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
|
||||
],
|
||||
# For UEFI shell based apps
|
||||
"AcceptableDependencies-UEFI_APPLICATION":[],
|
||||
"IgnoreInf": []
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/DscCompleteCheck
|
||||
"DscCompleteCheck": {
|
||||
"IgnoreInf": [],
|
||||
"DscPath": "ArmPkg.dsc"
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
|
||||
"HostUnitTestDscCompleteCheck": {
|
||||
"IgnoreInf": [""],
|
||||
"DscPath": "" # Don't support this test
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/GuidCheck
|
||||
"GuidCheck": {
|
||||
"IgnoreGuidName": [],
|
||||
"IgnoreGuidValue": [],
|
||||
"IgnoreFoldersAndFiles": [],
|
||||
"IgnoreDuplicates": [],
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/LibraryClassCheck
|
||||
"LibraryClassCheck": {
|
||||
"IgnoreHeaderFile": []
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/SpellCheck
|
||||
"SpellCheck": {
|
||||
"AuditOnly": False,
|
||||
"IgnoreFiles": [
|
||||
"Library/ArmSoftFloatLib/berkeley-softfloat-3/**"
|
||||
], # use gitignore syntax to ignore errors
|
||||
# in matching files
|
||||
"ExtendWords": [
|
||||
"api's",
|
||||
"ackintid",
|
||||
"actlr",
|
||||
"aeabi",
|
||||
"asedis",
|
||||
"ashldi",
|
||||
"ashrdi",
|
||||
"baddr",
|
||||
"ccidx",
|
||||
"ccsidr",
|
||||
"clidr",
|
||||
"clrex",
|
||||
"clzsi",
|
||||
"cnthctl",
|
||||
"cortexa",
|
||||
"cpacr",
|
||||
"cpuactlr",
|
||||
"csselr",
|
||||
"ctzsi",
|
||||
"cygdrive",
|
||||
"cygpaths",
|
||||
"datas",
|
||||
"dcmpeq",
|
||||
"dcmpge",
|
||||
"dcmpgt",
|
||||
"dcmple",
|
||||
"dcmplt",
|
||||
"ddisable",
|
||||
"divdi",
|
||||
"divsi",
|
||||
"dmdepkg",
|
||||
"dpref",
|
||||
"drsub",
|
||||
"fcmpeq",
|
||||
"fcmpge",
|
||||
"fcmpgt",
|
||||
"fcmple",
|
||||
"fcmplt",
|
||||
"ffreestanding",
|
||||
"frsub",
|
||||
"hisilicon",
|
||||
"iccabpr",
|
||||
"iccbpr",
|
||||
"icciar",
|
||||
"iccicr",
|
||||
"icciidr",
|
||||
"iccpir",
|
||||
"iccpmr",
|
||||
"iccrpr",
|
||||
"icdabr",
|
||||
"icdicer",
|
||||
"icdicfr",
|
||||
"icdicpr",
|
||||
"icdictr",
|
||||
"icdiidr",
|
||||
"icdiser",
|
||||
"icdisr",
|
||||
"icdppisr",
|
||||
"icdsgir",
|
||||
"icdspr",
|
||||
"icenabler",
|
||||
"intid",
|
||||
"ipriority",
|
||||
"irouter",
|
||||
"isenabler",
|
||||
"istatus",
|
||||
"itargets",
|
||||
"lable",
|
||||
"ldivmod",
|
||||
"ldmdb",
|
||||
"ldmia",
|
||||
"ldrbt",
|
||||
"ldrex",
|
||||
"ldrexb",
|
||||
"ldrexd",
|
||||
"ldrexh",
|
||||
"ldrhbt",
|
||||
"ldrht",
|
||||
"ldrsb",
|
||||
"ldrsbt",
|
||||
"ldrsh",
|
||||
"lshrdi",
|
||||
"moddi",
|
||||
"modsi",
|
||||
"mpcore",
|
||||
"mpidr",
|
||||
"muldi",
|
||||
"mullu",
|
||||
"nonshareable",
|
||||
"nsacr",
|
||||
"nsasedis",
|
||||
"nuvia",
|
||||
"oldit",
|
||||
"pcten",
|
||||
"plpis",
|
||||
"procno",
|
||||
"readc",
|
||||
"revsh",
|
||||
"rfedb",
|
||||
"sctlr",
|
||||
"smccc",
|
||||
"smlabb",
|
||||
"smlabt",
|
||||
"smlad",
|
||||
"smladx",
|
||||
"smlatb",
|
||||
"smlatt",
|
||||
"smlawb",
|
||||
"smlawt",
|
||||
"smlsd",
|
||||
"smlsdx",
|
||||
"smmla",
|
||||
"smmlar",
|
||||
"smmls",
|
||||
"smmlsr",
|
||||
"sourcery",
|
||||
"srsdb",
|
||||
"ssacr",
|
||||
"stmdb",
|
||||
"stmia",
|
||||
"strbt",
|
||||
"strexb",
|
||||
"strexd",
|
||||
"strexh",
|
||||
"strht",
|
||||
"switchu",
|
||||
"tpidrurw",
|
||||
"ttbcr",
|
||||
"typer",
|
||||
"ucmpdi",
|
||||
"udivdi",
|
||||
"udivmoddi",
|
||||
"udivsi",
|
||||
"uefi's",
|
||||
"uldiv",
|
||||
"umoddi",
|
||||
"umodsi",
|
||||
"usada",
|
||||
"vlpis",
|
||||
"writec"
|
||||
], # words to extend to the dictionary for this package
|
||||
"IgnoreStandardPaths": [ # Standard Plugin defined paths that
|
||||
"*.asm", "*.s" # should be ignore
|
||||
],
|
||||
"AdditionalIncludePaths": [] # Additional paths to spell check
|
||||
# (wildcards supported)
|
||||
}
|
||||
}
|
@@ -2,7 +2,8 @@
|
||||
# ARM processor package.
|
||||
#
|
||||
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -27,15 +28,68 @@
|
||||
Include # Root include for the package
|
||||
|
||||
[LibraryClasses.common]
|
||||
ArmLib|Include/Library/ArmLib.h
|
||||
ArmMmuLib|Include/Library/ArmMmuLib.h
|
||||
SemihostLib|Include/Library/Semihosting.h
|
||||
DefaultExceptionHandlerLib|Include/Library/DefaultExceptionHandlerLib.h
|
||||
## @libraryclass Convert Arm instructions to a human readable format.
|
||||
#
|
||||
ArmDisassemblerLib|Include/Library/ArmDisassemblerLib.h
|
||||
|
||||
## @libraryclass Provides an interface to Arm generic counters.
|
||||
#
|
||||
ArmGenericTimerCounterLib|Include/Library/ArmGenericTimerCounterLib.h
|
||||
|
||||
## @libraryclass Provides an interface to initialize a
|
||||
# Generic Interrupt Controller (GIC).
|
||||
#
|
||||
ArmGicArchLib|Include/Library/ArmGicArchLib.h
|
||||
ArmMtlLib|ArmPlatformPkg/Include/Library/ArmMtlLib.h
|
||||
|
||||
## @libraryclass Provides a Generic Interrupt Controller (GIC)
|
||||
# configuration interface.
|
||||
#
|
||||
ArmGicLib|Include/Library/ArmGicLib.h
|
||||
|
||||
## @libraryclass Provides a HyperVisor Call (HVC) interface.
|
||||
#
|
||||
ArmHvcLib|Include/Library/ArmHvcLib.h
|
||||
|
||||
## @libraryclass Provides an interface to Arm registers.
|
||||
#
|
||||
ArmLib|Include/Library/ArmLib.h
|
||||
|
||||
## @libraryclass Provides a Mmu interface.
|
||||
#
|
||||
ArmMmuLib|Include/Library/ArmMmuLib.h
|
||||
|
||||
## @libraryclass Provides a Mailbox Transport Layer (MTL) interface
|
||||
# for the System Control and Management Interface (SCMI).
|
||||
#
|
||||
ArmMtlLib|Include/Library/ArmMtlLib.h
|
||||
|
||||
## @libraryclass Provides a System Monitor Call (SMC) interface.
|
||||
#
|
||||
ArmSmcLib|Include/Library/ArmSmcLib.h
|
||||
|
||||
## @libraryclass Provides a SuperVisor Call (SVC) interface.
|
||||
#
|
||||
ArmSvcLib|Include/Library/ArmSvcLib.h
|
||||
|
||||
## @libraryclass Provides a default exception handler.
|
||||
#
|
||||
DefaultExceptionHandlerLib|Include/Library/DefaultExceptionHandlerLib.h
|
||||
|
||||
## @libraryclass Provides an interface to query miscellaneous OEM
|
||||
# information.
|
||||
#
|
||||
OemMiscLib|Include/Library/OemMiscLib.h
|
||||
|
||||
## @libraryclass Provides an OpTee interface.
|
||||
#
|
||||
OpteeLib|Include/Library/OpteeLib.h
|
||||
|
||||
## @libraryclass Provides a semihosting interface.
|
||||
#
|
||||
SemihostLib|Include/Library/SemihostLib.h
|
||||
|
||||
## @libraryclass Provides an interface for a StandaloneMm Mmu.
|
||||
#
|
||||
StandaloneMmMmuLib|Include/Library/StandaloneMmMmuLib.h
|
||||
|
||||
[Guids.common]
|
||||
@@ -84,7 +138,7 @@
|
||||
# hardware coherency (i.e., no virtualization or cache coherent DMA)
|
||||
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x00000043
|
||||
|
||||
[PcdsFeatureFlag.AARCH64]
|
||||
[PcdsFeatureFlag.AARCH64, PcdsFeatureFlag.ARM]
|
||||
## Used to select method for requesting services from S-EL1.<BR><BR>
|
||||
# TRUE - Selects FF-A calls for communication between S-EL0 and SPMC.<BR>
|
||||
# FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<BR>
|
||||
@@ -284,9 +338,9 @@
|
||||
# UINT64 Mmio32CpuBase; // mapping target in 64-bit cpu-physical space
|
||||
# UINT64 Mmio64CpuBase; // mapping target in 64-bit cpu-physical space
|
||||
#
|
||||
# PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
|
||||
# PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
|
||||
# PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
|
||||
#
|
||||
# because (a) the target address space (ie. the cpu-physical space) is
|
||||
# 64-bit, and (b) the translation values are meant as offsets for *modular*
|
||||
@@ -303,11 +357,11 @@
|
||||
# UINT64 TranslatedMmio64Address; // output parameter
|
||||
#
|
||||
# TranslatedIoAddress = UntranslatedIoAddress +
|
||||
# PcdPciIoTranslation;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation;
|
||||
# TranslatedMmio32Address = (UINT64)UntranslatedMmio32Address +
|
||||
# PcdPciMmio32Translation;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio32Translation;
|
||||
# TranslatedMmio64Address = UntranslatedMmio64Address +
|
||||
# PcdPciMmio64Translation;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio64Translation;
|
||||
#
|
||||
# The modular arithmetic performed in UINT64 ensures that the translation
|
||||
# works correctly regardless of the relation between IoCpuBase and
|
||||
@@ -316,16 +370,20 @@
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x00000050
|
||||
gArmTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x00000051
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0|UINT64|0x00000052
|
||||
gArmTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT32|0x00000053
|
||||
gArmTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT32|0x00000054
|
||||
gArmTokenSpaceGuid.PcdPciMmio32Translation|0x0|UINT64|0x00000055
|
||||
gArmTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x00000056
|
||||
gArmTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x00000057
|
||||
gArmTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x00000058
|
||||
|
||||
#
|
||||
# Inclusive range of allowed PCI buses.
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x00000059
|
||||
gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x0000005A
|
||||
|
||||
[PcdsDynamicEx]
|
||||
#
|
||||
# This dynamic PCD hold the GUID of a firmware FFS which contains
|
||||
# the LinuxBoot payload.
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdLinuxBootFileGuid|{0x0}|VOID*|0x0000005C
|
||||
|
@@ -2,9 +2,10 @@
|
||||
# ARM processor package.
|
||||
#
|
||||
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, ARM Ltd. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
# Copyright (c) Microsoft Corporation.<BR>
|
||||
# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -32,17 +33,22 @@
|
||||
[PcdsFixedAtBuild]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
|
||||
|
||||
!include MdePkg/MdeLibs.dsc.inc
|
||||
|
||||
[LibraryClasses.common]
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
|
||||
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
|
||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
|
||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||
@@ -50,6 +56,7 @@
|
||||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
|
||||
|
||||
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
|
||||
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
|
||||
@@ -144,14 +151,18 @@
|
||||
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
|
||||
ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
|
||||
ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
||||
ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf
|
||||
|
||||
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf
|
||||
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
|
||||
|
||||
ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
|
||||
ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
|
||||
ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf
|
||||
|
||||
[Components.AARCH64]
|
||||
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
||||
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
|
||||
|
||||
[Components.AARCH64, Components.ARM]
|
||||
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
|
||||
|
@@ -24,9 +24,11 @@ ArmCrashDumpDxeInitialize (
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&mCpu);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return mCpu->RegisterInterruptHandler (mCpu,
|
||||
return mCpu->RegisterInterruptHandler (
|
||||
mCpu,
|
||||
EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS,
|
||||
&DefaultExceptionHandler);
|
||||
&DefaultExceptionHandler
|
||||
);
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ UINTN mGicNumInterrupts = 0;
|
||||
|
||||
HARDWARE_INTERRUPT_HANDLER *gRegisteredInterruptHandlers = NULL;
|
||||
|
||||
|
||||
/**
|
||||
Calculate GICD_ICFGRn base address and corresponding bit
|
||||
field Int_config[1] of the GIC distributor register.
|
||||
@@ -56,7 +55,7 @@ GicGetDistributorIcfgBaseAndBit (
|
||||
UINTN Field;
|
||||
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(Source < mGicNumInterrupts);
|
||||
ASSERT (Source < mGicNumInterrupts);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -71,8 +70,6 @@ GicGetDistributorIcfgBaseAndBit (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Register Handler for the specified interrupt source.
|
||||
|
||||
@@ -93,7 +90,7 @@ RegisterInterruptSource (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -108,7 +105,7 @@ RegisterInterruptSource (
|
||||
gRegisteredInterruptHandlers[Source] = Handler;
|
||||
|
||||
// If the interrupt handler is unregistered then disable the interrupt
|
||||
if (NULL == Handler){
|
||||
if (NULL == Handler) {
|
||||
return This->DisableInterruptSource (This, Source);
|
||||
} else {
|
||||
return This->EnableInterruptSource (This, Source);
|
||||
@@ -137,17 +134,28 @@ CpuArchEventProtocolNotify (
|
||||
// Unregister the default exception handler.
|
||||
Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Cpu->RegisterInterruptHandler() - %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
// Register to receive interrupts
|
||||
Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ,
|
||||
Context);
|
||||
Status = Cpu->RegisterInterruptHandler (
|
||||
Cpu,
|
||||
ARM_ARCH_EXCEPTION_IRQ,
|
||||
Context
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Cpu->RegisterInterruptHandler() - %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
}
|
||||
|
||||
gBS->CloseEvent (Event);
|
||||
@@ -163,7 +171,7 @@ InstallAndRegisterInterruptService (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CONST UINTN RihArraySize =
|
||||
(sizeof(HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);
|
||||
(sizeof (HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);
|
||||
|
||||
// Initialize the array for the Interrupt Handlers
|
||||
gRegisteredInterruptHandlers = AllocateZeroPool (RihArraySize);
|
||||
@@ -191,7 +199,8 @@ InstallAndRegisterInterruptService (
|
||||
TPL_CALLBACK,
|
||||
CpuArchEventProtocolNotify,
|
||||
InterruptHandler,
|
||||
&mCpuArchProtocolNotifyEventRegistration);
|
||||
&mCpuArchProtocolNotifyEventRegistration
|
||||
);
|
||||
|
||||
// Register for an ExitBootServicesEvent
|
||||
Status = gBS->CreateEvent (
|
||||
|
@@ -6,8 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __ARM_GIC_DXE_H__
|
||||
#define __ARM_GIC_DXE_H__
|
||||
#ifndef ARM_GIC_DXE_H_
|
||||
#define ARM_GIC_DXE_H_
|
||||
|
||||
#include <Library/ArmGicLib.h>
|
||||
#include <Library/ArmLib.h>
|
||||
@@ -55,7 +55,6 @@ GicV3DxeInitialize (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
// Shared code
|
||||
|
||||
/**
|
||||
@@ -76,4 +75,4 @@ GicGetDistributorIcfgBaseAndBit (
|
||||
OUT UINTN *Config1Bit
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_GIC_DXE_H_
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2018, ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2011-2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
@@ -24,13 +24,13 @@
|
||||
+ ARM_GICR_SGI_VLPI_FRAME_SIZE \
|
||||
+ ARM_GICR_SGI_RESERVED_FRAME_SIZE)
|
||||
|
||||
#define ISENABLER_ADDRESS(base,offset) ((base) + \
|
||||
#define ISENABLER_ADDRESS(base, offset) ((base) +\
|
||||
ARM_GICR_CTLR_FRAME_SIZE + ARM_GICR_ISENABLER + 4 * (offset))
|
||||
|
||||
#define ICENABLER_ADDRESS(base,offset) ((base) + \
|
||||
#define ICENABLER_ADDRESS(base, offset) ((base) +\
|
||||
ARM_GICR_CTLR_FRAME_SIZE + ARM_GICR_ICENABLER + 4 * (offset))
|
||||
|
||||
#define IPRIORITY_ADDRESS(base,offset) ((base) + \
|
||||
#define IPRIORITY_ADDRESS(base, offset) ((base) +\
|
||||
ARM_GICR_CTLR_FRAME_SIZE + ARM_GIC_ICDIPR + 4 * (offset))
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,14 @@ ArmGicGetMaxNumInterrupts (
|
||||
IN INTN GicDistributorBase
|
||||
)
|
||||
{
|
||||
return 32 * ((MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F) + 1);
|
||||
UINTN ItLines;
|
||||
|
||||
ItLines = MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F;
|
||||
|
||||
//
|
||||
// Interrupt ID 1020-1023 are reserved.
|
||||
//
|
||||
return (ItLines == 0x1f) ? 1020 : 32 * (ItLines + 1);
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -223,7 +230,8 @@ ArmGicSetInterruptPriority (
|
||||
Revision = ArmGicGetSupportedArchRevision ();
|
||||
if ((Revision == ARM_GIC_ARCH_REVISION_2) ||
|
||||
FeaturePcdGet (PcdArmGicV3WithV2Legacy) ||
|
||||
SourceIsSpi (Source)) {
|
||||
SourceIsSpi (Source))
|
||||
{
|
||||
MmioAndThenOr32 (
|
||||
GicDistributorBase + ARM_GIC_ICDIPR + (4 * RegOffset),
|
||||
~(0xff << RegShift),
|
||||
@@ -266,7 +274,8 @@ ArmGicEnableInterrupt (
|
||||
Revision = ArmGicGetSupportedArchRevision ();
|
||||
if ((Revision == ARM_GIC_ARCH_REVISION_2) ||
|
||||
FeaturePcdGet (PcdArmGicV3WithV2Legacy) ||
|
||||
SourceIsSpi (Source)) {
|
||||
SourceIsSpi (Source))
|
||||
{
|
||||
// Write set-enable register
|
||||
MmioWrite32 (
|
||||
GicDistributorBase + ARM_GIC_ICDISER + (4 * RegOffset),
|
||||
@@ -284,7 +293,7 @@ ArmGicEnableInterrupt (
|
||||
|
||||
// Write set-enable register
|
||||
MmioWrite32 (
|
||||
ISENABLER_ADDRESS(GicCpuRedistributorBase, RegOffset),
|
||||
ISENABLER_ADDRESS (GicCpuRedistributorBase, RegOffset),
|
||||
1 << RegShift
|
||||
);
|
||||
}
|
||||
@@ -310,7 +319,8 @@ ArmGicDisableInterrupt (
|
||||
Revision = ArmGicGetSupportedArchRevision ();
|
||||
if ((Revision == ARM_GIC_ARCH_REVISION_2) ||
|
||||
FeaturePcdGet (PcdArmGicV3WithV2Legacy) ||
|
||||
SourceIsSpi (Source)) {
|
||||
SourceIsSpi (Source))
|
||||
{
|
||||
// Write clear-enable register
|
||||
MmioWrite32 (
|
||||
GicDistributorBase + ARM_GIC_ICDICER + (4 * RegOffset),
|
||||
@@ -327,7 +337,7 @@ ArmGicDisableInterrupt (
|
||||
|
||||
// Write clear-enable register
|
||||
MmioWrite32 (
|
||||
ICENABLER_ADDRESS(GicCpuRedistributorBase, RegOffset),
|
||||
ICENABLER_ADDRESS (GicCpuRedistributorBase, RegOffset),
|
||||
1 << RegShift
|
||||
);
|
||||
}
|
||||
@@ -354,7 +364,8 @@ ArmGicIsInterruptEnabled (
|
||||
Revision = ArmGicGetSupportedArchRevision ();
|
||||
if ((Revision == ARM_GIC_ARCH_REVISION_2) ||
|
||||
FeaturePcdGet (PcdArmGicV3WithV2Legacy) ||
|
||||
SourceIsSpi (Source)) {
|
||||
SourceIsSpi (Source))
|
||||
{
|
||||
Interrupts = ((MmioRead32 (
|
||||
GicDistributorBase + ARM_GIC_ICDISER + (4 * RegOffset)
|
||||
)
|
||||
@@ -370,7 +381,7 @@ ArmGicIsInterruptEnabled (
|
||||
|
||||
// Read set-enable register
|
||||
Interrupts = MmioRead32 (
|
||||
ISENABLER_ADDRESS(GicCpuRedistributorBase, RegOffset)
|
||||
ISENABLER_ADDRESS (GicCpuRedistributorBase, RegOffset)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,58 +0,0 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#include <Base.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/ArmGicLib.h>
|
||||
|
||||
/*
|
||||
* This function configures the interrupts set by the mask to be secure.
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmGicSetSecureInterrupts (
|
||||
IN UINTN GicDistributorBase,
|
||||
IN UINTN* GicSecureInterruptMask,
|
||||
IN UINTN GicSecureInterruptMaskSize
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINT32 InterruptStatus;
|
||||
|
||||
// We must not have more interrupts defined by the mask than the number of available interrupts
|
||||
ASSERT(GicSecureInterruptMaskSize <= (ArmGicGetMaxNumInterrupts (GicDistributorBase) / 32));
|
||||
|
||||
// Set all the interrupts defined by the mask as Secure
|
||||
for (Index = 0; Index < GicSecureInterruptMaskSize; Index++) {
|
||||
InterruptStatus = MmioRead32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4));
|
||||
MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), InterruptStatus & (~GicSecureInterruptMask[Index]));
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmGicEnableDistributor (
|
||||
IN INTN GicDistributorBase
|
||||
)
|
||||
{
|
||||
// Turn on the GIC distributor
|
||||
MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 1);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmGicSetupNonSecure (
|
||||
IN UINTN MpId,
|
||||
IN INTN GicDistributorBase,
|
||||
IN INTN GicInterruptInterfaceBase
|
||||
)
|
||||
{
|
||||
ArmGicV2SetupNonSecure (MpId, GicDistributorBase, GicInterruptInterfaceBase);
|
||||
}
|
@@ -47,7 +47,7 @@ GicV2EnableInterruptSource (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ GicV2DisableInterruptSource (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ GicV2GetInterruptSourceState (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ GicV2GetInterruptSourceState (
|
||||
@param This Instance pointer for this protocol
|
||||
@param Source Hardware source of the interrupt
|
||||
|
||||
@retval EFI_SUCCESS Source interrupt EOI'ed.
|
||||
@retval EFI_SUCCESS Source interrupt ended successfully.
|
||||
@retval EFI_UNSUPPORTED Source interrupt is not supported
|
||||
|
||||
**/
|
||||
@@ -134,7 +134,7 @@ GicV2EndOfInterrupt (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -261,9 +261,13 @@ GicV2SetTriggerType (
|
||||
BOOLEAN SourceEnabled;
|
||||
|
||||
if ( (TriggerType != EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING)
|
||||
&& (TriggerType != EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH)) {
|
||||
DEBUG ((DEBUG_ERROR, "Invalid interrupt trigger type: %d\n", \
|
||||
TriggerType));
|
||||
&& (TriggerType != EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"Invalid interrupt trigger type: %d\n", \
|
||||
TriggerType
|
||||
));
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -279,7 +283,7 @@ GicV2SetTriggerType (
|
||||
}
|
||||
|
||||
Status = GicV2GetInterruptSourceState (
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL*)This,
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL *)This,
|
||||
Source,
|
||||
&SourceEnabled
|
||||
);
|
||||
@@ -296,7 +300,7 @@ GicV2SetTriggerType (
|
||||
// otherwise GIC behavior is UNPREDICTABLE.
|
||||
if (SourceEnabled) {
|
||||
GicV2DisableInterruptSource (
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL*)This,
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL *)This,
|
||||
Source
|
||||
);
|
||||
}
|
||||
@@ -310,7 +314,7 @@ GicV2SetTriggerType (
|
||||
// Restore interrupt state
|
||||
if (SourceEnabled) {
|
||||
GicV2EnableInterruptSource (
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL*)This,
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL *)This,
|
||||
Source
|
||||
);
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/ArmGicLib.h>
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmGicV2EnableInterruptInterface (
|
||||
|
@@ -37,7 +37,7 @@ GicV3EnableInterruptSource (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ GicV3DisableInterruptSource (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ GicV3GetInterruptSourceState (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ GicV3GetInterruptSourceState (
|
||||
@param This Instance pointer for this protocol
|
||||
@param Source Hardware source of the interrupt
|
||||
|
||||
@retval EFI_SUCCESS Source interrupt EOI'ed.
|
||||
@retval EFI_SUCCESS Source interrupt ended successfully.
|
||||
@retval EFI_DEVICE_ERROR Hardware could not be programmed.
|
||||
|
||||
**/
|
||||
@@ -128,7 +128,7 @@ GicV3EndOfInterrupt (
|
||||
)
|
||||
{
|
||||
if (Source >= mGicNumInterrupts) {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -255,9 +255,13 @@ GicV3SetTriggerType (
|
||||
BOOLEAN SourceEnabled;
|
||||
|
||||
if ( (TriggerType != EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING)
|
||||
&& (TriggerType != EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH)) {
|
||||
DEBUG ((DEBUG_ERROR, "Invalid interrupt trigger type: %d\n", \
|
||||
TriggerType));
|
||||
&& (TriggerType != EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"Invalid interrupt trigger type: %d\n", \
|
||||
TriggerType
|
||||
));
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -273,7 +277,7 @@ GicV3SetTriggerType (
|
||||
}
|
||||
|
||||
Status = GicV3GetInterruptSourceState (
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL*)This,
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL *)This,
|
||||
Source,
|
||||
&SourceEnabled
|
||||
);
|
||||
@@ -290,7 +294,7 @@ GicV3SetTriggerType (
|
||||
// otherwise GIC behavior is UNPREDICTABLE.
|
||||
if (SourceEnabled) {
|
||||
GicV3DisableInterruptSource (
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL*)This,
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL *)This,
|
||||
Source
|
||||
);
|
||||
}
|
||||
@@ -303,7 +307,7 @@ GicV3SetTriggerType (
|
||||
// Restore interrupt state
|
||||
if (SourceEnabled) {
|
||||
GicV3EnableInterruptSource (
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL*)This,
|
||||
(EFI_HARDWARE_INTERRUPT_PROTOCOL *)This,
|
||||
Source
|
||||
);
|
||||
}
|
||||
@@ -344,10 +348,6 @@ GicV3ExitBootServicesEvent (
|
||||
GicV3DisableInterruptSource (&gHardwareInterruptV3Protocol, Index);
|
||||
}
|
||||
|
||||
for (Index = 0; Index < mGicNumInterrupts; Index++) {
|
||||
GicV3EndOfInterrupt (&gHardwareInterruptV3Protocol, Index);
|
||||
}
|
||||
|
||||
// Disable Gic Interface
|
||||
ArmGicV3DisableInterruptInterface ();
|
||||
|
||||
@@ -434,8 +434,8 @@ GicV3DxeInitialize (
|
||||
|
||||
if ((MmioRead32 (
|
||||
mGicDistributorBase + ARM_GIC_ICDDCR
|
||||
) & ARM_GIC_ICDDCR_DS) != 0) {
|
||||
|
||||
) & ARM_GIC_ICDDCR_DS) != 0)
|
||||
{
|
||||
// If the Disable Security (DS) control bit is set, we are dealing with a
|
||||
// GIC that has only one security state. In this case, let's assume we are
|
||||
// executing in non-secure state (which is appropriate for DXE modules)
|
||||
|
@@ -117,14 +117,14 @@ CpuIoCheckParameter (
|
||||
// For FIFO type, the target address won't increase during the access,
|
||||
// so treat Count as 1
|
||||
//
|
||||
if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
|
||||
if ((Width >= EfiCpuIoWidthFifoUint8) && (Width <= EfiCpuIoWidthFifoUint64)) {
|
||||
Count = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Check to see if Width is in the valid range for I/O Port operations
|
||||
//
|
||||
Width = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
|
||||
Width = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
|
||||
if (!MmioOperation && (Width == EfiCpuIoWidthUint64)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -161,6 +161,7 @@ CpuIoCheckParameter (
|
||||
if (MaxCount < (Count - 1)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (Address > LShiftU64 (MaxCount - Count + 1, Width)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -242,7 +243,7 @@ CpuMemoryServiceRead (
|
||||
//
|
||||
InStride = mInStride[Width];
|
||||
OutStride = mOutStride[Width];
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
|
||||
for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
|
||||
if (OperationWidth == EfiCpuIoWidthUint8) {
|
||||
*Uint8Buffer = MmioRead8 ((UINTN)Address);
|
||||
@@ -254,6 +255,7 @@ CpuMemoryServiceRead (
|
||||
*((UINT64 *)Uint8Buffer) = MmioRead64 ((UINTN)Address);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -323,7 +325,7 @@ CpuMemoryServiceWrite (
|
||||
//
|
||||
InStride = mInStride[Width];
|
||||
OutStride = mOutStride[Width];
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
|
||||
for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
|
||||
if (OperationWidth == EfiCpuIoWidthUint8) {
|
||||
MmioWrite8 ((UINTN)Address, *Uint8Buffer);
|
||||
@@ -335,6 +337,7 @@ CpuMemoryServiceWrite (
|
||||
MmioWrite64 ((UINTN)Address, *((UINT64 *)Uint8Buffer));
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -406,7 +409,7 @@ CpuIoServiceRead (
|
||||
//
|
||||
InStride = mInStride[Width];
|
||||
OutStride = mOutStride[Width];
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
|
||||
|
||||
for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
|
||||
if (OperationWidth == EfiCpuIoWidthUint8) {
|
||||
@@ -492,7 +495,7 @@ CpuIoServiceWrite (
|
||||
//
|
||||
InStride = mInStride[Width];
|
||||
OutStride = mOutStride[Width];
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
|
||||
OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
|
||||
|
||||
for (Uint8Buffer = (UINT8 *)Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
|
||||
if (OperationWidth == EfiCpuIoWidthUint8) {
|
||||
@@ -521,7 +524,6 @@ STATIC EFI_CPU_IO2_PROTOCOL mCpuIo2 = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module CpuIo2Dxe. The user code starts with this function.
|
||||
|
||||
@@ -544,7 +546,8 @@ ArmPciCpuIo2Initialize (
|
||||
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiCpuIo2ProtocolGuid);
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mHandle,
|
||||
&gEfiCpuIo2ProtocolGuid, &mCpuIo2,
|
||||
&gEfiCpuIo2ProtocolGuid,
|
||||
&mCpuIo2,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@@ -38,7 +38,7 @@
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation
|
||||
|
||||
[Protocols]
|
||||
gEfiCpuIo2ProtocolGuid ## PRODUCES
|
||||
|
@@ -34,7 +34,7 @@ typedef struct {
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiBaseProtocolInit (
|
||||
IN OUT EFI_HANDLE* Handle
|
||||
IN OUT EFI_HANDLE *Handle
|
||||
);
|
||||
|
||||
#endif /* ARM_SCMI_BASE_PROTOCOL_PRIVATE_H_ */
|
||||
|
@@ -53,7 +53,6 @@ typedef struct {
|
||||
CLOCK_RATE_DWORD Rate;
|
||||
} CLOCK_RATE_SET_ATTRIBUTES;
|
||||
|
||||
|
||||
// Message parameters for CLOCK_CONFIG_SET command.
|
||||
typedef struct {
|
||||
UINT32 ClockId;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#/** @file
|
||||
#
|
||||
# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
# Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -18,11 +18,16 @@
|
||||
ENTRY_POINT = ArmScmiDxeEntryPoint
|
||||
|
||||
[Sources.common]
|
||||
Scmi.c
|
||||
ArmScmiBaseProtocolPrivate.h
|
||||
ArmScmiClockProtocolPrivate.h
|
||||
ArmScmiPerformanceProtocolPrivate.h
|
||||
ScmiBaseProtocol.c
|
||||
Scmi.c
|
||||
ScmiClockProtocol.c
|
||||
ScmiDxe.c
|
||||
ScmiDxe.h
|
||||
ScmiPerformanceProtocol.c
|
||||
ScmiPrivate.h
|
||||
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define NUM_REMAIN_PERF_LEVELS_SHIFT 16
|
||||
#define NUM_REMAIN_PERF_LEVELS(Lvls) (Lvls >> NUM_REMAIN_PERF_LEVELS_SHIFT)
|
||||
|
||||
/** Return values for SCMI_MESSAGE_ID_PERFORMANCE_DESCRIBE_LEVELS command.
|
||||
/** Return values for ScmiMessageIdPerformanceDescribeLevels command.
|
||||
SCMI Spec section 4.5.2.5
|
||||
**/
|
||||
typedef struct {
|
||||
@@ -43,7 +43,7 @@ typedef struct {
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiPerformanceProtocolInit (
|
||||
IN EFI_HANDLE* Handle
|
||||
IN EFI_HANDLE *Handle
|
||||
);
|
||||
|
||||
#endif /* ARM_SCMI_PERFORMANCE_PROTOCOL_PRIVATE_H_ */
|
||||
|
@@ -29,7 +29,7 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiCommandGetPayload (
|
||||
OUT UINT32** Payload
|
||||
OUT UINT32 **Payload
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -95,7 +95,7 @@ ScmiCommandExecute (
|
||||
// Fill in message header.
|
||||
MessageHeader = SCMI_MESSAGE_HEADER (
|
||||
Command->MessageId,
|
||||
SCMI_MESSAGE_TYPE_COMMAND,
|
||||
ScmiMessageTypeCommand,
|
||||
Command->ProtocolId
|
||||
);
|
||||
|
||||
@@ -121,10 +121,12 @@ ScmiCommandExecute (
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Response = (SCMI_MESSAGE_RESPONSE*)MtlGetChannelPayload (Channel);
|
||||
Response = (SCMI_MESSAGE_RESPONSE *)MtlGetChannelPayload (Channel);
|
||||
|
||||
if (Response->Status != SCMI_SUCCESS) {
|
||||
DEBUG ((DEBUG_ERROR, "SCMI error: ProtocolId = 0x%x, MessageId = 0x%x, error = %d\n",
|
||||
if (Response->Status != ScmiSuccess) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"SCMI error: ProtocolId = 0x%x, MessageId = 0x%x, error = %d\n",
|
||||
Command->ProtocolId,
|
||||
Command->MessageId,
|
||||
Response->Status
|
||||
@@ -195,8 +197,8 @@ ScmiGetProtocolVersion (
|
||||
|
||||
Status = ScmiProtocolDiscoveryCommon (
|
||||
ProtocolId,
|
||||
SCMI_MESSAGE_ID_PROTOCOL_VERSION,
|
||||
(UINT32**)&ProtocolVersion
|
||||
ScmiMessageIdProtocolVersion,
|
||||
(UINT32 **)&ProtocolVersion
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -224,7 +226,7 @@ ScmiGetProtocolAttributes (
|
||||
{
|
||||
return ScmiProtocolDiscoveryCommon (
|
||||
ProtocolId,
|
||||
SCMI_MESSAGE_ID_PROTOCOL_ATTRIBUTES,
|
||||
ScmiMessageIdProtocolAttributes,
|
||||
ReturnValues
|
||||
);
|
||||
}
|
||||
@@ -246,7 +248,7 @@ ScmiGetProtocolMessageAttributes (
|
||||
{
|
||||
return ScmiProtocolDiscoveryCommon (
|
||||
ProtocolId,
|
||||
SCMI_MESSAGE_ID_PROTOCOL_MESSAGE_ATTRIBUTES,
|
||||
ScmiMessageIdProtocolMessageAttributes,
|
||||
ReturnValues
|
||||
);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -34,7 +34,7 @@ BaseGetVersion (
|
||||
OUT UINT32 *Version
|
||||
)
|
||||
{
|
||||
return ScmiGetProtocolVersion (SCMI_PROTOCOL_ID_BASE, Version);
|
||||
return ScmiGetProtocolVersion (ScmiProtocolIdBase, Version);
|
||||
}
|
||||
|
||||
/** Return total number of SCMI protocols supported by the SCP firmware.
|
||||
@@ -57,7 +57,7 @@ BaseGetTotalProtocols (
|
||||
EFI_STATUS Status;
|
||||
UINT32 *ReturnValues;
|
||||
|
||||
Status = ScmiGetProtocolAttributes (SCMI_PROTOCOL_ID_BASE, &ReturnValues);
|
||||
Status = ScmiGetProtocolAttributes (ScmiProtocolIdBase, &ReturnValues);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -69,9 +69,9 @@ BaseGetTotalProtocols (
|
||||
|
||||
/** Common function which returns vendor details.
|
||||
|
||||
@param[in] MessageId SCMI_MESSAGE_ID_BASE_DISCOVER_VENDOR
|
||||
@param[in] MessageId ScmiMessageIdBaseDiscoverVendor
|
||||
OR
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_SUB_VENDOR
|
||||
ScmiMessageIdBaseDiscoverSubVendor
|
||||
|
||||
@param[out] VendorIdentifier ASCII name of the vendor/subvendor.
|
||||
|
||||
@@ -91,7 +91,7 @@ BaseDiscoverVendorDetails (
|
||||
SCMI_COMMAND Cmd;
|
||||
UINT32 PayloadLength;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_BASE;
|
||||
Cmd.ProtocolId = ScmiProtocolIdBase;
|
||||
Cmd.MessageId = MessageId;
|
||||
|
||||
PayloadLength = 0;
|
||||
@@ -106,9 +106,9 @@ BaseDiscoverVendorDetails (
|
||||
}
|
||||
|
||||
AsciiStrCpyS (
|
||||
(CHAR8*)VendorIdentifier,
|
||||
(CHAR8 *)VendorIdentifier,
|
||||
SCMI_MAX_STR_LEN,
|
||||
(CONST CHAR8*)ReturnValues
|
||||
(CONST CHAR8 *)ReturnValues
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -133,7 +133,7 @@ BaseDiscoverVendor (
|
||||
)
|
||||
{
|
||||
return BaseDiscoverVendorDetails (
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_VENDOR,
|
||||
ScmiMessageIdBaseDiscoverVendor,
|
||||
VendorIdentifier
|
||||
);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ BaseDiscoverSubVendor (
|
||||
)
|
||||
{
|
||||
return BaseDiscoverVendorDetails (
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_SUB_VENDOR,
|
||||
ScmiMessageIdBaseDiscoverSubVendor,
|
||||
VendorIdentifier
|
||||
);
|
||||
}
|
||||
@@ -183,8 +183,8 @@ BaseDiscoverImplVersion (
|
||||
SCMI_COMMAND Cmd;
|
||||
UINT32 PayloadLength;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_BASE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_BASE_DISCOVER_IMPLEMENTATION_VERSION;
|
||||
Cmd.ProtocolId = ScmiProtocolIdBase;
|
||||
Cmd.MessageId = ScmiMessageIdBaseDiscoverImplementationVersion;
|
||||
|
||||
PayloadLength = 0;
|
||||
|
||||
@@ -250,13 +250,12 @@ BaseDiscoverListProtocols (
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_BASE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_BASE_DISCOVER_LIST_PROTOCOLS;
|
||||
Cmd.ProtocolId = ScmiProtocolIdBase;
|
||||
Cmd.MessageId = ScmiMessageIdBaseDiscoverListProtocols;
|
||||
|
||||
Skip = 0;
|
||||
|
||||
while (Skip < TotalProtocols) {
|
||||
|
||||
*MessageParams = Skip;
|
||||
|
||||
// Note PayloadLength is a IN/OUT parameter.
|
||||
@@ -265,7 +264,7 @@ BaseDiscoverListProtocols (
|
||||
Status = ScmiCommandExecute (
|
||||
&Cmd,
|
||||
&PayloadLength,
|
||||
(UINT32**)&DiscoverList
|
||||
(UINT32 **)&DiscoverList
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -300,7 +299,7 @@ STATIC CONST SCMI_BASE_PROTOCOL BaseProtocol = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiBaseProtocolInit (
|
||||
IN OUT EFI_HANDLE* Handle
|
||||
IN OUT EFI_HANDLE *Handle
|
||||
)
|
||||
{
|
||||
return gBS->InstallMultipleProtocolInterfaces (
|
||||
|
@@ -52,7 +52,7 @@ ClockGetVersion (
|
||||
OUT UINT32 *Version
|
||||
)
|
||||
{
|
||||
return ScmiGetProtocolVersion (SCMI_PROTOCOL_ID_CLOCK, Version);
|
||||
return ScmiGetProtocolVersion (ScmiProtocolIdClock, Version);
|
||||
}
|
||||
|
||||
/** Return total number of clock devices supported by the clock management
|
||||
@@ -76,7 +76,7 @@ ClockGetTotalClocks (
|
||||
EFI_STATUS Status;
|
||||
UINT32 *ReturnValues;
|
||||
|
||||
Status = ScmiGetProtocolAttributes (SCMI_PROTOCOL_ID_CLOCK, &ReturnValues);
|
||||
Status = ScmiGetProtocolAttributes (ScmiProtocolIdClock, &ReturnValues);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -122,26 +122,27 @@ ClockGetClockAttributes (
|
||||
|
||||
*MessageParams = ClockId;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_CLOCK;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_CLOCK_ATTRIBUTES;
|
||||
Cmd.ProtocolId = ScmiProtocolIdClock;
|
||||
Cmd.MessageId = ScmiMessageIdClockAttributes;
|
||||
|
||||
PayloadLength = sizeof (ClockId);
|
||||
|
||||
Status = ScmiCommandExecute (
|
||||
&Cmd,
|
||||
&PayloadLength,
|
||||
(UINT32**)&ClockAttributes
|
||||
(UINT32 **)&ClockAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
// TRUE if bit 0 of ClockAttributes->Attributes is set.
|
||||
*Enabled = CLOCK_ENABLED (ClockAttributes->Attributes);
|
||||
|
||||
AsciiStrCpyS (
|
||||
ClockAsciiName,
|
||||
SCMI_MAX_STR_LEN,
|
||||
(CONST CHAR8*)ClockAttributes->ClockName
|
||||
(CONST CHAR8 *)ClockAttributes->ClockName
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -152,10 +153,10 @@ ClockGetClockAttributes (
|
||||
@param[in] This A pointer to SCMI_CLOCK_PROTOCOL Instance.
|
||||
@param[in] ClockId Identifier for the clock device.
|
||||
|
||||
@param[out] Format SCMI_CLOCK_RATE_FORMAT_DISCRETE: Clock device
|
||||
@param[out] Format ScmiClockRateFormatDiscrete: Clock device
|
||||
supports range of clock rates which are non-linear.
|
||||
|
||||
SCMI_CLOCK_RATE_FORMAT_LINEAR: Clock device supports
|
||||
ScmiClockRateFormatLinear: Clock device supports
|
||||
range of linear clock rates from Min to Max in steps.
|
||||
|
||||
@param[out] TotalRates Total number of rates.
|
||||
@@ -203,13 +204,12 @@ ClockDescribeRates (
|
||||
return Status;
|
||||
}
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_CLOCK;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_CLOCK_DESCRIBE_RATES;
|
||||
Cmd.ProtocolId = ScmiProtocolIdClock;
|
||||
Cmd.MessageId = ScmiMessageIdClockDescribeRates;
|
||||
|
||||
*MessageParams++ = ClockId;
|
||||
|
||||
do {
|
||||
|
||||
*MessageParams = RateIndex;
|
||||
|
||||
// Set Payload length, note PayloadLength is a IN/OUT parameter.
|
||||
@@ -219,7 +219,7 @@ ClockDescribeRates (
|
||||
Status = ScmiCommandExecute (
|
||||
&Cmd,
|
||||
&PayloadLength,
|
||||
(UINT32**)&DescribeRates
|
||||
(UINT32 **)&DescribeRates
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -236,7 +236,7 @@ ClockDescribeRates (
|
||||
*TotalRates = NUM_RATES (DescribeRates->NumRatesFlags)
|
||||
+ NUM_REMAIN_RATES (DescribeRates->NumRatesFlags);
|
||||
|
||||
if (*Format == SCMI_CLOCK_RATE_FORMAT_DISCRETE) {
|
||||
if (*Format == ScmiClockRateFormatDiscrete) {
|
||||
RequiredArraySize = (*TotalRates) * sizeof (UINT64);
|
||||
} else {
|
||||
// We need to return triplet of 64 bit value for each rate
|
||||
@@ -251,26 +251,30 @@ ClockDescribeRates (
|
||||
|
||||
RateOffset = 0;
|
||||
|
||||
if (*Format == SCMI_CLOCK_RATE_FORMAT_DISCRETE) {
|
||||
if (*Format == ScmiClockRateFormatDiscrete) {
|
||||
for (RateNo = 0; RateNo < NUM_RATES (DescribeRates->NumRatesFlags); RateNo++) {
|
||||
Rate = &DescribeRates->Rates[RateOffset++];
|
||||
// Non-linear discrete rates.
|
||||
RateArray[RateIndex++].Rate = ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
RateArray[RateIndex++].DiscreteRate.Rate =
|
||||
ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
}
|
||||
} else {
|
||||
for (RateNo = 0; RateNo < NUM_RATES (DescribeRates->NumRatesFlags); RateNo++) {
|
||||
// Linear clock rates from minimum to maximum in steps
|
||||
// Minimum clock rate.
|
||||
Rate = &DescribeRates->Rates[RateOffset++];
|
||||
RateArray[RateIndex].Min = ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
RateArray[RateIndex].ContinuousRate.Min =
|
||||
ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
|
||||
Rate = &DescribeRates->Rates[RateOffset++];
|
||||
// Maximum clock rate.
|
||||
RateArray[RateIndex].Max = ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
RateArray[RateIndex].ContinuousRate.Max =
|
||||
ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
|
||||
Rate = &DescribeRates->Rates[RateOffset++];
|
||||
// Step.
|
||||
RateArray[RateIndex++].Step = ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
RateArray[RateIndex++].ContinuousRate.Step =
|
||||
ConvertTo64Bit (Rate->Low, Rate->High);
|
||||
}
|
||||
}
|
||||
} while (NUM_REMAIN_RATES (DescribeRates->NumRatesFlags) != 0);
|
||||
@@ -316,8 +320,8 @@ ClockRateGet (
|
||||
// Fill arguments for clock protocol command.
|
||||
*MessageParams = ClockId;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_CLOCK;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_CLOCK_RATE_GET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdClock;
|
||||
Cmd.MessageId = ScmiMessageIdClockRateGet;
|
||||
|
||||
PayloadLength = sizeof (ClockId);
|
||||
|
||||
@@ -325,7 +329,7 @@ ClockRateGet (
|
||||
Status = ScmiCommandExecute (
|
||||
&Cmd,
|
||||
&PayloadLength,
|
||||
(UINT32**)&ClockRate
|
||||
(UINT32 **)&ClockRate
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -359,7 +363,7 @@ ClockRateSet (
|
||||
SCMI_COMMAND Cmd;
|
||||
UINT32 PayloadLength;
|
||||
|
||||
Status = ScmiCommandGetPayload ((UINT32**)&ClockRateSetAttributes);
|
||||
Status = ScmiCommandGetPayload ((UINT32 **)&ClockRateSetAttributes);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -370,8 +374,8 @@ ClockRateSet (
|
||||
ClockRateSetAttributes->Rate.Low = (UINT32)Rate;
|
||||
ClockRateSetAttributes->Rate.High = (UINT32)(Rate >> 32);
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_CLOCK;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_CLOCK_RATE_SET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdClock;
|
||||
Cmd.MessageId = ScmiMessageIdClockRateSet;
|
||||
|
||||
PayloadLength = sizeof (CLOCK_RATE_SET_ATTRIBUTES);
|
||||
|
||||
@@ -408,7 +412,7 @@ ClockEnable (
|
||||
SCMI_COMMAND Cmd;
|
||||
UINT32 PayloadLength;
|
||||
|
||||
Status = ScmiCommandGetPayload ((UINT32**)&ClockConfigSetAttributes);
|
||||
Status = ScmiCommandGetPayload ((UINT32 **)&ClockConfigSetAttributes);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -417,8 +421,8 @@ ClockEnable (
|
||||
ClockConfigSetAttributes->ClockId = ClockId;
|
||||
ClockConfigSetAttributes->Attributes = Enable ? BIT0 : 0;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_CLOCK;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_CLOCK_CONFIG_SET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdClock;
|
||||
Cmd.MessageId = ScmiMessageIdClockConfigSet;
|
||||
|
||||
PayloadLength = sizeof (CLOCK_CONFIG_SET_ATTRIBUTES);
|
||||
|
||||
@@ -440,7 +444,7 @@ STATIC CONST SCMI_CLOCK_PROTOCOL ScmiClockProtocol = {
|
||||
ClockDescribeRates,
|
||||
ClockRateGet,
|
||||
ClockRateSet
|
||||
};
|
||||
};
|
||||
|
||||
// Instance of the SCMI clock management protocol.
|
||||
STATIC CONST SCMI_CLOCK2_PROTOCOL ScmiClock2Protocol = {
|
||||
@@ -452,7 +456,7 @@ STATIC CONST SCMI_CLOCK2_PROTOCOL ScmiClock2Protocol = {
|
||||
(SCMI_CLOCK2_RATE_SET)ClockRateSet,
|
||||
SCMI_CLOCK2_PROTOCOL_VERSION,
|
||||
ClockEnable
|
||||
};
|
||||
};
|
||||
|
||||
/** Initialize clock management protocol and install protocol on a given handle.
|
||||
|
||||
@@ -462,7 +466,7 @@ STATIC CONST SCMI_CLOCK2_PROTOCOL ScmiClock2Protocol = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiClockProtocolInit (
|
||||
IN EFI_HANDLE* Handle
|
||||
IN EFI_HANDLE *Handle
|
||||
)
|
||||
{
|
||||
return gBS->InstallMultipleProtocolInterfaces (
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
System Control and Management Interface V1.0
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
|
||||
DEN0056A_System_Control_and_Management_Interface.pdf
|
||||
@par Specification Reference:
|
||||
- Arm System Control and Management Interface - Platform Design Document
|
||||
(https://developer.arm.com/documentation/den0056/)
|
||||
**/
|
||||
|
||||
#include <Base.h>
|
||||
@@ -24,9 +24,9 @@
|
||||
#include "ScmiPrivate.h"
|
||||
|
||||
STATIC CONST SCMI_PROTOCOL_ENTRY Protocols[] = {
|
||||
{ SCMI_PROTOCOL_ID_BASE, ScmiBaseProtocolInit },
|
||||
{ SCMI_PROTOCOL_ID_PERFORMANCE, ScmiPerformanceProtocolInit },
|
||||
{ SCMI_PROTOCOL_ID_CLOCK, ScmiClockProtocolInit }
|
||||
{ ScmiProtocolIdBase, ScmiBaseProtocolInit },
|
||||
{ ScmiProtocolIdPerformance, ScmiPerformanceProtocolInit },
|
||||
{ ScmiProtocolIdClock, ScmiClockProtocolInit }
|
||||
};
|
||||
|
||||
/** ARM SCMI driver entry point function.
|
||||
@@ -61,7 +61,7 @@ ArmScmiDxeEntryPoint (
|
||||
UINT32 SupportedListSize;
|
||||
|
||||
// Every SCMI implementation must implement the base protocol.
|
||||
ASSERT (Protocols[0].Id == SCMI_PROTOCOL_ID_BASE);
|
||||
ASSERT (Protocols[0].Id == ScmiProtocolIdBase);
|
||||
|
||||
Status = ScmiBaseProtocolInit (&ImageHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -72,7 +72,7 @@ ArmScmiDxeEntryPoint (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gArmScmiBaseProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&BaseProtocol
|
||||
(VOID **)&BaseProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (FALSE);
|
||||
@@ -86,7 +86,10 @@ ArmScmiDxeEntryPoint (
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Version != BASE_PROTOCOL_VERSION) {
|
||||
// Accept any version between SCMI v1.0 and SCMI v2.0
|
||||
if ((Version < BASE_PROTOCOL_VERSION_V1) ||
|
||||
(Version > BASE_PROTOCOL_VERSION_V2))
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -107,7 +110,7 @@ ArmScmiDxeEntryPoint (
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
SupportedListSize,
|
||||
(VOID**)&SupportedList
|
||||
(VOID **)&SupportedList
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (FALSE);
|
||||
@@ -128,7 +131,8 @@ ArmScmiDxeEntryPoint (
|
||||
|
||||
// Install supported protocol on ImageHandle.
|
||||
for (ProtocolIndex = 1; ProtocolIndex < ARRAY_SIZE (Protocols);
|
||||
ProtocolIndex++) {
|
||||
ProtocolIndex++)
|
||||
{
|
||||
for (Index = 0; Index < NumProtocols; Index++) {
|
||||
if (Protocols[ProtocolIndex].Id == SupportedList[Index]) {
|
||||
Status = Protocols[ProtocolIndex].InitFn (&ImageHandle);
|
||||
@@ -136,6 +140,7 @@ ArmScmiDxeEntryPoint (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
|
||||
DEN0056A_System_Control_and_Management_Interface.pdf
|
||||
**/
|
||||
|
||||
#ifndef SCMI_DXE_H_
|
||||
#define SCMI_DXE_H_
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -35,7 +35,7 @@ PerformanceGetVersion (
|
||||
OUT UINT32 *Version
|
||||
)
|
||||
{
|
||||
return ScmiGetProtocolVersion (SCMI_PROTOCOL_ID_PERFORMANCE, Version);
|
||||
return ScmiGetProtocolVersion (ScmiProtocolIdPerformance, Version);
|
||||
}
|
||||
|
||||
/** Return protocol attributes of the performance management protocol.
|
||||
@@ -56,10 +56,10 @@ PerformanceGetAttributes (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32* ReturnValues;
|
||||
UINT32 *ReturnValues;
|
||||
|
||||
Status = ScmiGetProtocolAttributes (
|
||||
SCMI_PROTOCOL_ID_PERFORMANCE,
|
||||
ScmiProtocolIdPerformance,
|
||||
&ReturnValues
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -107,8 +107,8 @@ PerformanceDomainAttributes (
|
||||
|
||||
*MessageParams = DomainId;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_PERFORMANCE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_PERFORMANCE_DOMAIN_ATTRIBUTES;
|
||||
Cmd.ProtocolId = ScmiProtocolIdPerformance;
|
||||
Cmd.MessageId = ScmiMessageIdPerformanceDomainAttributes;
|
||||
|
||||
PayloadLength = sizeof (DomainId);
|
||||
|
||||
@@ -160,7 +160,7 @@ PerformanceDescribeLevels (
|
||||
EFI_STATUS Status;
|
||||
UINT32 PayloadLength;
|
||||
SCMI_COMMAND Cmd;
|
||||
UINT32* MessageParams;
|
||||
UINT32 *MessageParams;
|
||||
UINT32 LevelIndex;
|
||||
UINT32 RequiredSize;
|
||||
UINT32 LevelNo;
|
||||
@@ -179,11 +179,10 @@ PerformanceDescribeLevels (
|
||||
|
||||
*MessageParams++ = DomainId;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_PERFORMANCE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_PERFORMANCE_DESCRIBE_LEVELS;
|
||||
Cmd.ProtocolId = ScmiProtocolIdPerformance;
|
||||
Cmd.MessageId = ScmiMessageIdPerformanceDescribeLevels;
|
||||
|
||||
do {
|
||||
|
||||
*MessageParams = LevelIndex;
|
||||
|
||||
// Note, PayloadLength is an IN/OUT parameter.
|
||||
@@ -192,7 +191,7 @@ PerformanceDescribeLevels (
|
||||
Status = ScmiCommandExecute (
|
||||
&Cmd,
|
||||
&PayloadLength,
|
||||
(UINT32**)&Levels
|
||||
(UINT32 **)&Levels
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -219,7 +218,6 @@ PerformanceDescribeLevels (
|
||||
sizeof (SCMI_PERFORMANCE_LEVEL)
|
||||
);
|
||||
}
|
||||
|
||||
} while (ReturnRemainNumLevels != 0);
|
||||
|
||||
*LevelArraySize = RequiredSize;
|
||||
@@ -258,8 +256,8 @@ PerformanceLimitsSet (
|
||||
*MessageParams++ = Limits->RangeMax;
|
||||
*MessageParams = Limits->RangeMin;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_PERFORMANCE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_PERFORMANCE_LIMITS_SET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdPerformance;
|
||||
Cmd.MessageId = ScmiMessageIdPerformanceLimitsSet;
|
||||
|
||||
PayloadLength = sizeof (DomainId) + sizeof (SCMI_PERFORMANCE_LIMITS);
|
||||
|
||||
@@ -304,15 +302,15 @@ PerformanceLimitsGet (
|
||||
|
||||
*MessageParams = DomainId;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_PERFORMANCE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_PERFORMANCE_LIMITS_GET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdPerformance;
|
||||
Cmd.MessageId = ScmiMessageIdPerformanceLimitsGet;
|
||||
|
||||
PayloadLength = sizeof (DomainId);
|
||||
|
||||
Status = ScmiCommandExecute (
|
||||
&Cmd,
|
||||
&PayloadLength,
|
||||
(UINT32**)&ReturnValues
|
||||
(UINT32 **)&ReturnValues
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -354,8 +352,8 @@ PerformanceLevelSet (
|
||||
*MessageParams++ = DomainId;
|
||||
*MessageParams = Level;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_PERFORMANCE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_PERFORMANCE_LEVEL_SET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdPerformance;
|
||||
Cmd.MessageId = ScmiMessageIdPerformanceLevelSet;
|
||||
|
||||
PayloadLength = sizeof (DomainId) + sizeof (Level);
|
||||
|
||||
@@ -399,8 +397,8 @@ PerformanceLevelGet (
|
||||
|
||||
*MessageParams = DomainId;
|
||||
|
||||
Cmd.ProtocolId = SCMI_PROTOCOL_ID_PERFORMANCE;
|
||||
Cmd.MessageId = SCMI_MESSAGE_ID_PERFORMANCE_LEVEL_GET;
|
||||
Cmd.ProtocolId = ScmiProtocolIdPerformance;
|
||||
Cmd.MessageId = ScmiMessageIdPerformanceLevelGet;
|
||||
|
||||
PayloadLength = sizeof (DomainId);
|
||||
|
||||
@@ -439,7 +437,7 @@ STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProtocol = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiPerformanceProtocolInit (
|
||||
IN EFI_HANDLE* Handle
|
||||
IN EFI_HANDLE *Handle
|
||||
)
|
||||
{
|
||||
return gBS->InstallMultipleProtocolInterfaces (
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -8,46 +8,47 @@
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
|
||||
DEN0056A_System_Control_and_Management_Interface.pdf
|
||||
**/
|
||||
|
||||
#ifndef SCMI_PRIVATE_H_
|
||||
#define SCMI_PRIVATE_H_
|
||||
|
||||
// SCMI protocol IDs.
|
||||
typedef enum {
|
||||
SCMI_PROTOCOL_ID_BASE = 0x10,
|
||||
SCMI_PROTOCOL_ID_POWER_DOMAIN = 0x11,
|
||||
SCMI_PROTOCOL_ID_SYSTEM_POWER = 0x12,
|
||||
SCMI_PROTOCOL_ID_PERFORMANCE = 0x13,
|
||||
SCMI_PROTOCOL_ID_CLOCK = 0x14,
|
||||
SCMI_PROTOCOL_ID_SENSOR = 0x15
|
||||
ScmiProtocolIdBase = 0x10,
|
||||
ScmiProtocolIdPowerDomain = 0x11,
|
||||
ScmiProtocolIdSystemPower = 0x12,
|
||||
ScmiProtocolIdPerformance = 0x13,
|
||||
ScmiProtocolIdClock = 0x14,
|
||||
ScmiProtocolIdSensor = 0x15
|
||||
} SCMI_PROTOCOL_ID;
|
||||
|
||||
// SCMI message types.
|
||||
typedef enum {
|
||||
SCMI_MESSAGE_TYPE_COMMAND = 0,
|
||||
SCMI_MESSAGE_TYPE_DELAYED_RESPONSE = 2, // Skipping 1 is deliberate.
|
||||
SCMI_MESSAGE_TYPE_NOTIFICATION = 3
|
||||
ScmiMessageTypeCommand = 0,
|
||||
ScmiMessageTypeDelayedResponse = 2, // Skipping 1 is deliberate.
|
||||
ScmiMessageTypeNotification = 3
|
||||
} SCMI_MESSAGE_TYPE;
|
||||
|
||||
// SCMI response error codes.
|
||||
typedef enum {
|
||||
SCMI_SUCCESS = 0,
|
||||
SCMI_NOT_SUPPORTED = -1,
|
||||
SCMI_INVALID_PARAMETERS = -2,
|
||||
SCMI_DENIED = -3,
|
||||
SCMI_NOT_FOUND = -4,
|
||||
SCMI_OUT_OF_RANGE = -5,
|
||||
SCMI_BUSY = -6,
|
||||
SCMI_COMMS_ERROR = -7,
|
||||
SCMI_GENERIC_ERROR = -8,
|
||||
SCMI_HARDWARE_ERROR = -9,
|
||||
SCMI_PROTOCOL_ERROR = -10
|
||||
ScmiSuccess = 0,
|
||||
ScmiNotSupported = -1,
|
||||
ScmiInvalidParameters = -2,
|
||||
ScmiDenied = -3,
|
||||
ScmiNotFound = -4,
|
||||
ScmiOutOfRange = -5,
|
||||
ScmiBusy = -6,
|
||||
ScmiCommsError = -7,
|
||||
ScmiGenericError = -8,
|
||||
ScmiHardwareError = -9,
|
||||
ScmiProtocolError = -10
|
||||
} SCMI_STATUS;
|
||||
|
||||
// SCMI message IDs common to all protocols.
|
||||
typedef enum {
|
||||
SCMI_MESSAGE_ID_PROTOCOL_VERSION = 0x0,
|
||||
SCMI_MESSAGE_ID_PROTOCOL_ATTRIBUTES = 0x1,
|
||||
SCMI_MESSAGE_ID_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2
|
||||
ScmiMessageIdProtocolVersion = 0x0,
|
||||
ScmiMessageIdProtocolAttributes = 0x1,
|
||||
ScmiMessageIdProtocolMessageAttributes = 0x2
|
||||
} SCMI_MESSAGE_ID;
|
||||
|
||||
// Not defined in SCMI specification but will help to identify a message.
|
||||
@@ -89,7 +90,7 @@ typedef struct {
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScmiCommandGetPayload (
|
||||
OUT UINT32** Payload
|
||||
OUT UINT32 **Payload
|
||||
);
|
||||
|
||||
/** Execute a SCMI command and receive a response.
|
||||
|
@@ -52,9 +52,11 @@ PageAttributeToGcdAttribute (
|
||||
GcdAttributes = EFI_MEMORY_WB;
|
||||
break;
|
||||
default:
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"PageAttributeToGcdAttribute: PageAttributes:0x%lX not supported.\n",
|
||||
PageAttributes));
|
||||
PageAttributes
|
||||
));
|
||||
ASSERT (0);
|
||||
// The Global Coherency Domain (GCD) value is defined as a bit set.
|
||||
// Returning 0 means no attribute has been set.
|
||||
@@ -63,7 +65,8 @@ PageAttributeToGcdAttribute (
|
||||
|
||||
// Determine protection attributes
|
||||
if (((PageAttributes & TT_AP_MASK) == TT_AP_NO_RO) ||
|
||||
((PageAttributes & TT_AP_MASK) == TT_AP_RO_RO)) {
|
||||
((PageAttributes & TT_AP_MASK) == TT_AP_RO_RO))
|
||||
{
|
||||
// Read only cases map to write-protect
|
||||
GcdAttributes |= EFI_MEMORY_RO;
|
||||
}
|
||||
@@ -88,11 +91,11 @@ GetFirstPageAttribute (
|
||||
// Get the first entry of the table
|
||||
FirstEntry = *FirstLevelTableAddress;
|
||||
|
||||
if ((TableLevel != 3) && (FirstEntry & TT_TYPE_MASK) == TT_TYPE_TABLE_ENTRY) {
|
||||
if ((TableLevel != 3) && ((FirstEntry & TT_TYPE_MASK) == TT_TYPE_TABLE_ENTRY)) {
|
||||
// Only valid for Levels 0, 1 and 2
|
||||
|
||||
// Get the attribute of the subsequent table
|
||||
return GetFirstPageAttribute ((UINT64*)(FirstEntry & TT_ADDRESS_MASK_DESCRIPTION_TABLE), TableLevel + 1);
|
||||
return GetFirstPageAttribute ((UINT64 *)(FirstEntry & TT_ADDRESS_MASK_DESCRIPTION_TABLE), TableLevel + 1);
|
||||
} else if (((FirstEntry & TT_TYPE_MASK) == TT_TYPE_BLOCK_ENTRY) ||
|
||||
((TableLevel == 3) && ((FirstEntry & TT_TYPE_MASK) == TT_TYPE_BLOCK_ENTRY_LEVEL3)))
|
||||
{
|
||||
@@ -138,18 +141,22 @@ GetNextEntryAttribute (
|
||||
|
||||
// If Entry is a Table Descriptor type entry then go through the sub-level table
|
||||
if ((EntryType == TT_TYPE_BLOCK_ENTRY) ||
|
||||
((TableLevel == 3) && (EntryType == TT_TYPE_BLOCK_ENTRY_LEVEL3))) {
|
||||
((TableLevel == 3) && (EntryType == TT_TYPE_BLOCK_ENTRY_LEVEL3)))
|
||||
{
|
||||
if ((*PrevEntryAttribute == INVALID_ENTRY) || (EntryAttribute != *PrevEntryAttribute)) {
|
||||
if (*PrevEntryAttribute != INVALID_ENTRY) {
|
||||
// Update GCD with the last region
|
||||
SetGcdMemorySpaceAttributes (MemorySpaceMap, NumberOfDescriptors,
|
||||
SetGcdMemorySpaceAttributes (
|
||||
MemorySpaceMap,
|
||||
NumberOfDescriptors,
|
||||
*StartGcdRegion,
|
||||
(BaseAddress + (Index * TT_ADDRESS_AT_LEVEL(TableLevel))) - *StartGcdRegion,
|
||||
PageAttributeToGcdAttribute (*PrevEntryAttribute));
|
||||
(BaseAddress + (Index * TT_ADDRESS_AT_LEVEL (TableLevel))) - *StartGcdRegion,
|
||||
PageAttributeToGcdAttribute (*PrevEntryAttribute)
|
||||
);
|
||||
}
|
||||
|
||||
// Start of the new region
|
||||
*StartGcdRegion = BaseAddress + (Index * TT_ADDRESS_AT_LEVEL(TableLevel));
|
||||
*StartGcdRegion = BaseAddress + (Index * TT_ADDRESS_AT_LEVEL (TableLevel));
|
||||
*PrevEntryAttribute = EntryAttribute;
|
||||
} else {
|
||||
continue;
|
||||
@@ -159,20 +166,27 @@ GetNextEntryAttribute (
|
||||
ASSERT (TableLevel < 3);
|
||||
|
||||
// Increase the level number and scan the sub-level table
|
||||
GetNextEntryAttribute ((UINT64*)(Entry & TT_ADDRESS_MASK_DESCRIPTION_TABLE),
|
||||
TT_ENTRY_COUNT, TableLevel + 1,
|
||||
(BaseAddress + (Index * TT_ADDRESS_AT_LEVEL(TableLevel))),
|
||||
PrevEntryAttribute, StartGcdRegion);
|
||||
GetNextEntryAttribute (
|
||||
(UINT64 *)(Entry & TT_ADDRESS_MASK_DESCRIPTION_TABLE),
|
||||
TT_ENTRY_COUNT,
|
||||
TableLevel + 1,
|
||||
(BaseAddress + (Index * TT_ADDRESS_AT_LEVEL (TableLevel))),
|
||||
PrevEntryAttribute,
|
||||
StartGcdRegion
|
||||
);
|
||||
} else {
|
||||
if (*PrevEntryAttribute != INVALID_ENTRY) {
|
||||
// Update GCD with the last region
|
||||
SetGcdMemorySpaceAttributes (MemorySpaceMap, NumberOfDescriptors,
|
||||
SetGcdMemorySpaceAttributes (
|
||||
MemorySpaceMap,
|
||||
NumberOfDescriptors,
|
||||
*StartGcdRegion,
|
||||
(BaseAddress + (Index * TT_ADDRESS_AT_LEVEL(TableLevel))) - *StartGcdRegion,
|
||||
PageAttributeToGcdAttribute (*PrevEntryAttribute));
|
||||
(BaseAddress + (Index * TT_ADDRESS_AT_LEVEL (TableLevel))) - *StartGcdRegion,
|
||||
PageAttributeToGcdAttribute (*PrevEntryAttribute)
|
||||
);
|
||||
|
||||
// Start of the new region
|
||||
*StartGcdRegion = BaseAddress + (Index * TT_ADDRESS_AT_LEVEL(TableLevel));
|
||||
*StartGcdRegion = BaseAddress + (Index * TT_ADDRESS_AT_LEVEL (TableLevel));
|
||||
*PrevEntryAttribute = INVALID_ENTRY;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +194,7 @@ GetNextEntryAttribute (
|
||||
|
||||
FreePool (MemorySpaceMap);
|
||||
|
||||
return BaseAddress + (EntryCount * TT_ADDRESS_AT_LEVEL(TableLevel));
|
||||
return BaseAddress + (EntryCount * TT_ADDRESS_AT_LEVEL (TableLevel));
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
@@ -217,7 +231,7 @@ SyncCacheConfig (
|
||||
// with a way for GCD to query the CPU Arch. driver of the existing memory space attributes instead.
|
||||
|
||||
// Obtain page table base
|
||||
FirstLevelTableAddress = (UINT64*)(ArmGetTTBR0BaseAddress ());
|
||||
FirstLevelTableAddress = (UINT64 *)(ArmGetTTBR0BaseAddress ());
|
||||
|
||||
// Get Translation Control Register value
|
||||
Tcr = ArmGetTCR ();
|
||||
@@ -232,17 +246,24 @@ SyncCacheConfig (
|
||||
|
||||
// We scan from the start of the memory map (ie: at the address 0x0)
|
||||
BaseAddressGcdRegion = 0x0;
|
||||
EndAddressGcdRegion = GetNextEntryAttribute (FirstLevelTableAddress,
|
||||
TableCount, TableLevel,
|
||||
EndAddressGcdRegion = GetNextEntryAttribute (
|
||||
FirstLevelTableAddress,
|
||||
TableCount,
|
||||
TableLevel,
|
||||
BaseAddressGcdRegion,
|
||||
&PageAttribute, &BaseAddressGcdRegion);
|
||||
&PageAttribute,
|
||||
&BaseAddressGcdRegion
|
||||
);
|
||||
|
||||
// Update GCD with the last region if valid
|
||||
if (PageAttribute != INVALID_ENTRY) {
|
||||
SetGcdMemorySpaceAttributes (MemorySpaceMap, NumberOfDescriptors,
|
||||
SetGcdMemorySpaceAttributes (
|
||||
MemorySpaceMap,
|
||||
NumberOfDescriptors,
|
||||
BaseAddressGcdRegion,
|
||||
EndAddressGcdRegion - BaseAddressGcdRegion,
|
||||
PageAttributeToGcdAttribute (PageAttribute));
|
||||
PageAttributeToGcdAttribute (PageAttribute)
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (MemorySpaceMap);
|
||||
@@ -264,6 +285,7 @@ EfiAttributeToArmAttribute (
|
||||
} else {
|
||||
ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY | TT_UXN_MASK | TT_PXN_MASK;
|
||||
}
|
||||
|
||||
break;
|
||||
case EFI_MEMORY_WC:
|
||||
ArmAttributes = TT_ATTR_INDX_MEMORY_NON_CACHEABLE;
|
||||
@@ -283,7 +305,7 @@ EfiAttributeToArmAttribute (
|
||||
|
||||
// Determine protection attributes
|
||||
if ((EfiAttributes & EFI_MEMORY_RO) != 0) {
|
||||
ArmAttributes |= TT_AP_RO_RO;
|
||||
ArmAttributes |= TT_AP_NO_RO;
|
||||
}
|
||||
|
||||
// Process eXecute Never attribute
|
||||
@@ -319,22 +341,25 @@ GetMemoryRegionRec (
|
||||
}
|
||||
|
||||
// Find the block entry linked to the Base Address
|
||||
BlockEntry = (UINT64*)TT_GET_ENTRY_FOR_ADDRESS (TranslationTable, TableLevel, *BaseAddress);
|
||||
BlockEntry = (UINT64 *)TT_GET_ENTRY_FOR_ADDRESS (TranslationTable, TableLevel, *BaseAddress);
|
||||
EntryType = *BlockEntry & TT_TYPE_MASK;
|
||||
|
||||
if ((TableLevel < 3) && (EntryType == TT_TYPE_TABLE_ENTRY)) {
|
||||
NextTranslationTable = (UINT64*)(*BlockEntry & TT_ADDRESS_MASK_DESCRIPTION_TABLE);
|
||||
NextTranslationTable = (UINT64 *)(*BlockEntry & TT_ADDRESS_MASK_DESCRIPTION_TABLE);
|
||||
|
||||
// The entry is a page table, so we go to the next level
|
||||
Status = GetMemoryRegionRec (
|
||||
NextTranslationTable, // Address of the next level page table
|
||||
TableLevel + 1, // Next Page Table level
|
||||
(UINTN*)TT_LAST_BLOCK_ADDRESS(NextTranslationTable, TT_ENTRY_COUNT),
|
||||
BaseAddress, RegionLength, RegionAttributes);
|
||||
(UINTN *)TT_LAST_BLOCK_ADDRESS (NextTranslationTable, TT_ENTRY_COUNT),
|
||||
BaseAddress,
|
||||
RegionLength,
|
||||
RegionAttributes
|
||||
);
|
||||
|
||||
// In case of 'Success', it means the end of the block region has been found into the upper
|
||||
// level translation table
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -343,7 +368,7 @@ GetMemoryRegionRec (
|
||||
} else if (EntryType == BlockEntryType) {
|
||||
// We have found the BlockEntry attached to the address. We save its start address (the start
|
||||
// address might be before the 'BaseAddress') and attributes
|
||||
*BaseAddress = *BaseAddress & ~(TT_ADDRESS_AT_LEVEL(TableLevel) - 1);
|
||||
*BaseAddress = *BaseAddress & ~(TT_ADDRESS_AT_LEVEL (TableLevel) - 1);
|
||||
*RegionLength = 0;
|
||||
*RegionAttributes = *BlockEntry & TT_ATTRIBUTES_MASK;
|
||||
} else {
|
||||
@@ -353,11 +378,12 @@ GetMemoryRegionRec (
|
||||
|
||||
while (BlockEntry <= LastBlockEntry) {
|
||||
if ((*BlockEntry & TT_ATTRIBUTES_MASK) == *RegionAttributes) {
|
||||
*RegionLength = *RegionLength + TT_BLOCK_ENTRY_SIZE_AT_LEVEL(TableLevel);
|
||||
*RegionLength = *RegionLength + TT_BLOCK_ENTRY_SIZE_AT_LEVEL (TableLevel);
|
||||
} else {
|
||||
// In case we have found the end of the region we return success
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BlockEntry++;
|
||||
}
|
||||
|
||||
@@ -388,9 +414,14 @@ GetMemoryRegion (
|
||||
// Get the Table info from T0SZ
|
||||
GetRootTranslationTableInfo (T0SZ, &TableLevel, &EntryCount);
|
||||
|
||||
Status = GetMemoryRegionRec (TranslationTable, TableLevel,
|
||||
(UINTN*)TT_LAST_BLOCK_ADDRESS(TranslationTable, EntryCount),
|
||||
BaseAddress, RegionLength, RegionAttributes);
|
||||
Status = GetMemoryRegionRec (
|
||||
TranslationTable,
|
||||
TableLevel,
|
||||
(UINTN *)TT_LAST_BLOCK_ADDRESS (TranslationTable, EntryCount),
|
||||
BaseAddress,
|
||||
RegionLength,
|
||||
RegionAttributes
|
||||
);
|
||||
|
||||
// If the region continues up to the end of the root table then GetMemoryRegionRec()
|
||||
// will return EFI_NOT_FOUND
|
||||
|
@@ -22,7 +22,7 @@ SectionToGcdAttributes (
|
||||
*GcdAttributes = 0;
|
||||
|
||||
// determine cacheability attributes
|
||||
switch(SectionAttributes & TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK) {
|
||||
switch (SectionAttributes & TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK) {
|
||||
case TT_DESCRIPTOR_SECTION_CACHE_POLICY_STRONGLY_ORDERED:
|
||||
*GcdAttributes |= EFI_MEMORY_UC;
|
||||
break;
|
||||
@@ -49,9 +49,9 @@ SectionToGcdAttributes (
|
||||
}
|
||||
|
||||
// determine protection attributes
|
||||
switch(SectionAttributes & TT_DESCRIPTOR_SECTION_AP_MASK) {
|
||||
switch (SectionAttributes & TT_DESCRIPTOR_SECTION_AP_MASK) {
|
||||
case TT_DESCRIPTOR_SECTION_AP_NO_NO: // no read, no write
|
||||
//*GcdAttributes |= EFI_MEMORY_RO | EFI_MEMORY_RP;
|
||||
// *GcdAttributes |= EFI_MEMORY_RO | EFI_MEMORY_RP;
|
||||
break;
|
||||
|
||||
case TT_DESCRIPTOR_SECTION_AP_RW_NO:
|
||||
@@ -86,7 +86,7 @@ PageToGcdAttributes (
|
||||
*GcdAttributes = 0;
|
||||
|
||||
// determine cacheability attributes
|
||||
switch(PageAttributes & TT_DESCRIPTOR_PAGE_CACHE_POLICY_MASK) {
|
||||
switch (PageAttributes & TT_DESCRIPTOR_PAGE_CACHE_POLICY_MASK) {
|
||||
case TT_DESCRIPTOR_PAGE_CACHE_POLICY_STRONGLY_ORDERED:
|
||||
*GcdAttributes |= EFI_MEMORY_UC;
|
||||
break;
|
||||
@@ -113,9 +113,9 @@ PageToGcdAttributes (
|
||||
}
|
||||
|
||||
// determine protection attributes
|
||||
switch(PageAttributes & TT_DESCRIPTOR_PAGE_AP_MASK) {
|
||||
switch (PageAttributes & TT_DESCRIPTOR_PAGE_AP_MASK) {
|
||||
case TT_DESCRIPTOR_PAGE_AP_NO_NO: // no read, no write
|
||||
//*GcdAttributes |= EFI_MEMORY_RO | EFI_MEMORY_RP;
|
||||
// *GcdAttributes |= EFI_MEMORY_RO | EFI_MEMORY_RP;
|
||||
break;
|
||||
|
||||
case TT_DESCRIPTOR_PAGE_AP_RW_NO:
|
||||
@@ -161,17 +161,17 @@ SyncCacheConfigPage (
|
||||
UINT64 GcdAttributes;
|
||||
|
||||
// Get the Base Address from FirstLevelDescriptor;
|
||||
BaseAddress = TT_DESCRIPTOR_PAGE_BASE_ADDRESS(SectionIndex << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
BaseAddress = TT_DESCRIPTOR_PAGE_BASE_ADDRESS (SectionIndex << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
|
||||
// Convert SectionAttributes into PageAttributes
|
||||
NextPageAttributes =
|
||||
TT_DESCRIPTOR_CONVERT_TO_PAGE_CACHE_POLICY(*NextSectionAttributes,0) |
|
||||
TT_DESCRIPTOR_CONVERT_TO_PAGE_AP(*NextSectionAttributes);
|
||||
TT_DESCRIPTOR_CONVERT_TO_PAGE_CACHE_POLICY (*NextSectionAttributes, 0) |
|
||||
TT_DESCRIPTOR_CONVERT_TO_PAGE_AP (*NextSectionAttributes);
|
||||
|
||||
// obtain page table base
|
||||
SecondLevelTable = (ARM_PAGE_TABLE_ENTRY *)(FirstLevelDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK);
|
||||
|
||||
for (i=0; i < TRANSLATION_TABLE_PAGE_COUNT; i++) {
|
||||
for (i = 0; i < TRANSLATION_TABLE_PAGE_COUNT; i++) {
|
||||
if ((SecondLevelTable[i] & TT_DESCRIPTOR_PAGE_TYPE_MASK) == TT_DESCRIPTOR_PAGE_TYPE_PAGE) {
|
||||
// extract attributes (cacheability and permissions)
|
||||
PageAttributes = SecondLevelTable[i] & (TT_DESCRIPTOR_PAGE_CACHE_POLICY_MASK | TT_DESCRIPTOR_PAGE_AP_MASK);
|
||||
@@ -206,13 +206,14 @@ SyncCacheConfigPage (
|
||||
*NextRegionBase = BaseAddress | (i << TT_DESCRIPTOR_PAGE_BASE_SHIFT);
|
||||
NextPageAttributes = 0;
|
||||
}
|
||||
|
||||
*NextRegionLength += TT_DESCRIPTOR_PAGE_SIZE;
|
||||
}
|
||||
|
||||
// Convert back PageAttributes into SectionAttributes
|
||||
*NextSectionAttributes =
|
||||
TT_DESCRIPTOR_CONVERT_TO_SECTION_CACHE_POLICY(NextPageAttributes,0) |
|
||||
TT_DESCRIPTOR_CONVERT_TO_SECTION_AP(NextPageAttributes);
|
||||
TT_DESCRIPTOR_CONVERT_TO_SECTION_CACHE_POLICY (NextPageAttributes, 0) |
|
||||
TT_DESCRIPTOR_CONVERT_TO_SECTION_AP (NextPageAttributes);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -233,7 +234,6 @@ SyncCacheConfig (
|
||||
UINTN NumberOfDescriptors;
|
||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
|
||||
|
||||
|
||||
DEBUG ((DEBUG_PAGE, "SyncCacheConfig()\n"));
|
||||
|
||||
// This code assumes MMU is enabled and filed with section translations
|
||||
@@ -246,7 +246,6 @@ SyncCacheConfig (
|
||||
Status = gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
// The GCD implementation maintains its own copy of the state of memory space attributes. GCD needs
|
||||
// to know what the initial memory space attributes are. The CPU Arch. Protocol does not provide a
|
||||
// GetMemoryAttributes function for GCD to get this so we must resort to calling GCD (as if we were
|
||||
@@ -261,7 +260,7 @@ SyncCacheConfig (
|
||||
|
||||
// iterate through each 1MB descriptor
|
||||
NextRegionBase = NextRegionLength = 0;
|
||||
for (i=0; i < TRANSLATION_TABLE_SECTION_COUNT; i++) {
|
||||
for (i = 0; i < TRANSLATION_TABLE_SECTION_COUNT; i++) {
|
||||
if ((FirstLevelTable[i] & TT_DESCRIPTOR_SECTION_TYPE_MASK) == TT_DESCRIPTOR_SECTION_TYPE_SECTION) {
|
||||
// extract attributes (cacheability and permissions)
|
||||
SectionAttributes = FirstLevelTable[i] & (TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK | TT_DESCRIPTOR_SECTION_AP_MASK);
|
||||
@@ -269,7 +268,7 @@ SyncCacheConfig (
|
||||
if (NextSectionAttributes == 0) {
|
||||
// start on a new region
|
||||
NextRegionLength = 0;
|
||||
NextRegionBase = TT_DESCRIPTOR_SECTION_BASE_ADDRESS(i << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
NextRegionBase = TT_DESCRIPTOR_SECTION_BASE_ADDRESS (i << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
NextSectionAttributes = SectionAttributes;
|
||||
} else if (SectionAttributes != NextSectionAttributes) {
|
||||
// Convert Section Attributes into GCD Attributes
|
||||
@@ -281,20 +280,26 @@ SyncCacheConfig (
|
||||
|
||||
// start on a new region
|
||||
NextRegionLength = 0;
|
||||
NextRegionBase = TT_DESCRIPTOR_SECTION_BASE_ADDRESS(i << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
NextRegionBase = TT_DESCRIPTOR_SECTION_BASE_ADDRESS (i << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
NextSectionAttributes = SectionAttributes;
|
||||
}
|
||||
|
||||
NextRegionLength += TT_DESCRIPTOR_SECTION_SIZE;
|
||||
} else if (TT_DESCRIPTOR_SECTION_TYPE_IS_PAGE_TABLE(FirstLevelTable[i])) {
|
||||
} else if (TT_DESCRIPTOR_SECTION_TYPE_IS_PAGE_TABLE (FirstLevelTable[i])) {
|
||||
// In this case any bits set in the 'NextSectionAttributes' are garbage and were set from
|
||||
// bits that are actually part of the pagetable address. We clear it out to zero so that
|
||||
// the SyncCacheConfigPage will use the page attributes instead of trying to convert the
|
||||
// section attributes into page attributes
|
||||
NextSectionAttributes = 0;
|
||||
Status = SyncCacheConfigPage (
|
||||
i,FirstLevelTable[i],
|
||||
NumberOfDescriptors, MemorySpaceMap,
|
||||
&NextRegionBase,&NextRegionLength,&NextSectionAttributes);
|
||||
i,
|
||||
FirstLevelTable[i],
|
||||
NumberOfDescriptors,
|
||||
MemorySpaceMap,
|
||||
&NextRegionBase,
|
||||
&NextRegionLength,
|
||||
&NextSectionAttributes
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
} else {
|
||||
// We do not support yet 16MB sections
|
||||
@@ -310,9 +315,10 @@ SyncCacheConfig (
|
||||
SetGcdMemorySpaceAttributes (MemorySpaceMap, NumberOfDescriptors, NextRegionBase, NextRegionLength, GcdAttributes);
|
||||
|
||||
NextRegionLength = 0;
|
||||
NextRegionBase = TT_DESCRIPTOR_SECTION_BASE_ADDRESS(i << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
NextRegionBase = TT_DESCRIPTOR_SECTION_BASE_ADDRESS (i << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
|
||||
NextSectionAttributes = 0;
|
||||
}
|
||||
|
||||
NextRegionLength += TT_DESCRIPTOR_SECTION_SIZE;
|
||||
}
|
||||
} // section entry loop
|
||||
@@ -345,7 +351,7 @@ EfiAttributeToArmAttribute (
|
||||
break;
|
||||
|
||||
case EFI_MEMORY_WC:
|
||||
// Map to normal non-cachable
|
||||
// Map to normal non-cacheable
|
||||
ArmAttributes = TT_DESCRIPTOR_SECTION_CACHE_POLICY_NON_CACHEABLE; // TEX [2:0]= 001 = 0x2, B=0, C=0
|
||||
break;
|
||||
|
||||
@@ -400,7 +406,7 @@ GetMemoryRegionPage (
|
||||
ASSERT (TableIndex < TRANSLATION_TABLE_PAGE_COUNT);
|
||||
|
||||
// Go through the page table to find the end of the section
|
||||
for (; TableIndex < TRANSLATION_TABLE_PAGE_COUNT; TableIndex++) {
|
||||
for ( ; TableIndex < TRANSLATION_TABLE_PAGE_COUNT; TableIndex++) {
|
||||
// Get the section at the given index
|
||||
PageDescriptor = PageTable[TableIndex];
|
||||
|
||||
@@ -416,7 +422,7 @@ GetMemoryRegionPage (
|
||||
}
|
||||
} else {
|
||||
// We do not support Large Page yet. We return EFI_SUCCESS that means end of the region.
|
||||
ASSERT(0);
|
||||
ASSERT (0);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -466,7 +472,7 @@ GetMemoryRegion (
|
||||
*BaseAddress = (*BaseAddress) & TT_DESCRIPTOR_PAGE_BASE_ADDRESS_MASK;
|
||||
|
||||
// Get the attribute at the page table level (Level 2)
|
||||
PageTable = (UINT32*)(SectionDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK);
|
||||
PageTable = (UINT32 *)(SectionDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK);
|
||||
|
||||
// Calculate index into first level translation table for start of modification
|
||||
PageTableIndex = ((*BaseAddress) & TT_DESCRIPTOR_PAGE_INDEX_MASK) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT;
|
||||
@@ -477,14 +483,14 @@ GetMemoryRegion (
|
||||
TT_DESCRIPTOR_CONVERT_TO_SECTION_AP (PageAttributes);
|
||||
}
|
||||
|
||||
for (;TableIndex < TRANSLATION_TABLE_SECTION_COUNT; TableIndex++) {
|
||||
for ( ; TableIndex < TRANSLATION_TABLE_SECTION_COUNT; TableIndex++) {
|
||||
// Get the section at the given index
|
||||
SectionDescriptor = FirstLevelTable[TableIndex];
|
||||
|
||||
// If the entry is a level-2 page table then we scan it to find the end of the region
|
||||
if (TT_DESCRIPTOR_SECTION_TYPE_IS_PAGE_TABLE (SectionDescriptor)) {
|
||||
// Extract the page table location from the descriptor
|
||||
PageTable = (UINT32*)(SectionDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK);
|
||||
PageTable = (UINT32 *)(SectionDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK);
|
||||
|
||||
// Scan the page table to find the end of the region.
|
||||
Status = GetMemoryRegionPage (PageTable, BaseAddress, RegionLength, RegionAttributes);
|
||||
@@ -494,7 +500,8 @@ GetMemoryRegion (
|
||||
break;
|
||||
}
|
||||
} else if (((SectionDescriptor & TT_DESCRIPTOR_SECTION_TYPE_MASK) == TT_DESCRIPTOR_SECTION_TYPE_SECTION) ||
|
||||
((SectionDescriptor & TT_DESCRIPTOR_SECTION_TYPE_MASK) == TT_DESCRIPTOR_SECTION_TYPE_SUPERSECTION)) {
|
||||
((SectionDescriptor & TT_DESCRIPTOR_SECTION_TYPE_MASK) == TT_DESCRIPTOR_SECTION_TYPE_SUPERSECTION))
|
||||
{
|
||||
if ((SectionDescriptor & TT_DESCRIPTOR_SECTION_ATTRIBUTE_MASK) != *RegionAttributes) {
|
||||
// If the attributes of the section differ from the one targeted then we exit the loop
|
||||
break;
|
||||
|
@@ -49,7 +49,6 @@ CpuFlushCpuDataCache (
|
||||
IN EFI_CPU_FLUSH_TYPE FlushType
|
||||
)
|
||||
{
|
||||
|
||||
switch (FlushType) {
|
||||
case EfiCpuFlushTypeWriteBack:
|
||||
WriteBackDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
|
||||
@@ -67,7 +66,6 @@ CpuFlushCpuDataCache (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function enables interrupt processing by the processor.
|
||||
|
||||
@@ -88,7 +86,6 @@ CpuEnableInterrupt (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function disables interrupt processing by the processor.
|
||||
|
||||
@@ -109,7 +106,6 @@ CpuDisableInterrupt (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function retrieves the processor's current interrupt state a returns it in
|
||||
State. If interrupts are currently enabled, then TRUE is returned. If interrupts
|
||||
@@ -134,11 +130,10 @@ CpuGetInterruptState (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*State = ArmGetInterruptState();
|
||||
*State = ArmGetInterruptState ();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function generates an INIT on the processor. If this function succeeds, then the
|
||||
processor will be reset, and control will not be returned to the caller. If InitType is
|
||||
@@ -247,7 +242,8 @@ CpuDxeInitialize (
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mCpuHandle,
|
||||
&gEfiCpuArchProtocolGuid, &mCpu,
|
||||
&gEfiCpuArchProtocolGuid,
|
||||
&mCpu,
|
||||
NULL
|
||||
);
|
||||
|
||||
@@ -262,8 +258,8 @@ CpuDxeInitialize (
|
||||
|
||||
// If the platform is a MPCore system then install the Configuration Table describing the
|
||||
// secondary core states
|
||||
if (ArmIsMpCore()) {
|
||||
PublishArmProcessorTable();
|
||||
if (ArmIsMpCore ()) {
|
||||
PublishArmProcessorTable ();
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __CPU_DXE_ARM_EXCEPTION_H__
|
||||
#define __CPU_DXE_ARM_EXCEPTION_H__
|
||||
#ifndef CPU_DXE_H_
|
||||
#define CPU_DXE_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
@@ -59,7 +59,6 @@ RegisterInterruptHandler (
|
||||
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
This function registers and enables the handler specified by InterruptHandler for a processor
|
||||
interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
|
||||
@@ -86,7 +85,6 @@ RegisterDebuggerInterruptHandler (
|
||||
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuSetMemoryAttributes (
|
||||
@@ -117,7 +115,7 @@ SyncCacheConfig (
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PublishArmProcessorTable(
|
||||
PublishArmProcessorTable (
|
||||
VOID
|
||||
);
|
||||
|
||||
@@ -143,4 +141,4 @@ SetGcdMemorySpaceAttributes (
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
#endif // __CPU_DXE_ARM_EXCEPTION_H__
|
||||
#endif // CPU_DXE_H_
|
||||
|
@@ -43,19 +43,22 @@ SearchGcdMemorySpaces (
|
||||
*EndIndex = 0;
|
||||
for (Index = 0; Index < NumberOfDescriptors; Index++) {
|
||||
if ((BaseAddress >= MemorySpaceMap[Index].BaseAddress) &&
|
||||
(BaseAddress < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length))) {
|
||||
(BaseAddress < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)))
|
||||
{
|
||||
*StartIndex = Index;
|
||||
}
|
||||
|
||||
if (((BaseAddress + Length - 1) >= MemorySpaceMap[Index].BaseAddress) &&
|
||||
((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length))) {
|
||||
((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)))
|
||||
{
|
||||
*EndIndex = Index;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Sets the attributes for a specified range in Gcd Memory Space Map.
|
||||
|
||||
@@ -88,14 +91,21 @@ SetGcdMemorySpaceAttributes (
|
||||
EFI_PHYSICAL_ADDRESS RegionStart;
|
||||
UINT64 RegionLength;
|
||||
|
||||
DEBUG ((DEBUG_GCD, "SetGcdMemorySpaceAttributes[0x%lX; 0x%lX] = 0x%lX\n",
|
||||
BaseAddress, BaseAddress + Length, Attributes));
|
||||
DEBUG ((
|
||||
DEBUG_GCD,
|
||||
"SetGcdMemorySpaceAttributes[0x%lX; 0x%lX] = 0x%lX\n",
|
||||
BaseAddress,
|
||||
BaseAddress + Length,
|
||||
Attributes
|
||||
));
|
||||
|
||||
// We do not support a smaller granularity than 4KB on ARM Architecture
|
||||
if ((Length & EFI_PAGE_MASK) != 0) {
|
||||
DEBUG ((DEBUG_WARN,
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"Warning: We do not support smaller granularity than 4KB on ARM Architecture (passed length: 0x%lX).\n",
|
||||
Length));
|
||||
Length
|
||||
));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -120,6 +130,7 @@ SetGcdMemorySpaceAttributes (
|
||||
if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the start and end address of the overlapping range
|
||||
//
|
||||
@@ -128,11 +139,13 @@ SetGcdMemorySpaceAttributes (
|
||||
} else {
|
||||
RegionStart = MemorySpaceMap[Index].BaseAddress;
|
||||
}
|
||||
|
||||
if ((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)) {
|
||||
RegionLength = BaseAddress + Length - RegionStart;
|
||||
} else {
|
||||
RegionLength = MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - RegionStart;
|
||||
}
|
||||
|
||||
//
|
||||
// Set memory attributes according to MTRR attribute and the original attribute of descriptor
|
||||
//
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
@@ -26,13 +26,13 @@ ARM_PROCESSOR_TABLE mArmProcessorTableTemplate = {
|
||||
EFI_ARM_PROCESSOR_TABLE_CREATOR_REVISION,
|
||||
{ 0 },
|
||||
0
|
||||
}, //ARM Processor table header
|
||||
}, // ARM Processor table header
|
||||
0, // Number of entries in ARM processor Table
|
||||
NULL // ARM Processor Table
|
||||
};
|
||||
|
||||
/** Publish ARM Processor Data table in UEFI SYSTEM Table.
|
||||
* @param: HobStart Pointer to the beginning of the HOB List from PEI.
|
||||
* @param HobStart Pointer to the beginning of the HOB List from PEI.
|
||||
*
|
||||
* Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.
|
||||
* If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory
|
||||
@@ -50,42 +50,43 @@ PublishArmProcessorTable (
|
||||
Hob.Raw = GetHobList ();
|
||||
|
||||
// Iterate through the HOBs and find if there is ARM PROCESSOR ENTRY HOB
|
||||
for (; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
|
||||
for ( ; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) {
|
||||
// Check for Correct HOB type
|
||||
if ((GET_HOB_TYPE (Hob)) == EFI_HOB_TYPE_GUID_EXTENSION) {
|
||||
// Check for correct GUID type
|
||||
if (CompareGuid(&(Hob.Guid->Name), &gArmMpCoreInfoGuid)) {
|
||||
if (CompareGuid (&(Hob.Guid->Name), &gArmMpCoreInfoGuid)) {
|
||||
ARM_PROCESSOR_TABLE *ArmProcessorTable;
|
||||
EFI_STATUS Status;
|
||||
|
||||
// Allocate Runtime memory for ARM processor table
|
||||
ArmProcessorTable = (ARM_PROCESSOR_TABLE*)AllocateRuntimePool(sizeof(ARM_PROCESSOR_TABLE));
|
||||
ArmProcessorTable = (ARM_PROCESSOR_TABLE *)AllocateRuntimePool (sizeof (ARM_PROCESSOR_TABLE));
|
||||
|
||||
// Check if the memory allocation is successful or not
|
||||
ASSERT(NULL != ArmProcessorTable);
|
||||
ASSERT (NULL != ArmProcessorTable);
|
||||
|
||||
// Set ARM processor table to default values
|
||||
CopyMem(ArmProcessorTable,&mArmProcessorTableTemplate,sizeof(ARM_PROCESSOR_TABLE));
|
||||
CopyMem (ArmProcessorTable, &mArmProcessorTableTemplate, sizeof (ARM_PROCESSOR_TABLE));
|
||||
|
||||
// Fill in Length fields of ARM processor table
|
||||
ArmProcessorTable->Header.Length = sizeof(ARM_PROCESSOR_TABLE);
|
||||
ArmProcessorTable->Header.DataLen = GET_GUID_HOB_DATA_SIZE(Hob);
|
||||
ArmProcessorTable->Header.Length = sizeof (ARM_PROCESSOR_TABLE);
|
||||
ArmProcessorTable->Header.DataLen = GET_GUID_HOB_DATA_SIZE (Hob);
|
||||
|
||||
// Fill in Identifier(ARM processor table GUID)
|
||||
ArmProcessorTable->Header.Identifier = gArmMpCoreInfoGuid;
|
||||
|
||||
// Set Number of ARM core entries in the Table
|
||||
ArmProcessorTable->NumberOfEntries = GET_GUID_HOB_DATA_SIZE(Hob)/sizeof(ARM_CORE_INFO);
|
||||
ArmProcessorTable->NumberOfEntries = GET_GUID_HOB_DATA_SIZE (Hob)/sizeof (ARM_CORE_INFO);
|
||||
|
||||
// Allocate runtime memory for ARM processor Table entries
|
||||
ArmProcessorTable->ArmCpus = (ARM_CORE_INFO*)AllocateRuntimePool (
|
||||
ArmProcessorTable->NumberOfEntries * sizeof(ARM_CORE_INFO));
|
||||
ArmProcessorTable->ArmCpus = (ARM_CORE_INFO *)AllocateRuntimePool (
|
||||
ArmProcessorTable->NumberOfEntries * sizeof (ARM_CORE_INFO)
|
||||
);
|
||||
|
||||
// Check if the memory allocation is successful or not
|
||||
ASSERT(NULL != ArmProcessorTable->ArmCpus);
|
||||
ASSERT (NULL != ArmProcessorTable->ArmCpus);
|
||||
|
||||
// Copy ARM Processor Table data from HOB list to newly allocated memory
|
||||
CopyMem(ArmProcessorTable->ArmCpus,GET_GUID_HOB_DATA(Hob), ArmProcessorTable->Header.DataLen);
|
||||
CopyMem (ArmProcessorTable->ArmCpus, GET_GUID_HOB_DATA (Hob), ArmProcessorTable->Header.DataLen);
|
||||
|
||||
// Install the ARM Processor table into EFI system configuration table
|
||||
Status = gBS->InstallConfigurationTable (&gArmMpCoreInfoGuid, ArmProcessorTable);
|
||||
|
@@ -23,13 +23,13 @@ InitializeExceptions (
|
||||
BOOLEAN FiqEnabled;
|
||||
|
||||
VectorInfo = (EFI_VECTOR_HANDOFF_INFO *)NULL;
|
||||
Status = EfiGetSystemConfigurationTable(&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList);
|
||||
if (Status == EFI_SUCCESS && VectorInfoList != NULL) {
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList);
|
||||
if ((Status == EFI_SUCCESS) && (VectorInfoList != NULL)) {
|
||||
VectorInfo = VectorInfoList;
|
||||
}
|
||||
|
||||
// initialize the CpuExceptionHandlerLib so we take over the exception vector table from the DXE Core
|
||||
InitializeCpuExceptionHandlers(VectorInfo);
|
||||
InitializeCpuExceptionHandlers (VectorInfo);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
@@ -90,11 +90,11 @@ previously installed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RegisterInterruptHandler(
|
||||
RegisterInterruptHandler (
|
||||
IN EFI_EXCEPTION_TYPE InterruptType,
|
||||
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
||||
)
|
||||
{
|
||||
// pass down to CpuExceptionHandlerLib
|
||||
return (EFI_STATUS)RegisterCpuInterruptHandler(InterruptType, InterruptHandler);
|
||||
return (EFI_STATUS)RegisterCpuInterruptHandler (InterruptType, InterruptHandler);
|
||||
}
|
||||
|
@@ -16,8 +16,6 @@ Abstract:
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
@@ -70,12 +68,12 @@ InitializeCpuPeim (
|
||||
BuildCpuHob (ArmGetPhysicalAddressBits (), PcdGet8 (PcdPrePiCpuIoSize));
|
||||
|
||||
// Only MP Core platform need to produce gArmMpCoreInfoPpiGuid
|
||||
Status = PeiServicesLocatePpi (&gArmMpCoreInfoPpiGuid, 0, NULL, (VOID**)&ArmMpCoreInfoPpi);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = PeiServicesLocatePpi (&gArmMpCoreInfoPpiGuid, 0, NULL, (VOID **)&ArmMpCoreInfoPpi);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
// Build the MP Core Info Table
|
||||
ArmCoreCount = 0;
|
||||
Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
|
||||
if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) {
|
||||
if (!EFI_ERROR (Status) && (ArmCoreCount > 0)) {
|
||||
// Build MPCore Info HOB
|
||||
BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);
|
||||
}
|
||||
|
@@ -5,8 +5,9 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
#ifndef __GENERIC_WATCHDOG_H__
|
||||
#define __GENERIC_WATCHDOG_H__
|
||||
|
||||
#ifndef GENERIC_WATCHDOG_H_
|
||||
#define GENERIC_WATCHDOG_H_
|
||||
|
||||
// Refresh Frame:
|
||||
#define GENERIC_WDOG_REFRESH_REG ((UINTN)FixedPcdGet64 (PcdGenericWatchdogRefreshBase) + 0x000)
|
||||
@@ -21,4 +22,4 @@
|
||||
#define GENERIC_WDOG_ENABLED 1
|
||||
#define GENERIC_WDOG_DISABLED 0
|
||||
|
||||
#endif // __GENERIC_WATCHDOG_H__
|
||||
#endif // GENERIC_WATCHDOG_H_
|
||||
|
@@ -101,7 +101,7 @@ WatchdogInterruptHandler (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
STATIC CONST CHAR16 ResetString[]= L"The generic watchdog timer ran out.";
|
||||
STATIC CONST CHAR16 ResetString[] = L"The generic watchdog timer ran out.";
|
||||
UINT64 TimerPeriod;
|
||||
|
||||
WatchdogDisable ();
|
||||
@@ -119,8 +119,12 @@ WatchdogInterruptHandler (
|
||||
mWatchdogNotify (TimerPeriod + 1);
|
||||
}
|
||||
|
||||
gRT->ResetSystem (EfiResetCold, EFI_TIMEOUT, StrSize (ResetString),
|
||||
(CHAR16 *)ResetString);
|
||||
gRT->ResetSystem (
|
||||
EfiResetCold,
|
||||
EFI_TIMEOUT,
|
||||
StrSize (ResetString),
|
||||
(CHAR16 *)ResetString
|
||||
);
|
||||
|
||||
// If we got here then the reset didn't work
|
||||
ASSERT (FALSE);
|
||||
@@ -158,11 +162,11 @@ WatchdogRegisterHandler (
|
||||
IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
|
||||
)
|
||||
{
|
||||
if (mWatchdogNotify == NULL && NotifyFunction == NULL) {
|
||||
if ((mWatchdogNotify == NULL) && (NotifyFunction == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (mWatchdogNotify != NULL && NotifyFunction != NULL) {
|
||||
if ((mWatchdogNotify != NULL) && (NotifyFunction != NULL)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
@@ -307,8 +311,11 @@ GenericWatchdogEntry (
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
Status = gBS->LocateProtocol (&gHardwareInterrupt2ProtocolGuid, NULL,
|
||||
(VOID **)&mInterruptProtocol);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gHardwareInterrupt2ProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&mInterruptProtocol
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
/* Make sure the Watchdog Timer Architectural Protocol has not been installed
|
||||
@@ -320,33 +327,44 @@ GenericWatchdogEntry (
|
||||
ASSERT (mTimerFrequencyHz != 0);
|
||||
|
||||
// Install interrupt handler
|
||||
Status = mInterruptProtocol->RegisterInterruptSource (mInterruptProtocol,
|
||||
Status = mInterruptProtocol->RegisterInterruptSource (
|
||||
mInterruptProtocol,
|
||||
FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum),
|
||||
WatchdogInterruptHandler);
|
||||
WatchdogInterruptHandler
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = mInterruptProtocol->SetTriggerType (mInterruptProtocol,
|
||||
Status = mInterruptProtocol->SetTriggerType (
|
||||
mInterruptProtocol,
|
||||
FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum),
|
||||
EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING);
|
||||
EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto UnregisterHandler;
|
||||
}
|
||||
|
||||
// Install the Timer Architectural Protocol onto a new handle
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (&Handle,
|
||||
&gEfiWatchdogTimerArchProtocolGuid, &mWatchdogTimer,
|
||||
NULL);
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiWatchdogTimerArchProtocolGuid,
|
||||
&mWatchdogTimer,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto UnregisterHandler;
|
||||
}
|
||||
|
||||
// Register for an ExitBootServicesEvent
|
||||
Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY,
|
||||
WatchdogExitBootServicesEvent, NULL,
|
||||
&mEfiExitBootServicesEvent);
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_SIGNAL_EXIT_BOOT_SERVICES,
|
||||
TPL_NOTIFY,
|
||||
WatchdogExitBootServicesEvent,
|
||||
NULL,
|
||||
&mEfiExitBootServicesEvent
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mNumTimerTicks = 0;
|
||||
@@ -356,8 +374,10 @@ GenericWatchdogEntry (
|
||||
|
||||
UnregisterHandler:
|
||||
// Unregister the handler
|
||||
mInterruptProtocol->RegisterInterruptSource (mInterruptProtocol,
|
||||
mInterruptProtocol->RegisterInterruptSource (
|
||||
mInterruptProtocol,
|
||||
FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum),
|
||||
NULL);
|
||||
NULL
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2013-2017, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2013-2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -13,6 +13,7 @@
|
||||
ENTRY_POINT = GenericWatchdogEntry
|
||||
|
||||
[Sources.common]
|
||||
GenericWatchdog.h
|
||||
GenericWatchdogDxe.c
|
||||
|
||||
[Packages]
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2016-2018, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2016-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#if !defined _MM_COMMUNICATE_H_
|
||||
#define _MM_COMMUNICATE_H_
|
||||
#ifndef MM_COMMUNICATE_H_
|
||||
#define MM_COMMUNICATE_H_
|
||||
|
||||
#define MM_MAJOR_VER_MASK 0xEFFF0000
|
||||
#define MM_MINOR_VER_MASK 0x0000FFFF
|
||||
@@ -19,4 +19,4 @@
|
||||
#define MM_CALLER_MAJOR_VER 0x1UL
|
||||
#define MM_CALLER_MINOR_VER 0x0
|
||||
|
||||
#endif /* _MM_COMMUNICATE_H_ */
|
||||
#endif /* MM_COMMUNICATE_H_ */
|
||||
|
@@ -42,14 +42,20 @@ STATIC EFI_HANDLE mMmCommunicateHandle;
|
||||
This function provides a service to send and receive messages from a registered UEFI service.
|
||||
|
||||
@param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instance.
|
||||
@param[in] CommBufferPhysical Physical address of the MM communication buffer
|
||||
@param[in] CommBufferVirtual Virtual address of the MM communication buffer
|
||||
@param[in] CommSize The size of the data buffer being passed in. On exit, the size of data
|
||||
being returned. Zero if the handler does not wish to reply with any data.
|
||||
This parameter is optional and may be NULL.
|
||||
@param[in, out] CommBufferPhysical Physical address of the MM communication buffer
|
||||
@param[in, out] CommBufferVirtual Virtual address of the MM communication buffer
|
||||
@param[in, out] CommSize The size of the data buffer being passed in. On input,
|
||||
when not omitted, the buffer should cover EFI_MM_COMMUNICATE_HEADER
|
||||
and the value of MessageLength field. On exit, the size
|
||||
of data being returned. Zero if the handler does not
|
||||
wish to reply with any data. This parameter is optional
|
||||
and may be NULL.
|
||||
|
||||
@retval EFI_SUCCESS The message was successfully posted.
|
||||
@retval EFI_INVALID_PARAMETER CommBufferPhysical was NULL or CommBufferVirtual was NULL.
|
||||
@retval EFI_INVALID_PARAMETER CommBufferPhysical or CommBufferVirtual was NULL, or
|
||||
integer value pointed by CommSize does not cover
|
||||
EFI_MM_COMMUNICATE_HEADER and the value of MessageLength
|
||||
field.
|
||||
@retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implementation.
|
||||
If this error is returned, the MessageLength field
|
||||
in the CommBuffer header or the integer pointed by
|
||||
@@ -82,10 +88,11 @@ MmCommunication2Communicate (
|
||||
//
|
||||
// Check parameters
|
||||
//
|
||||
if (CommBufferVirtual == NULL) {
|
||||
if ((CommBufferVirtual == NULL) || (CommBufferPhysical == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
CommunicateHeader = CommBufferVirtual;
|
||||
// CommBuffer is a mandatory parameter. Hence, Rely on
|
||||
// MessageLength + Header to ascertain the
|
||||
@@ -95,33 +102,41 @@ MmCommunication2Communicate (
|
||||
sizeof (CommunicateHeader->HeaderGuid) +
|
||||
sizeof (CommunicateHeader->MessageLength);
|
||||
|
||||
// If the length of the CommBuffer is 0 then return the expected length.
|
||||
if (CommSize != 0) {
|
||||
// If CommSize is not omitted, perform size inspection before proceeding.
|
||||
if (CommSize != NULL) {
|
||||
// This case can be used by the consumer of this driver to find out the
|
||||
// max size that can be used for allocating CommBuffer.
|
||||
if ((*CommSize == 0) ||
|
||||
(*CommSize > mNsCommBuffMemRegion.Length)) {
|
||||
(*CommSize > mNsCommBuffMemRegion.Length))
|
||||
{
|
||||
*CommSize = mNsCommBuffMemRegion.Length;
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
Status = EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
//
|
||||
// CommSize must match MessageLength + sizeof (EFI_MM_COMMUNICATE_HEADER);
|
||||
// CommSize should cover at least MessageLength + sizeof (EFI_MM_COMMUNICATE_HEADER);
|
||||
//
|
||||
if (*CommSize != BufferSize) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (*CommSize < BufferSize) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If the buffer size is 0 or greater than what can be tolerated by the MM
|
||||
// If the message length is 0 or greater than what can be tolerated by the MM
|
||||
// environment then return the expected size.
|
||||
//
|
||||
if ((BufferSize == 0) ||
|
||||
(BufferSize > mNsCommBuffMemRegion.Length)) {
|
||||
if ((CommunicateHeader->MessageLength == 0) ||
|
||||
(BufferSize > mNsCommBuffMemRegion.Length))
|
||||
{
|
||||
CommunicateHeader->MessageLength = mNsCommBuffMemRegion.Length -
|
||||
sizeof (CommunicateHeader->HeaderGuid) -
|
||||
sizeof (CommunicateHeader->MessageLength);
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
Status = EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
// MessageLength or CommSize check has failed, return here.
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
// SMC Function ID
|
||||
@@ -219,15 +234,19 @@ NotifySetVirtualAddressMap (
|
||||
(VOID **)&mNsCommBuffMemRegion.VirtualBase
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "NotifySetVirtualAddressMap():"
|
||||
" Unable to convert MM runtime pointer. Status:0x%r\n", Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"NotifySetVirtualAddressMap():"
|
||||
" Unable to convert MM runtime pointer. Status:0x%r\n",
|
||||
Status
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetMmCompatibility ()
|
||||
GetMmCompatibility (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 MmVersion;
|
||||
@@ -240,21 +259,32 @@ GetMmCompatibility ()
|
||||
|
||||
MmVersion = MmVersionArgs.Arg0;
|
||||
|
||||
if ((MM_MAJOR_VER(MmVersion) == MM_CALLER_MAJOR_VER) &&
|
||||
(MM_MINOR_VER(MmVersion) >= MM_CALLER_MINOR_VER)) {
|
||||
DEBUG ((DEBUG_INFO, "MM Version: Major=0x%x, Minor=0x%x\n",
|
||||
MM_MAJOR_VER(MmVersion), MM_MINOR_VER(MmVersion)));
|
||||
if ((MM_MAJOR_VER (MmVersion) == MM_CALLER_MAJOR_VER) &&
|
||||
(MM_MINOR_VER (MmVersion) >= MM_CALLER_MINOR_VER))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"MM Version: Major=0x%x, Minor=0x%x\n",
|
||||
MM_MAJOR_VER (MmVersion),
|
||||
MM_MINOR_VER (MmVersion)
|
||||
));
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "Incompatible MM Versions.\n Current Version: Major=0x%x, Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n",
|
||||
MM_MAJOR_VER(MmVersion), MM_MINOR_VER(MmVersion), MM_CALLER_MAJOR_VER, MM_CALLER_MINOR_VER));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"Incompatible MM Versions.\n Current Version: Major=0x%x, Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n",
|
||||
MM_MAJOR_VER (MmVersion),
|
||||
MM_MINOR_VER (MmVersion),
|
||||
MM_CALLER_MAJOR_VER,
|
||||
MM_CALLER_MINOR_VER
|
||||
));
|
||||
Status = EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC EFI_GUID* CONST mGuidedEventGuid[] = {
|
||||
STATIC EFI_GUID *CONST mGuidedEventGuid[] = {
|
||||
&gEfiEndOfDxeEventGroupGuid,
|
||||
&gEfiEventExitBootServicesGuid,
|
||||
&gEfiEventReadyToBootGuid,
|
||||
@@ -317,7 +347,7 @@ MmCommunication2Initialize (
|
||||
|
||||
// Check if we can make the MM call
|
||||
Status = GetMmCompatibility ();
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ReturnErrorStatus;
|
||||
}
|
||||
|
||||
@@ -339,8 +369,11 @@ MmCommunication2Initialize (
|
||||
EFI_MEMORY_RUNTIME
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "MmCommunicateInitialize: "
|
||||
"Failed to add MM-NS Buffer Memory Space\n"));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"MmCommunicateInitialize: "
|
||||
"Failed to add MM-NS Buffer Memory Space\n"
|
||||
));
|
||||
goto ReturnErrorStatus;
|
||||
}
|
||||
|
||||
@@ -350,8 +383,11 @@ MmCommunication2Initialize (
|
||||
EFI_MEMORY_WB | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "MmCommunicateInitialize: "
|
||||
"Failed to set MM-NS Buffer Memory attributes\n"));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"MmCommunicateInitialize: "
|
||||
"Failed to set MM-NS Buffer Memory attributes\n"
|
||||
));
|
||||
goto CleanAddedMemorySpace;
|
||||
}
|
||||
|
||||
@@ -362,9 +398,12 @@ MmCommunication2Initialize (
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mMmCommunication2
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "MmCommunicationInitialize: "
|
||||
"Failed to install MM communication protocol\n"));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"MmCommunicationInitialize: "
|
||||
"Failed to install MM communication protocol\n"
|
||||
));
|
||||
goto CleanAddedMemorySpace;
|
||||
}
|
||||
|
||||
@@ -381,17 +420,24 @@ MmCommunication2Initialize (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) {
|
||||
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
|
||||
MmGuidedEventNotify, mGuidedEventGuid[Index],
|
||||
mGuidedEventGuid[Index], &mGuidedEvent[Index]);
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
MmGuidedEventNotify,
|
||||
mGuidedEventGuid[Index],
|
||||
mGuidedEventGuid[Index],
|
||||
&mGuidedEvent[Index]
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
while (Index-- > 0) {
|
||||
gBS->CloseEvent (mGuidedEvent[Index]);
|
||||
}
|
||||
|
||||
goto UninstallProtocol;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
UninstallProtocol:
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# DXE MM Communicate driver
|
||||
#
|
||||
# Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -24,6 +24,7 @@
|
||||
#
|
||||
|
||||
[Sources.AARCH64]
|
||||
MmCommunicate.h
|
||||
MmCommunication.c
|
||||
|
||||
[Packages]
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Library/ArmLib.h>
|
||||
@@ -305,8 +304,7 @@ TimerInterruptHandler (
|
||||
gInterrupt->EndOfInterrupt (gInterrupt, Source);
|
||||
|
||||
// Check if the timer interrupt is active
|
||||
if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {
|
||||
|
||||
if ((ArmGenericTimerGetTimerCtrlReg ()) & ARM_ARCH_TIMER_ISTATUS) {
|
||||
if (mTimerNotifyFunction != 0) {
|
||||
mTimerNotifyFunction (mTimerPeriod * mElapsedPeriod);
|
||||
}
|
||||
@@ -338,7 +336,6 @@ TimerInterruptHandler (
|
||||
gBS->RestoreTPL (OriginalTPL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize the state information for the Timer Architectural Protocol and
|
||||
the Timer Debug support protocol that allows the debugger to break into a
|
||||
@@ -405,17 +402,18 @@ TimerInitialize (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
// Set up default timer
|
||||
Status = TimerDriverSetTimerPeriod (&gTimer, FixedPcdGet32(PcdTimerPeriod)); // TIMER_DEFAULT_PERIOD
|
||||
Status = TimerDriverSetTimerPeriod (&gTimer, FixedPcdGet32 (PcdTimerPeriod)); // TIMER_DEFAULT_PERIOD
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Handle = NULL;
|
||||
// Install the Timer Architectural Protocol onto a new handle
|
||||
Status = gBS->InstallMultipleProtocolInterfaces(
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiTimerArchProtocolGuid, &gTimer,
|
||||
&gEfiTimerArchProtocolGuid,
|
||||
&gTimer,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
// Everything is ready, unmask and enable timer interrupts
|
||||
TimerCtrlReg = ARM_ARCH_TIMER_ENABLE;
|
||||
|
@@ -51,7 +51,7 @@ EFI_FILE gSemihostFsFile = {
|
||||
};
|
||||
|
||||
//
|
||||
// Device path for semi-hosting. It contains our autogened Caller ID GUID.
|
||||
// Device path for semi-hosting. It contains our auto-generated Caller ID GUID.
|
||||
//
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH Guid;
|
||||
@@ -60,10 +60,12 @@ typedef struct {
|
||||
|
||||
SEMIHOST_DEVICE_PATH gDevicePath = {
|
||||
{
|
||||
{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, { sizeof (VENDOR_DEVICE_PATH), 0 } },
|
||||
{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, { sizeof (VENDOR_DEVICE_PATH), 0 }
|
||||
},
|
||||
EFI_CALLER_ID_GUID
|
||||
},
|
||||
{ END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 } }
|
||||
{ END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -115,8 +117,6 @@ FreeFCB (
|
||||
FreePool (Fcb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
VolumeOpen (
|
||||
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
|
||||
@@ -191,14 +191,16 @@ FileOpen (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ( (OpenMode != EFI_FILE_MODE_READ) &&
|
||||
if ((OpenMode != EFI_FILE_MODE_READ) &&
|
||||
(OpenMode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE)) &&
|
||||
(OpenMode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE)) ) {
|
||||
(OpenMode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE)))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (((OpenMode & EFI_FILE_MODE_CREATE) != 0) &&
|
||||
((Attributes & EFI_FILE_DIRECTORY) != 0)) {
|
||||
((Attributes & EFI_FILE_DIRECTORY) != 0))
|
||||
{
|
||||
return EFI_WRITE_PROTECTED;
|
||||
}
|
||||
|
||||
@@ -207,13 +209,15 @@ FileOpen (
|
||||
if (AsciiFileName == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
UnicodeStrToAsciiStrS (FileName, AsciiFileName, Length);
|
||||
|
||||
// Opening '/', '\', '.', or the NULL pathname is trying to open the root directory
|
||||
if ((AsciiStrCmp (AsciiFileName, "\\") == 0) ||
|
||||
(AsciiStrCmp (AsciiFileName, "/") == 0) ||
|
||||
(AsciiStrCmp (AsciiFileName, "") == 0) ||
|
||||
(AsciiStrCmp (AsciiFileName, ".") == 0) ) {
|
||||
(AsciiStrCmp (AsciiFileName, ".") == 0))
|
||||
{
|
||||
FreePool (AsciiFileName);
|
||||
return (VolumeOpen (&gSemihostFs, NewHandle));
|
||||
}
|
||||
@@ -232,6 +236,7 @@ FileOpen (
|
||||
} else {
|
||||
SemihostMode = SEMIHOST_FILE_MODE_READ | SEMIHOST_FILE_MODE_BINARY | SEMIHOST_FILE_MODE_UPDATE;
|
||||
}
|
||||
|
||||
Return = SemihostFileOpen (AsciiFileName, SemihostMode, &SemihostHandle);
|
||||
|
||||
if (RETURN_ERROR (Return)) {
|
||||
@@ -346,6 +351,7 @@ TruncateFile (
|
||||
if (RETURN_ERROR (Return)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Remaining -= ToRead;
|
||||
Read += ToRead;
|
||||
}
|
||||
@@ -379,12 +385,12 @@ Error:
|
||||
if (FileHandle != 0) {
|
||||
SemihostFileClose (FileHandle);
|
||||
}
|
||||
|
||||
if (Buffer != NULL) {
|
||||
FreePool (Buffer);
|
||||
}
|
||||
|
||||
return (Status);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,7 +414,7 @@ FileClose (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS(This);
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS (This);
|
||||
|
||||
if (!Fcb->IsRoot) {
|
||||
SemihostFileClose (Fcb->SemihostHandle);
|
||||
@@ -420,6 +426,7 @@ FileClose (
|
||||
if (Fcb->Info.FileSize < Fcb->Info.PhysicalSize) {
|
||||
TruncateFile (Fcb->FileName, Fcb->Info.FileSize);
|
||||
}
|
||||
|
||||
FreePool (Fcb->FileName);
|
||||
}
|
||||
|
||||
@@ -471,6 +478,7 @@ FileDelete (
|
||||
if (RETURN_ERROR (Return)) {
|
||||
return EFI_WARN_DELETE_FAILURE;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
return EFI_WARN_DELETE_FAILURE;
|
||||
@@ -566,14 +574,15 @@ ExtendFile (
|
||||
}
|
||||
|
||||
Remaining = Size;
|
||||
SetMem (WriteBuffer, 0, sizeof(WriteBuffer));
|
||||
SetMem (WriteBuffer, 0, sizeof (WriteBuffer));
|
||||
while (Remaining > 0) {
|
||||
WriteNb = MIN (Remaining, sizeof(WriteBuffer));
|
||||
WriteNb = MIN (Remaining, sizeof (WriteBuffer));
|
||||
WriteSize = WriteNb;
|
||||
Return = SemihostFileWrite (Fcb->SemihostHandle, &WriteSize, WriteBuffer);
|
||||
if (RETURN_ERROR (Return)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Remaining -= WriteNb;
|
||||
}
|
||||
|
||||
@@ -617,8 +626,9 @@ FileWrite (
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS (This);
|
||||
|
||||
// We cannot write a read-only file
|
||||
if ((Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
|
||||
|| !(Fcb->OpenMode & EFI_FILE_MODE_WRITE)) {
|
||||
if ( (Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
|
||||
|| !(Fcb->OpenMode & EFI_FILE_MODE_WRITE))
|
||||
{
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@@ -632,6 +642,7 @@ FileWrite (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Fcb->Info.FileSize = Fcb->Position;
|
||||
}
|
||||
|
||||
@@ -650,6 +661,7 @@ FileWrite (
|
||||
if (RETURN_ERROR (Return)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Fcb->Info.PhysicalSize = Length;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -678,7 +690,7 @@ FileGetPosition (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS(This);
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS (This);
|
||||
|
||||
*Position = Fcb->Position;
|
||||
|
||||
@@ -718,8 +730,7 @@ FileSetPosition (
|
||||
if (Position != 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//
|
||||
// UEFI Spec section 12.5:
|
||||
// "Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position to
|
||||
@@ -728,6 +739,7 @@ FileSetPosition (
|
||||
if (Position == 0xFFFFFFFFFFFFFFFF) {
|
||||
Position = Fcb->Info.FileSize;
|
||||
}
|
||||
|
||||
Return = SemihostFileSeek (Fcb->SemihostHandle, MIN (Position, Fcb->Info.FileSize));
|
||||
if (RETURN_ERROR (Return)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
@@ -767,7 +779,7 @@ GetFileInfo (
|
||||
|
||||
if (Fcb->IsRoot) {
|
||||
NameSize = 0;
|
||||
ResultSize = SIZE_OF_EFI_FILE_INFO + sizeof(CHAR16);
|
||||
ResultSize = SIZE_OF_EFI_FILE_INFO + sizeof (CHAR16);
|
||||
} else {
|
||||
NameSize = AsciiStrLen (Fcb->FileName) + 1;
|
||||
ResultSize = SIZE_OF_EFI_FILE_INFO + NameSize * sizeof (CHAR16);
|
||||
@@ -889,11 +901,12 @@ FileGetInfo (
|
||||
if ((This == NULL) ||
|
||||
(InformationType == NULL) ||
|
||||
(BufferSize == NULL) ||
|
||||
((Buffer == NULL) && (*BufferSize > 0)) ) {
|
||||
((Buffer == NULL) && (*BufferSize > 0)))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS(This);
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS (This);
|
||||
|
||||
if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
|
||||
Status = GetFilesystemInfo (Fcb, BufferSize, Buffer);
|
||||
@@ -968,6 +981,7 @@ SetFileInfo (
|
||||
if (AsciiFileName == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
UnicodeStrToAsciiStrS (Info->FileName, AsciiFileName, Length);
|
||||
|
||||
FileSizeIsDifferent = (Info->FileSize != Fcb->Info.FileSize);
|
||||
@@ -985,7 +999,8 @@ SetFileInfo (
|
||||
// description.
|
||||
//
|
||||
if ((Fcb->OpenMode == EFI_FILE_MODE_READ) ||
|
||||
(Fcb->Info.Attribute & EFI_FILE_READ_ONLY) ) {
|
||||
(Fcb->Info.Attribute & EFI_FILE_READ_ONLY))
|
||||
{
|
||||
if (FileSizeIsDifferent || FileNameIsDifferent || ReadOnlyIsDifferent) {
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Error;
|
||||
@@ -1006,6 +1021,7 @@ SetFileInfo (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// The read/write position from the host file system point of view
|
||||
// is at the end of the file. If the position from this module
|
||||
@@ -1016,12 +1032,14 @@ SetFileInfo (
|
||||
FileSetPosition (&Fcb->File, Fcb->Position);
|
||||
}
|
||||
}
|
||||
|
||||
Fcb->Info.FileSize = FileSize;
|
||||
|
||||
Return = SemihostFileLength (Fcb->SemihostHandle, &Length);
|
||||
if (RETURN_ERROR (Return)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Fcb->Info.PhysicalSize = Length;
|
||||
}
|
||||
|
||||
@@ -1048,6 +1066,7 @@ SetFileInfo (
|
||||
if (RETURN_ERROR (Return)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
FreePool (Fcb->FileName);
|
||||
Fcb->FileName = AsciiFileName;
|
||||
AsciiFileName = NULL;
|
||||
@@ -1119,19 +1138,24 @@ FileSetInfo (
|
||||
if (Info->Size < (SIZE_OF_EFI_FILE_INFO + StrSize (Info->FileName))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (BufferSize < Info->Size) {
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
return SetFileInfo (Fcb, Info);
|
||||
} else if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
|
||||
SystemInfo = Buffer;
|
||||
if (SystemInfo->Size <
|
||||
(SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (SystemInfo->VolumeLabel))) {
|
||||
(SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (SystemInfo->VolumeLabel)))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (BufferSize < SystemInfo->Size) {
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
Buffer = SystemInfo->VolumeLabel;
|
||||
|
||||
if (StrSize (Buffer) > 0) {
|
||||
@@ -1160,13 +1184,14 @@ FileFlush (
|
||||
{
|
||||
SEMIHOST_FCB *Fcb;
|
||||
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS(File);
|
||||
Fcb = SEMIHOST_FCB_FROM_THIS (File);
|
||||
|
||||
if (Fcb->IsRoot) {
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
if ((Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
|
||||
|| !(Fcb->OpenMode & EFI_FILE_MODE_WRITE)) {
|
||||
if ( (Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
|
||||
|| !(Fcb->OpenMode & EFI_FILE_MODE_WRITE))
|
||||
{
|
||||
return EFI_ACCESS_DENIED;
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
@@ -1192,12 +1217,14 @@ SemihostFsEntryPoint (
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&gInstallHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid, &gSemihostFs,
|
||||
&gEfiDevicePathProtocolGuid, &gDevicePath,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
&gSemihostFs,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&gDevicePath,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (mSemihostFsLabel);
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __SEMIHOST_FS_H__
|
||||
#define __SEMIHOST_FS_H__
|
||||
#ifndef SEMIHOST_FS_H_
|
||||
#define SEMIHOST_FS_H_
|
||||
|
||||
EFI_STATUS
|
||||
VolumeOpen (
|
||||
@@ -242,5 +242,4 @@ FileFlush (
|
||||
IN EFI_FILE *File
|
||||
);
|
||||
|
||||
#endif // __SEMIHOST_FS_H__
|
||||
|
||||
#endif // SEMIHOST_FS_H_
|
||||
|
@@ -9,9 +9,8 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __MACRO_IO_LIB_H__
|
||||
#define __MACRO_IO_LIB_H__
|
||||
#ifndef ASM_MACRO_IO_LIB_H_
|
||||
#define ASM_MACRO_IO_LIB_H_
|
||||
|
||||
#define _ASM_FUNC(Name, Section) \
|
||||
.global Name ; \
|
||||
@@ -36,4 +35,4 @@
|
||||
movt Reg, #:upper16:(Sym) - (. + 12) ; \
|
||||
ldr Reg, [pc, Reg]
|
||||
|
||||
#endif
|
||||
#endif // ASM_MACRO_IO_LIB_H_
|
||||
|
@@ -9,9 +9,8 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __MACRO_IO_LIBV8_H__
|
||||
#define __MACRO_IO_LIBV8_H__
|
||||
#ifndef ASM_MACRO_IO_LIBV8_H_
|
||||
#define ASM_MACRO_IO_LIBV8_H_
|
||||
|
||||
// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
|
||||
// This only selects between EL1 and EL2, else we die.
|
||||
@@ -24,7 +23,6 @@
|
||||
cbnz SAFE_XREG, 1f ;\
|
||||
b . ;// We should never get here
|
||||
|
||||
|
||||
// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
|
||||
// This only selects between EL1 and EL2 and EL3, else we die.
|
||||
// Provide the Macro with a safe temp xreg to use.
|
||||
@@ -54,4 +52,4 @@
|
||||
movk Reg, ((Val) >> 16) & 0xffff, lsl #16 ; \
|
||||
movk Reg, (Val) & 0xffff
|
||||
|
||||
#endif // __MACRO_IO_LIBV8_H__
|
||||
#endif // ASM_MACRO_IO_LIBV8_H_
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2017, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __AARCH64_H__
|
||||
#define __AARCH64_H__
|
||||
#ifndef AARCH64_H_
|
||||
#define AARCH64_H_
|
||||
|
||||
#include <Chipset/AArch64Mmu.h>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// MIDR - Main ID Register definitions
|
||||
#define ARM_CPU_TYPE_SHIFT 4
|
||||
#define ARM_CPU_TYPE_MASK 0xFFF
|
||||
#define ARM_CPU_TYPE_AEMv8 0xD0F
|
||||
#define ARM_CPU_TYPE_AEMV8 0xD0F
|
||||
#define ARM_CPU_TYPE_A53 0xD03
|
||||
#define ARM_CPU_TYPE_A57 0xD07
|
||||
#define ARM_CPU_TYPE_A72 0xD08
|
||||
@@ -97,10 +97,10 @@
|
||||
#define ARM_VECTOR_CUR_SP0_FIQ 0x100
|
||||
#define ARM_VECTOR_CUR_SP0_SERR 0x180
|
||||
|
||||
#define ARM_VECTOR_CUR_SPx_SYNC 0x200
|
||||
#define ARM_VECTOR_CUR_SPx_IRQ 0x280
|
||||
#define ARM_VECTOR_CUR_SPx_FIQ 0x300
|
||||
#define ARM_VECTOR_CUR_SPx_SERR 0x380
|
||||
#define ARM_VECTOR_CUR_SPX_SYNC 0x200
|
||||
#define ARM_VECTOR_CUR_SPX_IRQ 0x280
|
||||
#define ARM_VECTOR_CUR_SPX_FIQ 0x300
|
||||
#define ARM_VECTOR_CUR_SPX_SERR 0x380
|
||||
|
||||
#define ARM_VECTOR_LOW_A64_SYNC 0x400
|
||||
#define ARM_VECTOR_LOW_A64_IRQ 0x480
|
||||
@@ -238,4 +238,4 @@ ArmWriteCntHctl (
|
||||
IN UINT32 CntHctl
|
||||
);
|
||||
|
||||
#endif // __AARCH64_H__
|
||||
#endif // AARCH64_H_
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __AARCH64_MMU_H_
|
||||
#define __AARCH64_MMU_H_
|
||||
#ifndef AARCH64_MMU_H_
|
||||
#define AARCH64_MMU_H_
|
||||
|
||||
//
|
||||
// Memory Attribute Indirection register Definitions
|
||||
@@ -17,7 +17,7 @@
|
||||
#define MAIR_ATTR_NORMAL_MEMORY_WRITE_THROUGH 0xBBULL
|
||||
#define MAIR_ATTR_NORMAL_MEMORY_WRITE_BACK 0xFFULL
|
||||
|
||||
#define MAIR_ATTR(n,value) ((value) << (((n) >> 2)*8))
|
||||
#define MAIR_ATTR(n, value) ((value) << (((n) >> 2)*8))
|
||||
|
||||
//
|
||||
// Long-descriptor Translation Table format
|
||||
@@ -152,7 +152,6 @@
|
||||
#define TCR_EL1_TBI0_MASK (0x01UL << TCR_EL1_TBI0_FIELD)
|
||||
#define TCR_EL1_TBI1_MASK (0x01UL << TCR_EL1_TBI1_FIELD)
|
||||
|
||||
|
||||
#define TCR_EL23_T0SZ_FIELD (0)
|
||||
#define TCR_EL23_IRGN0_FIELD (8)
|
||||
#define TCR_EL23_ORGN0_FIELD (10)
|
||||
@@ -166,7 +165,6 @@
|
||||
#define TCR_EL23_TG0_MASK (0x01UL << TCR_EL23_TG0_FIELD)
|
||||
#define TCR_EL23_PS_MASK (0x07UL << TCR_EL23_PS_FIELD)
|
||||
|
||||
|
||||
#define TCR_RGN_OUTER_NON_CACHEABLE (0x0UL << 10)
|
||||
#define TCR_RGN_OUTER_WRITE_BACK_ALLOC (0x1UL << 10)
|
||||
#define TCR_RGN_OUTER_WRITE_THROUGH (0x2UL << 10)
|
||||
@@ -190,9 +188,8 @@
|
||||
|
||||
// The value written to the T*SZ fields are defined as 2^(64-T*SZ). So a 39Bit
|
||||
// Virtual address range for 512GB of virtual space sets T*SZ to 25
|
||||
#define INPUT_ADDRESS_SIZE_TO_TxSZ(a) (64 - a)
|
||||
#define INPUT_ADDRESS_SIZE_TO_TXSZ(a) (64 - a)
|
||||
|
||||
// Uses LPAE Page Table format
|
||||
|
||||
#endif // __AARCH64_MMU_H_
|
||||
|
||||
#endif // AARCH64_MMU_H_
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2012-2014, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2012 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_CORTEX_A5x_H__
|
||||
#define __ARM_CORTEX_A5x_H__
|
||||
#ifndef ARM_CORTEX_A5X_H_
|
||||
#define ARM_CORTEX_A5X_H_
|
||||
|
||||
//
|
||||
// Cortex A5x feature bit definitions
|
||||
@@ -41,4 +41,4 @@ ArmUnsetCpuExCrBit (
|
||||
IN UINT64 Bits
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_CORTEX_A5X_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_CORTEX_A9_H__
|
||||
#define __ARM_CORTEX_A9_H__
|
||||
#ifndef ARM_CORTEX_A9_H_
|
||||
#define ARM_CORTEX_A9_H_
|
||||
|
||||
#include <Chipset/ArmV7.h>
|
||||
|
||||
@@ -48,12 +48,10 @@
|
||||
#define A9_SCU_SACR_OFFSET 0x50
|
||||
#define A9_SCU_SSACR_OFFSET 0x54
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
ArmGetScuBaseAddress (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ARM_CORTEX_A9_H_
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_V7_H__
|
||||
#define __ARM_V7_H__
|
||||
#ifndef ARM_V7_H_
|
||||
#define ARM_V7_H_
|
||||
|
||||
#include <Chipset/ArmV7Mmu.h>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#define CPSR_IRQ (1 << 7)
|
||||
#define CPSR_FIQ (1 << 6)
|
||||
|
||||
|
||||
// CPACR - Coprocessor Access Control Register definitions
|
||||
#define CPACR_CP_DENIED(cp) 0x00
|
||||
#define CPACR_CP_PRIV(cp) ((0x1 << ((cp) << 1)) & 0x0FFFFFFF)
|
||||
@@ -70,7 +69,7 @@
|
||||
// MIDR - Main ID Register definitions
|
||||
#define ARM_CPU_TYPE_SHIFT 4
|
||||
#define ARM_CPU_TYPE_MASK 0xFFF
|
||||
#define ARM_CPU_TYPE_AEMv8 0xD0F
|
||||
#define ARM_CPU_TYPE_AEMV8 0xD0F
|
||||
#define ARM_CPU_TYPE_A53 0xD03
|
||||
#define ARM_CPU_TYPE_A57 0xD07
|
||||
#define ARM_CPU_TYPE_A15 0xC0F
|
||||
@@ -120,4 +119,4 @@ ArmWriteNsacr (
|
||||
IN UINT32 Nsacr
|
||||
);
|
||||
|
||||
#endif // __ARM_V7_H__
|
||||
#endif // ARM_V7_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARMV7_MMU_H_
|
||||
#define __ARMV7_MMU_H_
|
||||
#ifndef ARMV7_MMU_H_
|
||||
#define ARMV7_MMU_H_
|
||||
|
||||
#define TTBR_NOT_OUTER_SHAREABLE BIT5
|
||||
#define TTBR_RGN_OUTER_NON_CACHEABLE 0
|
||||
@@ -33,7 +33,6 @@
|
||||
#define TTBR_MP_NON_CACHEABLE ( TTBR_RGN_OUTER_NON_CACHEABLE | TTBR_RGN_INNER_NON_CACHEABLE )
|
||||
#define TTBR_MP_WRITE_BACK_ALLOC ( TTBR_RGN_OUTER_WRITE_BACK_ALLOC | TTBR_RGN_INNER_WRITE_BACK_ALLOC | TTBR_SHAREABLE)
|
||||
|
||||
|
||||
#define TRANSLATION_TABLE_SECTION_COUNT 4096
|
||||
#define TRANSLATION_TABLE_SECTION_SIZE (sizeof(UINT32) * TRANSLATION_TABLE_SECTION_COUNT)
|
||||
#define TRANSLATION_TABLE_SECTION_ALIGNMENT (sizeof(UINT32) * TRANSLATION_TABLE_SECTION_COUNT)
|
||||
@@ -137,16 +136,16 @@
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_AP(Desc) ((((Desc) & TT_DESCRIPTOR_SECTION_AP_MASK) >> 6) & TT_DESCRIPTOR_PAGE_AP_MASK)
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_NG(Desc) ((((Desc) & TT_DESCRIPTOR_SECTION_NG_MASK) >> 6) & TT_DESCRIPTOR_PAGE_NG_MASK)
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_S(Desc) ((((Desc) & TT_DESCRIPTOR_SECTION_S_MASK) >> 6) & TT_DESCRIPTOR_PAGE_S_MASK)
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_XN(Desc,IsLargePage) ((IsLargePage)? \
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_XN(Desc, IsLargePage) ((IsLargePage)?\
|
||||
((((Desc) & TT_DESCRIPTOR_SECTION_XN_MASK) << 11) & TT_DESCRIPTOR_LARGEPAGE_XN_MASK): \
|
||||
((((Desc) & TT_DESCRIPTOR_SECTION_XN_MASK) >> 4) & TT_DESCRIPTOR_PAGE_XN_MASK))
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_CACHE_POLICY(Desc,IsLargePage) (IsLargePage? \
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_PAGE_CACHE_POLICY(Desc, IsLargePage) (IsLargePage? \
|
||||
(((Desc) & TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK) & TT_DESCRIPTOR_LARGEPAGE_CACHE_POLICY_MASK): \
|
||||
(((((Desc) & (0x3 << 12)) >> 6) | (Desc & (0x3 << 2)))))
|
||||
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_SECTION_AP(Desc) ((((Desc) & TT_DESCRIPTOR_PAGE_AP_MASK) << 6) & TT_DESCRIPTOR_SECTION_AP_MASK)
|
||||
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_SECTION_CACHE_POLICY(Desc,IsLargePage) (IsLargePage? \
|
||||
#define TT_DESCRIPTOR_CONVERT_TO_SECTION_CACHE_POLICY(Desc, IsLargePage) (IsLargePage? \
|
||||
(((Desc) & TT_DESCRIPTOR_LARGEPAGE_CACHE_POLICY_MASK) & TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK): \
|
||||
(((((Desc) & (0x3 << 6)) << 6) | (Desc & (0x3 << 2)))))
|
||||
|
||||
@@ -235,4 +234,4 @@ ConvertSectionAttributesToPageAttributes (
|
||||
IN BOOLEAN IsLargePage
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARMV7_MMU_H_
|
||||
|
@@ -6,16 +6,15 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_MP_CORE_INFO_GUID_H_
|
||||
#define __ARM_MP_CORE_INFO_GUID_H_
|
||||
#ifndef ARM_MP_CORE_INFO_GUID_H_
|
||||
#define ARM_MP_CORE_INFO_GUID_H_
|
||||
|
||||
#define MAX_CPUS_PER_MPCORE_SYSTEM 0x04
|
||||
#define SCU_CONFIG_REG_OFFSET 0x04
|
||||
#define MPIDR_U_BIT_MASK 0x40000000
|
||||
|
||||
typedef struct {
|
||||
UINT32 ClusterId;
|
||||
UINT32 CoreId;
|
||||
UINT64 Mpidr;
|
||||
|
||||
// MP Core Mailbox
|
||||
EFI_PHYSICAL_ADDRESS MailboxSetAddress;
|
||||
@@ -24,7 +23,7 @@ typedef struct {
|
||||
UINT64 MailboxClearValue;
|
||||
} ARM_CORE_INFO;
|
||||
|
||||
typedef struct{
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 Revision;
|
||||
@@ -43,12 +42,11 @@ typedef struct {
|
||||
ARM_CORE_INFO *ArmCpus;
|
||||
} ARM_PROCESSOR_TABLE;
|
||||
|
||||
|
||||
#define ARM_MP_CORE_INFO_GUID \
|
||||
{ 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} }
|
||||
|
||||
#define EFI_ARM_PROCESSOR_TABLE_SIGNATURE SIGNATURE_64 ('C', 'P', 'U', 'T', 'A', 'B', 'L', 'E')
|
||||
#define EFI_ARM_PROCESSOR_TABLE_REVISION 0x00010000 //1.0
|
||||
#define EFI_ARM_PROCESSOR_TABLE_REVISION 0x00010000// 1.0
|
||||
#define EFI_ARM_PROCESSOR_TABLE_OEM_ID SIGNATURE_64('A','R','M',' ', 'L', 't', 'd', ' ')
|
||||
#define EFI_ARM_PROCESSOR_TABLE_OEM_TABLE_ID SIGNATURE_64('V', 'E', 'R', 'S', 'A', 'T', 'I', 'L')
|
||||
#define EFI_ARM_PROCESSOR_TABLE_OEM_REVISION 0x00000001
|
||||
@@ -57,4 +55,4 @@ typedef struct {
|
||||
|
||||
extern EFI_GUID gArmMpCoreInfoGuid;
|
||||
|
||||
#endif /* MPCOREINFO_H_ */
|
||||
#endif /* ARM_MP_CORE_INFO_GUID_H_ */
|
||||
|
111
ArmPkg/Include/IndustryStandard/ArmCache.h
Normal file
111
ArmPkg/Include/IndustryStandard/ArmCache.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2020 - 2021, NUVIA Inc. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef ARM_CACHE_H_
|
||||
#define ARM_CACHE_H_
|
||||
|
||||
#include <Uefi/UefiBaseType.h>
|
||||
|
||||
// The ARM Architecture Reference Manual for ARMv8-A defines up
|
||||
// to 7 levels of cache, L1 through L7.
|
||||
#define MAX_ARM_CACHE_LEVEL 7
|
||||
|
||||
/// Defines the structure of the CSSELR (Cache Size Selection) register
|
||||
typedef union {
|
||||
struct {
|
||||
UINT32 InD : 1; ///< Instruction not Data bit
|
||||
UINT32 Level : 3; ///< Cache level (zero based)
|
||||
UINT32 TnD : 1; ///< Allocation not Data bit
|
||||
UINT32 Reserved : 27; ///< Reserved, RES0
|
||||
} Bits; ///< Bitfield definition of the register
|
||||
UINT32 Data; ///< The entire 32-bit value
|
||||
} CSSELR_DATA;
|
||||
|
||||
/// The cache type values for the InD field of the CSSELR register
|
||||
typedef enum {
|
||||
/// Select the data or unified cache
|
||||
CsselrCacheTypeDataOrUnified = 0,
|
||||
/// Select the instruction cache
|
||||
CsselrCacheTypeInstruction,
|
||||
CsselrCacheTypeMax
|
||||
} CSSELR_CACHE_TYPE;
|
||||
|
||||
/// Defines the structure of the CCSIDR (Current Cache Size ID) register
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 LineSize : 3; ///< Line size (Log2(Num bytes in cache) - 4)
|
||||
UINT64 Associativity : 10; ///< Associativity - 1
|
||||
UINT64 NumSets : 15; ///< Number of sets in the cache -1
|
||||
UINT64 Unknown : 4; ///< Reserved, UNKNOWN
|
||||
UINT64 Reserved : 32; ///< Reserved, RES0
|
||||
} BitsNonCcidx; ///< Bitfield definition of the register when FEAT_CCIDX is not supported.
|
||||
struct {
|
||||
UINT64 LineSize : 3; ///< Line size (Log2(Num bytes in cache) - 4)
|
||||
UINT64 Associativity : 21; ///< Associativity - 1
|
||||
UINT64 Reserved1 : 8; ///< Reserved, RES0
|
||||
UINT64 NumSets : 24; ///< Number of sets in the cache -1
|
||||
UINT64 Reserved2 : 8; ///< Reserved, RES0
|
||||
} BitsCcidxAA64; ///< Bitfield definition of the register when FEAT_IDX is supported.
|
||||
struct {
|
||||
UINT64 LineSize : 3;
|
||||
UINT64 Associativity : 21;
|
||||
UINT64 Reserved : 8;
|
||||
UINT64 Unallocated : 32;
|
||||
} BitsCcidxAA32;
|
||||
UINT64 Data; ///< The entire 64-bit value
|
||||
} CCSIDR_DATA;
|
||||
|
||||
/// Defines the structure of the AARCH32 CCSIDR2 register.
|
||||
typedef union {
|
||||
struct {
|
||||
UINT32 NumSets : 24; ///< Number of sets in the cache - 1
|
||||
UINT32 Reserved : 8; ///< Reserved, RES0
|
||||
} Bits; ///< Bitfield definition of the register
|
||||
UINT32 Data; ///< The entire 32-bit value
|
||||
} CCSIDR2_DATA;
|
||||
|
||||
/** Defines the structure of the CLIDR (Cache Level ID) register.
|
||||
*
|
||||
* The lower 32 bits are the same for both AARCH32 and AARCH64
|
||||
* so we can use the same structure for both.
|
||||
**/
|
||||
typedef union {
|
||||
struct {
|
||||
UINT32 Ctype1 : 3; ///< Level 1 cache type
|
||||
UINT32 Ctype2 : 3; ///< Level 2 cache type
|
||||
UINT32 Ctype3 : 3; ///< Level 3 cache type
|
||||
UINT32 Ctype4 : 3; ///< Level 4 cache type
|
||||
UINT32 Ctype5 : 3; ///< Level 5 cache type
|
||||
UINT32 Ctype6 : 3; ///< Level 6 cache type
|
||||
UINT32 Ctype7 : 3; ///< Level 7 cache type
|
||||
UINT32 LoUIS : 3; ///< Level of Unification Inner Shareable
|
||||
UINT32 LoC : 3; ///< Level of Coherency
|
||||
UINT32 LoUU : 3; ///< Level of Unification Uniprocessor
|
||||
UINT32 Icb : 3; ///< Inner Cache Boundary
|
||||
} Bits; ///< Bitfield definition of the register
|
||||
UINT32 Data; ///< The entire 32-bit value
|
||||
} CLIDR_DATA;
|
||||
|
||||
/// The cache types reported in the CLIDR register.
|
||||
typedef enum {
|
||||
/// No cache is present
|
||||
ClidrCacheTypeNone = 0,
|
||||
/// There is only an instruction cache
|
||||
ClidrCacheTypeInstructionOnly,
|
||||
/// There is only a data cache
|
||||
ClidrCacheTypeDataOnly,
|
||||
/// There are separate data and instruction caches
|
||||
ClidrCacheTypeSeparate,
|
||||
/// There is a unified cache
|
||||
ClidrCacheTypeUnified,
|
||||
ClidrCacheTypeMax
|
||||
} CLIDR_CACHE_TYPE;
|
||||
|
||||
#define CLIDR_GET_CACHE_TYPE(x, level) ((x >> (3 * (level))) & 0b111)
|
||||
|
||||
#endif /* ARM_CACHE_H_ */
|
@@ -17,9 +17,21 @@
|
||||
#define ARM_FFA_SVC_H_
|
||||
|
||||
#define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32 0x8400006F
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32 0x84000070
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070
|
||||
|
||||
/* Generic IDs when using AArch32 or AArch64 execution state */
|
||||
#ifdef MDE_CPU_AARCH64
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64
|
||||
#endif
|
||||
#ifdef MDE_CPU_ARM
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32
|
||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32
|
||||
#endif
|
||||
|
||||
#define SPM_MAJOR_VERSION_FFA 1
|
||||
#define SPM_MINOR_VERSION_FFA 0
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_MM_SVC_H__
|
||||
#define __ARM_MM_SVC_H__
|
||||
#ifndef ARM_MM_SVC_H_
|
||||
#define ARM_MM_SVC_H_
|
||||
|
||||
/*
|
||||
* SVC IDs to allow the MM secure partition to initialise itself, handle
|
||||
@@ -15,10 +15,25 @@
|
||||
* privileged operations on its behalf.
|
||||
*/
|
||||
#define ARM_SVC_ID_SPM_VERSION_AARCH32 0x84000060
|
||||
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32 0x84000061
|
||||
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH32 0x84000064
|
||||
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH32 0x84000065
|
||||
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 0xC4000061
|
||||
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64 0xC4000064
|
||||
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64 0xC4000065
|
||||
|
||||
/* Generic IDs when using AArch32 or AArch64 execution state */
|
||||
#ifdef MDE_CPU_AARCH64
|
||||
#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64
|
||||
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64
|
||||
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64
|
||||
#endif
|
||||
#ifdef MDE_CPU_ARM
|
||||
#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32
|
||||
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH32
|
||||
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH32
|
||||
#endif
|
||||
|
||||
#define SET_MEM_ATTR_DATA_PERM_MASK 0x3
|
||||
#define SET_MEM_ATTR_DATA_PERM_SHIFT 0
|
||||
#define SET_MEM_ATTR_DATA_PERM_NO_ACCESS 0
|
||||
@@ -44,4 +59,4 @@
|
||||
#define SPM_MAJOR_VERSION 0
|
||||
#define SPM_MINOR_VERSION 1
|
||||
|
||||
#endif
|
||||
#endif // ARM_MM_SVC_H_
|
||||
|
@@ -10,8 +10,8 @@
|
||||
* (https://developer.arm.com/documentation/den0028/c/?lang=en)
|
||||
**/
|
||||
|
||||
#ifndef __ARM_STD_SMC_H__
|
||||
#define __ARM_STD_SMC_H__
|
||||
#ifndef ARM_STD_SMC_H_
|
||||
#define ARM_STD_SMC_H_
|
||||
|
||||
/*
|
||||
* SMC function IDs for Standard Service queries
|
||||
@@ -49,6 +49,14 @@
|
||||
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH32 0x84000041
|
||||
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH64 0xC4000041
|
||||
|
||||
/* Generic ID when using AArch32 or AArch64 execution state */
|
||||
#ifdef MDE_CPU_AARCH64
|
||||
#define ARM_SMC_ID_MM_COMMUNICATE ARM_SMC_ID_MM_COMMUNICATE_AARCH64
|
||||
#endif
|
||||
#ifdef MDE_CPU_ARM
|
||||
#define ARM_SMC_ID_MM_COMMUNICATE ARM_SMC_ID_MM_COMMUNICATE_AARCH32
|
||||
#endif
|
||||
|
||||
/* MM return error codes */
|
||||
#define ARM_SMC_MM_RET_SUCCESS 0
|
||||
#define ARM_SMC_MM_RET_NOT_SUPPORTED -1
|
||||
@@ -129,4 +137,4 @@
|
||||
/* 0xbf00ff02 is reserved */
|
||||
#define ARM_SMC_ID_TOS_REVISION 0xbf00ff03
|
||||
|
||||
#endif
|
||||
#endif // ARM_STD_SMC_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_DISASSEBLER_LIB_H__
|
||||
#define __ARM_DISASSEBLER_LIB_H__
|
||||
#ifndef ARM_DISASSEMBLER_LIB_H_
|
||||
#define ARM_DISASSEMBLER_LIB_H_
|
||||
|
||||
/**
|
||||
Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to
|
||||
@@ -34,4 +34,4 @@ DisassembleInstruction (
|
||||
OUT UINTN Size
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_DISASSEMBLER_LIB_H_
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_GENERIC_TIMER_COUNTER_LIB_H__
|
||||
#define __ARM_GENERIC_TIMER_COUNTER_LIB_H__
|
||||
#ifndef ARM_GENERIC_TIMER_COUNTER_LIB_H_
|
||||
#define ARM_GENERIC_TIMER_COUNTER_LIB_H_
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -82,4 +82,4 @@ ArmGenericTimerSetCompareVal (
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_GENERIC_TIMER_COUNTER_LIB_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_GIC_ARCH_LIB_H__
|
||||
#define __ARM_GIC_ARCH_LIB_H__
|
||||
#ifndef ARM_GIC_ARCH_LIB_H_
|
||||
#define ARM_GIC_ARCH_LIB_H_
|
||||
|
||||
//
|
||||
// GIC definitions
|
||||
@@ -17,11 +17,10 @@ typedef enum {
|
||||
ARM_GIC_ARCH_REVISION_3
|
||||
} ARM_GIC_ARCH_REVISION;
|
||||
|
||||
|
||||
ARM_GIC_ARCH_REVISION
|
||||
EFIAPI
|
||||
ArmGicGetSupportedArchRevision (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_GIC_ARCH_LIB_H_
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2018, ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARMGIC_H
|
||||
#define __ARMGIC_H
|
||||
#ifndef ARMGIC_H_
|
||||
#define ARMGIC_H_
|
||||
|
||||
#include <Library/ArmGicArchLib.h>
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#define ARM_GIC_ICDICFR_LEVEL_TRIGGERED 0x0 // Level triggered interrupt
|
||||
#define ARM_GIC_ICDICFR_EDGE_TRIGGERED 0x1 // Edge triggered interrupt
|
||||
|
||||
|
||||
// GIC Redistributor
|
||||
#define ARM_GICR_CTLR_FRAME_SIZE SIZE_64KB
|
||||
#define ARM_GICR_SGI_PPI_FRAME_SIZE SIZE_64KB
|
||||
@@ -130,7 +129,7 @@ VOID
|
||||
EFIAPI
|
||||
ArmGicSetSecureInterrupts (
|
||||
IN UINTN GicDistributorBase,
|
||||
IN UINTN* GicSecureInterruptMask,
|
||||
IN UINTN *GicSecureInterruptMask,
|
||||
IN UINTN GicSecureInterruptMaskSize
|
||||
);
|
||||
|
||||
@@ -333,4 +332,4 @@ ArmGicV3SetPriorityMask (
|
||||
IN UINTN Priority
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARMGIC_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_HVC_LIB__
|
||||
#define __ARM_HVC_LIB__
|
||||
#ifndef ARM_HVC_LIB_H_
|
||||
#define ARM_HVC_LIB_H_
|
||||
|
||||
/**
|
||||
* The size of the HVC arguments are different between AArch64 and AArch32.
|
||||
@@ -37,4 +37,4 @@ ArmCallHvc (
|
||||
IN OUT ARM_HVC_ARGS *Args
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_HVC_LIB_H_
|
||||
|
@@ -2,20 +2,20 @@
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2020, NUVIA Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2020 - 2021, NUVIA Inc. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_LIB__
|
||||
#define __ARM_LIB__
|
||||
#ifndef ARM_LIB_H_
|
||||
#define ARM_LIB_H_
|
||||
|
||||
#include <Uefi/UefiBaseType.h>
|
||||
|
||||
#ifdef MDE_CPU_ARM
|
||||
#include <Chipset/ArmV7.h>
|
||||
#elif defined(MDE_CPU_AARCH64)
|
||||
#elif defined (MDE_CPU_AARCH64)
|
||||
#include <Chipset/AArch64.h>
|
||||
#else
|
||||
#error "Unknown chipset."
|
||||
@@ -59,8 +59,12 @@ typedef struct {
|
||||
ARM_MEMORY_REGION_ATTRIBUTES Attributes;
|
||||
} ARM_MEMORY_REGION_DESCRIPTOR;
|
||||
|
||||
typedef VOID (*CACHE_OPERATION)(VOID);
|
||||
typedef VOID (*LINE_OPERATION)(UINTN);
|
||||
typedef VOID (*CACHE_OPERATION)(
|
||||
VOID
|
||||
);
|
||||
typedef VOID (*LINE_OPERATION)(
|
||||
UINTN
|
||||
);
|
||||
|
||||
//
|
||||
// ARM Processor Mode
|
||||
@@ -107,11 +111,43 @@ typedef enum {
|
||||
#define GET_CORE_ID(MpId) ((MpId) & ARM_CORE_MASK)
|
||||
#define GET_CLUSTER_ID(MpId) (((MpId) & ARM_CLUSTER_MASK) >> 8)
|
||||
#define GET_MPID(ClusterId, CoreId) (((ClusterId) << 8) | (CoreId))
|
||||
#define GET_MPIDR_AFF0(MpId) ((MpId) & ARM_CORE_AFF0)
|
||||
#define GET_MPIDR_AFF1(MpId) (((MpId) & ARM_CORE_AFF1) >> 8)
|
||||
#define GET_MPIDR_AFF2(MpId) (((MpId) & ARM_CORE_AFF2) >> 16)
|
||||
#define GET_MPIDR_AFF3(MpId) (((MpId) & ARM_CORE_AFF3) >> 32)
|
||||
#define PRIMARY_CORE_ID (PcdGet32(PcdArmPrimaryCore) & ARM_CORE_MASK)
|
||||
|
||||
// The ARM Architecture Reference Manual for ARMv8-A defines up
|
||||
// to 7 levels of cache, L1 through L7.
|
||||
#define MAX_ARM_CACHE_LEVEL 7
|
||||
/** Reads the CCSIDR register for the specified cache.
|
||||
|
||||
@param CSSELR The CSSELR cache selection register value.
|
||||
|
||||
@return The contents of the CCSIDR_EL1 register for the specified cache, when in AARCH64 mode.
|
||||
Returns the contents of the CCSIDR register in AARCH32 mode.
|
||||
**/
|
||||
UINTN
|
||||
ReadCCSIDR (
|
||||
IN UINT32 CSSELR
|
||||
);
|
||||
|
||||
/** Reads the CCSIDR2 for the specified cache.
|
||||
|
||||
@param CSSELR The CSSELR cache selection register value
|
||||
|
||||
@return The contents of the CCSIDR2 register for the specified cache.
|
||||
**/
|
||||
UINT32
|
||||
ReadCCSIDR2 (
|
||||
IN UINT32 CSSELR
|
||||
);
|
||||
|
||||
/** Reads the Cache Level ID (CLIDR) register.
|
||||
|
||||
@return The contents of the CLIDR_EL1 register.
|
||||
**/
|
||||
UINT32
|
||||
ReadCLIDR (
|
||||
VOID
|
||||
);
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
@@ -155,7 +191,6 @@ ArmInvalidateDataCache (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmCleanInvalidateDataCache (
|
||||
@@ -195,8 +230,8 @@ ArmInvalidateInstructionCacheEntryToPoUByMVA (
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmCleanDataCacheEntryByMVA (
|
||||
IN UINTN Address
|
||||
);
|
||||
IN UINTN Address
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -545,7 +580,6 @@ ArmWriteHVBar (
|
||||
IN UINTN HypModeVectorBase
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Helper functions for accessing CPU ACTLR
|
||||
//
|
||||
@@ -708,7 +742,6 @@ ArmGetPhysicalAddressBits (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
///
|
||||
/// ID Register Helper functions
|
||||
///
|
||||
@@ -740,6 +773,7 @@ ArmHasCcidx (
|
||||
///
|
||||
/// AArch32-only ID Register Helper functions
|
||||
///
|
||||
|
||||
/**
|
||||
Check whether the CPU supports the Security extensions
|
||||
|
||||
@@ -751,6 +785,7 @@ EFIAPI
|
||||
ArmHasSecurityExtensions (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // MDE_CPU_ARM
|
||||
|
||||
#endif // __ARM_LIB__
|
||||
#endif // ARM_LIB_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ARM_MMU_LIB__
|
||||
#define __ARM_MMU_LIB__
|
||||
#ifndef ARM_MMU_LIB_H_
|
||||
#define ARM_MMU_LIB_H_
|
||||
|
||||
#include <Uefi/UefiBaseType.h>
|
||||
|
||||
@@ -64,4 +64,4 @@ ArmSetMemoryAttributes (
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_MMU_LIB_H_
|
||||
|
@@ -47,7 +47,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
MTL_CHANNEL_TYPE ChannelType;
|
||||
MTL_MAILBOX * CONST MailBox;
|
||||
MTL_MAILBOX *CONST MailBox;
|
||||
MTL_DOORBELL DoorBell;
|
||||
} MTL_CHANNEL;
|
||||
|
||||
@@ -71,7 +71,7 @@ MtlWaitUntilChannelFree (
|
||||
|
||||
@retval UINT32* Pointer to the payload.
|
||||
**/
|
||||
UINT32*
|
||||
UINT32 *
|
||||
MtlGetChannelPayload (
|
||||
IN MTL_CHANNEL *Channel
|
||||
);
|
||||
@@ -128,4 +128,3 @@ MtlReceiveMessage (
|
||||
);
|
||||
|
||||
#endif /* ARM_MTL_LIB_H_ */
|
||||
|
||||
|
@@ -1,13 +1,14 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
|
||||
* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_SMC_LIB__
|
||||
#define __ARM_SMC_LIB__
|
||||
#ifndef ARM_SMC_LIB_H_
|
||||
#define ARM_SMC_LIB_H_
|
||||
|
||||
/**
|
||||
* The size of the SMC arguments are different between AArch64 and AArch32.
|
||||
@@ -37,4 +38,76 @@ ArmCallSmc (
|
||||
IN OUT ARM_SMC_ARGS *Args
|
||||
);
|
||||
|
||||
#endif
|
||||
/** Trigger an SMC call with 3 arguments.
|
||||
|
||||
@param Function The SMC function.
|
||||
@param Arg1 Argument/result.
|
||||
@param Arg2 Argument/result.
|
||||
@param Arg3 Argument/result.
|
||||
|
||||
@return The SMC error code.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ArmCallSmc3 (
|
||||
IN UINTN Function,
|
||||
IN OUT UINTN *Arg1 OPTIONAL,
|
||||
IN OUT UINTN *Arg2 OPTIONAL,
|
||||
IN OUT UINTN *Arg3 OPTIONAL
|
||||
);
|
||||
|
||||
/** Trigger an SMC call with 2 arguments.
|
||||
|
||||
@param Function The SMC function.
|
||||
@param Arg1 Argument/result.
|
||||
@param Arg2 Argument/result.
|
||||
@param Arg3 Result.
|
||||
|
||||
@return The SMC error code.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ArmCallSmc2 (
|
||||
IN UINTN Function,
|
||||
IN OUT UINTN *Arg1 OPTIONAL,
|
||||
IN OUT UINTN *Arg2 OPTIONAL,
|
||||
OUT UINTN *Arg3 OPTIONAL
|
||||
);
|
||||
|
||||
/** Trigger an SMC call with 1 argument.
|
||||
|
||||
@param Function The SMC function.
|
||||
@param Arg1 Argument/result.
|
||||
@param Arg2 Result.
|
||||
@param Arg3 Result.
|
||||
|
||||
@return The SMC error code.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ArmCallSmc1 (
|
||||
IN UINTN Function,
|
||||
IN OUT UINTN *Arg1 OPTIONAL,
|
||||
OUT UINTN *Arg2 OPTIONAL,
|
||||
OUT UINTN *Arg3 OPTIONAL
|
||||
);
|
||||
|
||||
/** Trigger an SMC call with 0 arguments.
|
||||
|
||||
@param Function The SMC function.
|
||||
@param Arg1 Result.
|
||||
@param Arg2 Result.
|
||||
@param Arg3 Result.
|
||||
|
||||
@return The SMC error code.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ArmCallSmc0 (
|
||||
IN UINTN Function,
|
||||
OUT UINTN *Arg1 OPTIONAL,
|
||||
OUT UINTN *Arg2 OPTIONAL,
|
||||
OUT UINTN *Arg3 OPTIONAL
|
||||
);
|
||||
|
||||
#endif // ARM_SMC_LIB_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_SVC_LIB__
|
||||
#define __ARM_SVC_LIB__
|
||||
#ifndef ARM_SVC_LIB_H_
|
||||
#define ARM_SVC_LIB_H_
|
||||
|
||||
/**
|
||||
* The size of the SVC arguments are different between AArch64 and AArch32.
|
||||
@@ -43,4 +43,4 @@ ArmCallSvc (
|
||||
IN OUT ARM_SVC_ARGS *Args
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // ARM_SVC_LIB_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __DEFAULT_EXCEPTION_HANDLER_LIB_H__
|
||||
#define __DEFAULT_EXCEPTION_HANDLER_LIB_H__
|
||||
#ifndef DEFAULT_EXCEPTION_HANDLER_LIB_H_
|
||||
#define DEFAULT_EXCEPTION_HANDLER_LIB_H_
|
||||
|
||||
/**
|
||||
This is the default action to take on an unexpected exception
|
||||
@@ -22,4 +22,4 @@ DefaultExceptionHandler (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // DEFAULT_EXCEPTION_HANDLER_LIB_H_
|
||||
|
@@ -8,15 +8,13 @@
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#ifndef OEM_MISC_LIB_H_
|
||||
#define OEM_MISC_LIB_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <IndustryStandard/SmBios.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
CpuCacheL1 = 1,
|
||||
CpuCacheL2,
|
||||
CpuCacheL3,
|
||||
@@ -27,8 +25,7 @@ typedef enum
|
||||
CpuCacheLevelMax
|
||||
} OEM_MISC_CPU_CACHE_LEVEL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 Voltage; ///< Processor voltage
|
||||
UINT16 CurrentSpeed; ///< Current clock speed in MHz
|
||||
UINT16 MaxSpeed; ///< Maximum clock speed in MHz
|
||||
@@ -38,17 +35,19 @@ typedef struct
|
||||
UINT16 ThreadCount; ///< Number of threads per processor
|
||||
} OEM_MISC_PROCESSOR_DATA;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
ProductNameType01,
|
||||
SerialNumType01,
|
||||
UuidType01,
|
||||
SystemManufacturerType01,
|
||||
VersionType01,
|
||||
SkuNumberType01,
|
||||
FamilyType01,
|
||||
AssertTagType02,
|
||||
SerialNumberType02,
|
||||
BoardManufacturerType02,
|
||||
ProductNameType02,
|
||||
VersionType02,
|
||||
SkuNumberType02,
|
||||
ChassisLocationType02,
|
||||
AssetTagType03,
|
||||
@@ -57,6 +56,8 @@ typedef enum
|
||||
ChassisTypeType03,
|
||||
ManufacturerType03,
|
||||
SkuNumberType03,
|
||||
ProcessorPartNumType04,
|
||||
ProcessorSerialNumType04,
|
||||
SmbiosHiiStringFieldMax
|
||||
} OEM_MISC_SMBIOS_HII_STRING_FIELD;
|
||||
|
||||
@@ -162,4 +163,74 @@ OemUpdateSmbiosInfo (
|
||||
IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field
|
||||
);
|
||||
|
||||
/** Fetches the Type 32 boot information status.
|
||||
|
||||
@return Boot status.
|
||||
**/
|
||||
MISC_BOOT_INFORMATION_STATUS_DATA_TYPE
|
||||
EFIAPI
|
||||
OemGetBootStatus (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** Fetches the chassis status when it was last booted.
|
||||
|
||||
@return Chassis status.
|
||||
**/
|
||||
MISC_CHASSIS_STATE
|
||||
EFIAPI
|
||||
OemGetChassisBootupState (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** Fetches the chassis power supply/supplies status when last booted.
|
||||
|
||||
@return Chassis power supply/supplies status.
|
||||
**/
|
||||
MISC_CHASSIS_STATE
|
||||
EFIAPI
|
||||
OemGetChassisPowerSupplyState (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** Fetches the chassis thermal status when last booted.
|
||||
|
||||
@return Chassis thermal status.
|
||||
**/
|
||||
MISC_CHASSIS_STATE
|
||||
EFIAPI
|
||||
OemGetChassisThermalState (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** Fetches the chassis security status when last booted.
|
||||
|
||||
@return Chassis security status.
|
||||
**/
|
||||
MISC_CHASSIS_SECURITY_STATE
|
||||
EFIAPI
|
||||
OemGetChassisSecurityStatus (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** Fetches the chassis height in RMUs (Rack Mount Units).
|
||||
|
||||
@return The height of the chassis.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
OemGetChassisHeight (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** Fetches the number of power cords.
|
||||
|
||||
@return The number of power cords.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
OemGetChassisNumPowerCords (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // OEM_MISC_LIB_H_
|
||||
|
@@ -2,13 +2,14 @@
|
||||
OP-TEE specific header file.
|
||||
|
||||
Copyright (c) 2018, Linaro Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _OPTEE_H_
|
||||
#define _OPTEE_H_
|
||||
#ifndef OPTEE_LIB_H_
|
||||
#define OPTEE_LIB_H_
|
||||
|
||||
/*
|
||||
* The 'Trusted OS Call UID' is supposed to return the following UUID for
|
||||
@@ -45,12 +46,14 @@ typedef struct {
|
||||
UINT64 C;
|
||||
} OPTEE_MESSAGE_PARAM_VALUE;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Attribute;
|
||||
union {
|
||||
typedef union {
|
||||
OPTEE_MESSAGE_PARAM_MEMORY Memory;
|
||||
OPTEE_MESSAGE_PARAM_VALUE Value;
|
||||
} Union;
|
||||
} OPTEE_MESSAGE_PARAM_UNION;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Attribute;
|
||||
OPTEE_MESSAGE_PARAM_UNION Union;
|
||||
} OPTEE_MESSAGE_PARAM;
|
||||
|
||||
#define OPTEE_MAX_CALL_PARAMS 4
|
||||
@@ -114,4 +117,4 @@ OpteeInvokeFunction (
|
||||
IN OUT OPTEE_INVOKE_FUNCTION_ARG *InvokeFunctionArg
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif // OPTEE_LIB_H_
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __SEMIHOSTING_H__
|
||||
#define __SEMIHOSTING_H__
|
||||
#ifndef SEMIHOSTING_LIB_H_
|
||||
#define SEMIHOSTING_LIB_H_
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -81,7 +81,7 @@ SemihostFileLength (
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
SemihostFileTmpName(
|
||||
SemihostFileTmpName (
|
||||
OUT VOID *Buffer,
|
||||
IN UINT8 Identifier,
|
||||
IN UINTN Length
|
||||
@@ -104,7 +104,7 @@ SemihostFileRemove (
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
SemihostFileRename(
|
||||
SemihostFileRename (
|
||||
IN CHAR8 *FileName,
|
||||
IN CHAR8 *NewFileName
|
||||
);
|
||||
@@ -129,4 +129,4 @@ SemihostSystem (
|
||||
IN CHAR8 *CommandLine
|
||||
);
|
||||
|
||||
#endif // __SEMIHOSTING_H__
|
||||
#endif // SEMIHOSTING_LIB_H_
|
||||
|
@@ -6,8 +6,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __STANDALONEMM_MMU_LIB__
|
||||
#define __STANDALONEMM_MMU_LIB__
|
||||
#ifndef STANDALONE_MM_MMU_LIB_
|
||||
#define STANDALONE_MM_MMU_LIB_
|
||||
|
||||
EFI_STATUS
|
||||
ArmSetMemoryRegionNoExec (
|
||||
@@ -33,4 +33,4 @@ ArmClearMemoryRegionReadOnly (
|
||||
IN UINT64 Length
|
||||
);
|
||||
|
||||
#endif /* __STANDALONEMM_MMU_LIB__ */
|
||||
#endif /* STANDALONE_MM_MMU_LIB_ */
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __ARM_MP_CORE_INFO_PPI_H__
|
||||
#define __ARM_MP_CORE_INFO_PPI_H__
|
||||
#ifndef ARM_MP_CORE_INFO_PPI_H_
|
||||
#define ARM_MP_CORE_INFO_PPI_H_
|
||||
|
||||
#include <Guid/ArmMpCoreInfo.h>
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI * ARM_MP_CORE_INFO_GET) (
|
||||
(EFIAPI *ARM_MP_CORE_INFO_GET)(
|
||||
OUT UINTN *ArmCoreCount,
|
||||
OUT ARM_CORE_INFO **ArmCoreTable
|
||||
);
|
||||
);
|
||||
|
||||
///
|
||||
/// This service abstracts the ability to migrate contents of the platform early memory store.
|
||||
@@ -49,4 +49,4 @@ typedef struct {
|
||||
extern EFI_GUID gArmMpCoreInfoPpiGuid;
|
||||
extern EFI_GUID gArmMpCoreInfoGuid;
|
||||
|
||||
#endif
|
||||
#endif // ARM_MP_CORE_INFO_PPI_H_
|
||||
|
@@ -18,4 +18,3 @@
|
||||
#define SCMI_MAX_STR_LEN 16
|
||||
|
||||
#endif /* ARM_SCMI_H_ */
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
System Control and Management Interface V1.0
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
|
||||
DEN0056A_System_Control_and_Management_Interface.pdf
|
||||
@par Specification Reference:
|
||||
- Arm System Control and Management Interface - Platform Design Document
|
||||
(https://developer.arm.com/documentation/den0056/)
|
||||
**/
|
||||
|
||||
#ifndef ARM_SCMI_BASE_PROTOCOL_H_
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
#include <Protocol/ArmScmi.h>
|
||||
|
||||
#define BASE_PROTOCOL_VERSION 0x10000
|
||||
#define BASE_PROTOCOL_VERSION_V1 0x10000
|
||||
#define BASE_PROTOCOL_VERSION_V2 0x20000
|
||||
|
||||
#define NUM_PROTOCOL_MASK 0xFFU
|
||||
#define NUM_AGENT_MASK 0xFFU
|
||||
@@ -49,7 +50,7 @@ typedef struct _SCMI_BASE_PROTOCOL SCMI_BASE_PROTOCOL;
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_BASE_GET_VERSION) (
|
||||
(EFIAPI *SCMI_BASE_GET_VERSION)(
|
||||
IN SCMI_BASE_PROTOCOL *This,
|
||||
OUT UINT32 *Version
|
||||
);
|
||||
@@ -66,7 +67,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_BASE_GET_TOTAL_PROTOCOLS) (
|
||||
(EFIAPI *SCMI_BASE_GET_TOTAL_PROTOCOLS)(
|
||||
IN SCMI_BASE_PROTOCOL *This,
|
||||
OUT UINT32 *TotalProtocols
|
||||
);
|
||||
@@ -84,7 +85,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_VENDOR) (
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_VENDOR)(
|
||||
IN SCMI_BASE_PROTOCOL *This,
|
||||
OUT UINT8 VendorIdentifier[SCMI_MAX_STR_LEN]
|
||||
);
|
||||
@@ -102,7 +103,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_SUB_VENDOR) (
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_SUB_VENDOR)(
|
||||
IN SCMI_BASE_PROTOCOL *This,
|
||||
OUT UINT8 VendorIdentifier[SCMI_MAX_STR_LEN]
|
||||
);
|
||||
@@ -119,7 +120,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION) (
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION)(
|
||||
IN SCMI_BASE_PROTOCOL *This,
|
||||
OUT UINT32 *ImplementationVersion
|
||||
);
|
||||
@@ -140,7 +141,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_LIST_PROTOCOLS) (
|
||||
(EFIAPI *SCMI_BASE_DISCOVER_LIST_PROTOCOLS)(
|
||||
IN SCMI_BASE_PROTOCOL *This,
|
||||
IN OUT UINT32 *ProtocolListSize,
|
||||
OUT UINT8 *ProtocolList
|
||||
@@ -158,11 +159,10 @@ typedef struct _SCMI_BASE_PROTOCOL {
|
||||
|
||||
// SCMI Message IDs for Base protocol.
|
||||
typedef enum {
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_VENDOR = 0x3,
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_SUB_VENDOR = 0x4,
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_IMPLEMENTATION_VERSION = 0x5,
|
||||
SCMI_MESSAGE_ID_BASE_DISCOVER_LIST_PROTOCOLS = 0x6
|
||||
ScmiMessageIdBaseDiscoverVendor = 0x3,
|
||||
ScmiMessageIdBaseDiscoverSubVendor = 0x4,
|
||||
ScmiMessageIdBaseDiscoverImplementationVersion = 0x5,
|
||||
ScmiMessageIdBaseDiscoverListProtocols = 0x6
|
||||
} SCMI_MESSAGE_ID_BASE;
|
||||
|
||||
#endif /* ARM_SCMI_BASE_PROTOCOL_H_ */
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <Protocol/ArmScmi.h>
|
||||
#include <Protocol/ArmScmiClockProtocol.h>
|
||||
|
||||
#define ARM_SCMI_CLOCK2_PROTOCOL_GUID { \
|
||||
#define ARM_SCMI_CLOCK2_PROTOCOL_GUID {\
|
||||
0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, 0x34, 0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf } \
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef struct _SCMI_CLOCK2_PROTOCOL SCMI_CLOCK2_PROTOCOL;
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_GET_VERSION) (
|
||||
(EFIAPI *SCMI_CLOCK2_GET_VERSION)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
OUT UINT32 *Version
|
||||
);
|
||||
@@ -57,7 +57,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_GET_TOTAL_CLOCKS) (
|
||||
(EFIAPI *SCMI_CLOCK2_GET_TOTAL_CLOCKS)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
OUT UINT32 *TotalClocks
|
||||
);
|
||||
@@ -77,7 +77,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES) (
|
||||
(EFIAPI *SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
OUT BOOLEAN *Enabled,
|
||||
@@ -89,10 +89,10 @@ EFI_STATUS
|
||||
@param[in] This A pointer to SCMI_CLOCK2_PROTOCOL Instance.
|
||||
@param[in] ClockId Identifier for the clock device.
|
||||
|
||||
@param[out] Format SCMI_CLOCK_RATE_FORMAT_DISCRETE: Clock device
|
||||
@param[out] Format ScmiClockRateFormatDiscrete: Clock device
|
||||
supports range of clock rates which are non-linear.
|
||||
|
||||
SCMI_CLOCK_RATE_FORMAT_LINEAR: Clock device supports
|
||||
ScmiClockRateFormatLinear: Clock device supports
|
||||
range of linear clock rates from Min to Max in steps.
|
||||
|
||||
@param[out] TotalRates Total number of rates.
|
||||
@@ -109,7 +109,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_DESCRIBE_RATES) (
|
||||
(EFIAPI *SCMI_CLOCK2_DESCRIBE_RATES)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
OUT SCMI_CLOCK_RATE_FORMAT *Format,
|
||||
@@ -131,7 +131,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_RATE_GET) (
|
||||
(EFIAPI *SCMI_CLOCK2_RATE_GET)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
OUT UINT64 *Rate
|
||||
@@ -149,7 +149,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_RATE_SET) (
|
||||
(EFIAPI *SCMI_CLOCK2_RATE_SET)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
IN UINT64 Rate
|
||||
@@ -168,7 +168,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK2_ENABLE) (
|
||||
(EFIAPI *SCMI_CLOCK2_ENABLE)(
|
||||
IN SCMI_CLOCK2_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
IN BOOLEAN Enable
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <Protocol/ArmScmi.h>
|
||||
|
||||
#define ARM_SCMI_CLOCK_PROTOCOL_GUID { \
|
||||
#define ARM_SCMI_CLOCK_PROTOCOL_GUID {\
|
||||
0x91ce67a8, 0xe0aa, 0x4012, {0xb9, 0x9f, 0xb6, 0xfc, 0xf3, 0x4, 0x8e, 0xaa} \
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ extern EFI_GUID gArmScmiClockProtocolGuid;
|
||||
|
||||
// Message Type for clock management protocol.
|
||||
typedef enum {
|
||||
SCMI_MESSAGE_ID_CLOCK_ATTRIBUTES = 0x3,
|
||||
SCMI_MESSAGE_ID_CLOCK_DESCRIBE_RATES = 0x4,
|
||||
SCMI_MESSAGE_ID_CLOCK_RATE_SET = 0x5,
|
||||
SCMI_MESSAGE_ID_CLOCK_RATE_GET = 0x6,
|
||||
SCMI_MESSAGE_ID_CLOCK_CONFIG_SET = 0x7
|
||||
ScmiMessageIdClockAttributes = 0x3,
|
||||
ScmiMessageIdClockDescribeRates = 0x4,
|
||||
ScmiMessageIdClockRateSet = 0x5,
|
||||
ScmiMessageIdClockRateGet = 0x6,
|
||||
ScmiMessageIdClockConfigSet = 0x7
|
||||
} SCMI_MESSAGE_ID_CLOCK;
|
||||
|
||||
typedef enum {
|
||||
SCMI_CLOCK_RATE_FORMAT_DISCRETE, // Non-linear range.
|
||||
SCMI_CLOCK_RATE_FORMAT_LINEAR // Linear range.
|
||||
ScmiClockRateFormatDiscrete, // Non-linear range.
|
||||
ScmiClockRateFormatLinear // Linear range.
|
||||
} SCMI_CLOCK_RATE_FORMAT;
|
||||
|
||||
// Clock management protocol version.
|
||||
@@ -57,12 +57,18 @@ typedef enum {
|
||||
either Rate or Min/Max/Step triplet is valid.
|
||||
*/
|
||||
typedef struct {
|
||||
union {
|
||||
UINT64 Min;
|
||||
UINT64 Rate;
|
||||
};
|
||||
UINT64 Max;
|
||||
UINT64 Step;
|
||||
} SCMI_CLOCK_RATE_CONTINUOUS;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Rate;
|
||||
} SCMI_CLOCK_RATE_DISCRETE;
|
||||
|
||||
typedef union {
|
||||
SCMI_CLOCK_RATE_CONTINUOUS ContinuousRate;
|
||||
SCMI_CLOCK_RATE_DISCRETE DiscreteRate;
|
||||
} SCMI_CLOCK_RATE;
|
||||
|
||||
#pragma pack()
|
||||
@@ -83,7 +89,7 @@ typedef struct _SCMI_CLOCK_PROTOCOL SCMI_CLOCK_PROTOCOL;
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK_GET_VERSION) (
|
||||
(EFIAPI *SCMI_CLOCK_GET_VERSION)(
|
||||
IN SCMI_CLOCK_PROTOCOL *This,
|
||||
OUT UINT32 *Version
|
||||
);
|
||||
@@ -101,7 +107,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK_GET_TOTAL_CLOCKS) (
|
||||
(EFIAPI *SCMI_CLOCK_GET_TOTAL_CLOCKS)(
|
||||
IN SCMI_CLOCK_PROTOCOL *This,
|
||||
OUT UINT32 *TotalClocks
|
||||
);
|
||||
@@ -121,7 +127,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK_GET_CLOCK_ATTRIBUTES) (
|
||||
(EFIAPI *SCMI_CLOCK_GET_CLOCK_ATTRIBUTES)(
|
||||
IN SCMI_CLOCK_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
OUT BOOLEAN *Enabled,
|
||||
@@ -133,10 +139,10 @@ EFI_STATUS
|
||||
@param[in] This A pointer to SCMI_CLOCK_PROTOCOL Instance.
|
||||
@param[in] ClockId Identifier for the clock device.
|
||||
|
||||
@param[out] Format SCMI_CLOCK_RATE_FORMAT_DISCRETE: Clock device
|
||||
@param[out] Format ScmiClockRateFormatDiscrete: Clock device
|
||||
supports range of clock rates which are non-linear.
|
||||
|
||||
SCMI_CLOCK_RATE_FORMAT_LINEAR: Clock device supports
|
||||
ScmiClockRateFormatLinear: Clock device supports
|
||||
range of linear clock rates from Min to Max in steps.
|
||||
|
||||
@param[out] TotalRates Total number of rates.
|
||||
@@ -153,7 +159,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK_DESCRIBE_RATES) (
|
||||
(EFIAPI *SCMI_CLOCK_DESCRIBE_RATES)(
|
||||
IN SCMI_CLOCK_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
OUT SCMI_CLOCK_RATE_FORMAT *Format,
|
||||
@@ -175,7 +181,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK_RATE_GET) (
|
||||
(EFIAPI *SCMI_CLOCK_RATE_GET)(
|
||||
IN SCMI_CLOCK_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
OUT UINT64 *Rate
|
||||
@@ -193,7 +199,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_CLOCK_RATE_SET) (
|
||||
(EFIAPI *SCMI_CLOCK_RATE_SET)(
|
||||
IN SCMI_CLOCK_PROTOCOL *This,
|
||||
IN UINT32 ClockId,
|
||||
IN UINT64 Rate
|
||||
@@ -209,4 +215,3 @@ typedef struct _SCMI_CLOCK_PROTOCOL {
|
||||
} SCMI_CLOCK_PROTOCOL;
|
||||
|
||||
#endif /* ARM_SCMI_CLOCK_PROTOCOL_H_ */
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017-2018, Arm Limited. All rights reserved.
|
||||
Copyright (c) 2017-2021, Arm Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -92,7 +92,7 @@ typedef struct {
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_GET_VERSION) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_GET_VERSION)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
OUT UINT32 *Version
|
||||
);
|
||||
@@ -109,7 +109,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_GET_ATTRIBUTES) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_GET_ATTRIBUTES)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
OUT SCMI_PERFORMANCE_PROTOCOL_ATTRIBUTES *Attributes
|
||||
|
||||
@@ -128,7 +128,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_GET_DOMAIN_ATTRIBUTES) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_GET_DOMAIN_ATTRIBUTES)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
IN UINT32 DomainId,
|
||||
OUT SCMI_PERFORMANCE_DOMAIN_ATTRIBUTES *DomainAttributes
|
||||
@@ -153,7 +153,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_DESCRIBE_LEVELS) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_DESCRIBE_LEVELS)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
IN UINT32 DomainId,
|
||||
OUT UINT32 *NumLevels,
|
||||
@@ -173,7 +173,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_LIMITS_SET) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_LIMITS_SET)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
IN UINT32 DomainId,
|
||||
IN SCMI_PERFORMANCE_LIMITS *Limits
|
||||
@@ -192,7 +192,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_LIMITS_GET) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_LIMITS_GET)(
|
||||
SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
UINT32 DomainId,
|
||||
SCMI_PERFORMANCE_LIMITS *Limits
|
||||
@@ -210,7 +210,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_LEVEL_SET) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_LEVEL_SET)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
IN UINT32 DomainId,
|
||||
IN UINT32 Level
|
||||
@@ -229,7 +229,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SCMI_PERFORMANCE_LEVEL_GET) (
|
||||
(EFIAPI *SCMI_PERFORMANCE_LEVEL_GET)(
|
||||
IN SCMI_PERFORMANCE_PROTOCOL *This,
|
||||
IN UINT32 DomainId,
|
||||
OUT UINT32 *Level
|
||||
@@ -247,13 +247,12 @@ typedef struct _SCMI_PERFORMANCE_PROTOCOL {
|
||||
} SCMI_PERFORMANCE_PROTOCOL;
|
||||
|
||||
typedef enum {
|
||||
SCMI_MESSAGE_ID_PERFORMANCE_DOMAIN_ATTRIBUTES = 0x3,
|
||||
SCMI_MESSAGE_ID_PERFORMANCE_DESCRIBE_LEVELS = 0x4,
|
||||
SCMI_MESSAGE_ID_PERFORMANCE_LIMITS_SET = 0x5,
|
||||
SCMI_MESSAGE_ID_PERFORMANCE_LIMITS_GET = 0x6,
|
||||
SCMI_MESSAGE_ID_PERFORMANCE_LEVEL_SET = 0x7,
|
||||
SCMI_MESSAGE_ID_PERFORMANCE_LEVEL_GET = 0x8,
|
||||
ScmiMessageIdPerformanceDomainAttributes = 0x3,
|
||||
ScmiMessageIdPerformanceDescribeLevels = 0x4,
|
||||
ScmiMessageIdPerformanceLimitsSet = 0x5,
|
||||
ScmiMessageIdPerformanceLimitsGet = 0x6,
|
||||
ScmiMessageIdPerformanceLevelSet = 0x7,
|
||||
ScmiMessageIdPerformanceLevelGet = 0x8,
|
||||
} SCMI_MESSAGE_ID_PERFORMANCE;
|
||||
|
||||
#endif /* ARM_SCMI_PERFORMANCE_PROTOCOL_H_ */
|
||||
|
||||
|
@@ -1,13 +1,12 @@
|
||||
/** @file
|
||||
Generic ARM implementation of TimerLib.h
|
||||
|
||||
Copyright (c) 2011-2016, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <Base.h>
|
||||
#include <Library/ArmLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
@@ -20,12 +19,11 @@
|
||||
|
||||
// Select appropriate multiply function for platform architecture.
|
||||
#ifdef MDE_CPU_ARM
|
||||
#define MultU64xN MultU64x32
|
||||
#define MULT_U64_X_N MultU64x32
|
||||
#else
|
||||
#define MultU64xN MultU64x64
|
||||
#define MULT_U64_X_N MultU64x64
|
||||
#endif
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
TimerConstructor (
|
||||
@@ -36,7 +34,6 @@ TimerConstructor (
|
||||
// Check if the ARM Generic Timer Extension is implemented.
|
||||
//
|
||||
if (ArmIsArchTimerImplemented ()) {
|
||||
|
||||
//
|
||||
// Check if Architectural Timer frequency is pre-determined by the platform
|
||||
// (ie. nonzero).
|
||||
@@ -49,7 +46,7 @@ TimerConstructor (
|
||||
//
|
||||
ASSERT (TICKS_PER_MICRO_SEC);
|
||||
|
||||
#ifdef MDE_CPU_ARM
|
||||
#ifdef MDE_CPU_ARM
|
||||
//
|
||||
// Only set the frequency for ARMv7. We expect the secure firmware to
|
||||
// have already done it.
|
||||
@@ -59,7 +56,8 @@ TimerConstructor (
|
||||
if (ArmHasSecurityExtensions ()) {
|
||||
ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -68,9 +66,8 @@ TimerConstructor (
|
||||
// If the reset value (0) is returned, just ASSERT.
|
||||
//
|
||||
ASSERT (ArmGenericTimerGetTimerFreq () != 0);
|
||||
|
||||
} else {
|
||||
DEBUG ((EFI_D_ERROR, "ARM Architectural Timer is not available in the CPU, hence this library cannot be used.\n"));
|
||||
DEBUG ((DEBUG_ERROR, "ARM Architectural Timer is not available in the CPU, hence this library cannot be used.\n"));
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
@@ -96,10 +93,10 @@ GetPlatformTimerFreq (
|
||||
if (TimerFreq == 0) {
|
||||
TimerFreq = ArmGenericTimerGetTimerFreq ();
|
||||
}
|
||||
|
||||
return TimerFreq;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stalls the CPU for the number of microseconds specified by MicroSeconds.
|
||||
|
||||
@@ -121,7 +118,7 @@ MicroSecondDelay (
|
||||
// = MicroSeconds x TICKS_PER_MICRO_SEC
|
||||
// = MicroSeconds x Frequency.10^-6
|
||||
TimerTicks64 = DivU64x32 (
|
||||
MultU64xN (
|
||||
MULT_U64_X_N (
|
||||
MicroSeconds,
|
||||
GetPlatformTimerFreq ()
|
||||
),
|
||||
@@ -141,7 +138,6 @@ MicroSecondDelay (
|
||||
return MicroSeconds;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of nanoseconds.
|
||||
|
||||
@@ -219,13 +215,13 @@ GetPerformanceCounter (
|
||||
UINT64
|
||||
EFIAPI
|
||||
GetPerformanceCounterProperties (
|
||||
OUT UINT64 *StartValue, OPTIONAL
|
||||
OUT UINT64 *StartValue OPTIONAL,
|
||||
OUT UINT64 *EndValue OPTIONAL
|
||||
)
|
||||
{
|
||||
if (StartValue != NULL) {
|
||||
// Timer starts at 0
|
||||
*StartValue = (UINT64)0ULL ;
|
||||
*StartValue = (UINT64)0ULL;
|
||||
}
|
||||
|
||||
if (EndValue != NULL) {
|
||||
@@ -263,11 +259,12 @@ GetTimeInNanoSecond (
|
||||
// Time = --------- x 1,000,000,000
|
||||
// Frequency
|
||||
//
|
||||
NanoSeconds = MultU64xN (
|
||||
NanoSeconds = MULT_U64_X_N (
|
||||
DivU64x32Remainder (
|
||||
Ticks,
|
||||
TimerFreq,
|
||||
&Remainder),
|
||||
&Remainder
|
||||
),
|
||||
1000000000U
|
||||
);
|
||||
|
||||
@@ -276,9 +273,10 @@ GetTimeInNanoSecond (
|
||||
// will not overflow 64-bit.
|
||||
//
|
||||
NanoSeconds += DivU64x32 (
|
||||
MultU64xN (
|
||||
(UINT64) Remainder,
|
||||
1000000000U),
|
||||
MULT_U64_X_N (
|
||||
(UINT64)Remainder,
|
||||
1000000000U
|
||||
),
|
||||
TimerFreq
|
||||
);
|
||||
|
||||
|
@@ -31,9 +31,10 @@ CacheRangeOperation (
|
||||
|
||||
// Perform the line operation on an address in each cache line
|
||||
while (AlignedAddress < EndAddress) {
|
||||
LineOperation(AlignedAddress);
|
||||
LineOperation (AlignedAddress);
|
||||
AlignedAddress += LineLength;
|
||||
}
|
||||
|
||||
ArmDataSynchronizationBarrier ();
|
||||
}
|
||||
|
||||
@@ -62,11 +63,18 @@ InvalidateInstructionCacheRange (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
CacheRangeOperation (Address, Length, ArmCleanDataCacheEntryToPoUByMVA,
|
||||
ArmDataCacheLineLength ());
|
||||
CacheRangeOperation (Address, Length,
|
||||
CacheRangeOperation (
|
||||
Address,
|
||||
Length,
|
||||
ArmCleanDataCacheEntryToPoUByMVA,
|
||||
ArmDataCacheLineLength ()
|
||||
);
|
||||
CacheRangeOperation (
|
||||
Address,
|
||||
Length,
|
||||
ArmInvalidateInstructionCacheEntryToPoUByMVA,
|
||||
ArmInstructionCacheLineLength ());
|
||||
ArmInstructionCacheLineLength ()
|
||||
);
|
||||
|
||||
ArmInstructionSynchronizationBarrier ();
|
||||
|
||||
@@ -89,8 +97,12 @@ WriteBackInvalidateDataCacheRange (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
CacheRangeOperation(Address, Length, ArmCleanInvalidateDataCacheEntryByMVA,
|
||||
ArmDataCacheLineLength ());
|
||||
CacheRangeOperation (
|
||||
Address,
|
||||
Length,
|
||||
ArmCleanInvalidateDataCacheEntryByMVA,
|
||||
ArmDataCacheLineLength ()
|
||||
);
|
||||
return Address;
|
||||
}
|
||||
|
||||
@@ -110,8 +122,12 @@ WriteBackDataCacheRange (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
CacheRangeOperation(Address, Length, ArmCleanDataCacheEntryByMVA,
|
||||
ArmDataCacheLineLength ());
|
||||
CacheRangeOperation (
|
||||
Address,
|
||||
Length,
|
||||
ArmCleanDataCacheEntryByMVA,
|
||||
ArmDataCacheLineLength ()
|
||||
);
|
||||
return Address;
|
||||
}
|
||||
|
||||
@@ -122,7 +138,11 @@ InvalidateDataCacheRange (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
CacheRangeOperation(Address, Length, ArmInvalidateDataCacheEntryByMVA,
|
||||
ArmDataCacheLineLength ());
|
||||
CacheRangeOperation (
|
||||
Address,
|
||||
Length,
|
||||
ArmInvalidateDataCacheEntryByMVA,
|
||||
ArmDataCacheLineLength ()
|
||||
);
|
||||
return Address;
|
||||
}
|
||||
|
@@ -69,9 +69,8 @@ CHAR8 *gLdmStack[] = {
|
||||
|
||||
#define LDM_EXT(_reg, _off) ((_reg == 13) ? gLdmStack[(_off)] : gLdmAdr[(_off)])
|
||||
|
||||
|
||||
#define SIGN(_U) ((_U) ? "" : "-")
|
||||
#define WRITE(_W) ((_W) ? "!" : "")
|
||||
#define WRITE(_Write) ((_Write) ? "!" : "")
|
||||
#define BYTE(_B) ((_B) ? "B":"")
|
||||
#define USER(_B) ((_B) ? "^" : "")
|
||||
|
||||
@@ -110,9 +109,11 @@ MRegList (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (First) {
|
||||
AsciiStrCatS (mMregListStr, sizeof mMregListStr, "ERROR");
|
||||
}
|
||||
|
||||
AsciiStrCatS (mMregListStr, sizeof mMregListStr, "}");
|
||||
|
||||
// BugBug: Make caller pass in buffer it is cleaner
|
||||
@@ -136,7 +137,6 @@ RotateRight (
|
||||
return (Op >> Shift) | (Op << (32 - Shift));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to
|
||||
point to next instruction.
|
||||
@@ -159,28 +159,28 @@ DisassembleArmInstruction (
|
||||
)
|
||||
{
|
||||
UINT32 OpCode;
|
||||
CHAR8 *Type, *Root;
|
||||
BOOLEAN I, P, U, B, W, L, S, H;
|
||||
CHAR8 *Type;
|
||||
CHAR8 *Root;
|
||||
BOOLEAN Imm, Pre, Up, WriteBack, Write, Load, Sign, Half;
|
||||
UINT32 Rn, Rd, Rm;
|
||||
UINT32 imode, offset_8, offset_12;
|
||||
UINT32 IMod, Offset8, Offset12;
|
||||
UINT32 Index;
|
||||
UINT32 shift_imm, shift;
|
||||
UINT32 ShiftImm, Shift;
|
||||
|
||||
OpCode = **OpCodePtr;
|
||||
|
||||
I = (OpCode & BIT25) == BIT25;
|
||||
P = (OpCode & BIT24) == BIT24;
|
||||
U = (OpCode & BIT23) == BIT23;
|
||||
B = (OpCode & BIT22) == BIT22; // Also called S
|
||||
W = (OpCode & BIT21) == BIT21;
|
||||
L = (OpCode & BIT20) == BIT20;
|
||||
S = (OpCode & BIT6) == BIT6;
|
||||
H = (OpCode & BIT5) == BIT5;
|
||||
Imm = (OpCode & BIT25) == BIT25; // I
|
||||
Pre = (OpCode & BIT24) == BIT24; // P
|
||||
Up = (OpCode & BIT23) == BIT23; // U
|
||||
WriteBack = (OpCode & BIT22) == BIT22; // B, also called S
|
||||
Write = (OpCode & BIT21) == BIT21; // W
|
||||
Load = (OpCode & BIT20) == BIT20; // L
|
||||
Sign = (OpCode & BIT6) == BIT6; // S
|
||||
Half = (OpCode & BIT5) == BIT5; // H
|
||||
Rn = (OpCode >> 16) & 0xf;
|
||||
Rd = (OpCode >> 12) & 0xf;
|
||||
Rm = (OpCode & 0xf);
|
||||
|
||||
|
||||
if (Extended) {
|
||||
Index = AsciiSPrint (Buf, Size, "0x%08x ", OpCode);
|
||||
Buf += Index;
|
||||
@@ -189,121 +189,126 @@ DisassembleArmInstruction (
|
||||
|
||||
// LDREX, STREX
|
||||
if ((OpCode & 0x0fe000f0) == 0x01800090) {
|
||||
if (L) {
|
||||
if (Load) {
|
||||
// A4.1.27 LDREX{<cond>} <Rd>, [<Rn>]
|
||||
AsciiSPrint (Buf, Size, "LDREX%a %a, [%a]", COND (OpCode), gReg[Rd], gReg[Rn]);
|
||||
} else {
|
||||
// A4.1.103 STREX{<cond>} <Rd>, <Rm>, [<Rn>]
|
||||
AsciiSPrint (Buf, Size, "STREX%a %a, %a, [%a]", COND (OpCode), gReg[Rd], gReg[Rn], gReg[Rn]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// LDM/STM
|
||||
if ((OpCode & 0x0e000000) == 0x08000000) {
|
||||
if (L) {
|
||||
if (Load) {
|
||||
// A4.1.20 LDM{<cond>}<addressing_mode> <Rn>{!}, <registers>
|
||||
// A4.1.21 LDM{<cond>}<addressing_mode> <Rn>, <registers_without_pc>^
|
||||
// A4.1.22 LDM{<cond>}<addressing_mode> <Rn>{!}, <registers_and_pc>^
|
||||
AsciiSPrint (Buf, Size, "LDM%a%a, %a%a, %a", COND (OpCode), LDM_EXT (Rn ,(OpCode >> 23) & 3), gReg[Rn], WRITE (W), MRegList (OpCode), USER (B));
|
||||
AsciiSPrint (Buf, Size, "LDM%a%a, %a%a, %a", COND (OpCode), LDM_EXT (Rn, (OpCode >> 23) & 3), gReg[Rn], WRITE (Write), MRegList (OpCode), USER (WriteBack));
|
||||
} else {
|
||||
// A4.1.97 STM{<cond>}<addressing_mode> <Rn>{!}, <registers>
|
||||
// A4.1.98 STM{<cond>}<addressing_mode> <Rn>, <registers>^
|
||||
AsciiSPrint (Buf, Size, "STM%a%a, %a%a, %a", COND (OpCode), LDM_EXT (Rn ,(OpCode >> 23) & 3), gReg[Rn], WRITE (W), MRegList (OpCode), USER (B));
|
||||
AsciiSPrint (Buf, Size, "STM%a%a, %a%a, %a", COND (OpCode), LDM_EXT (Rn, (OpCode >> 23) & 3), gReg[Rn], WRITE (Write), MRegList (OpCode), USER (WriteBack));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// LDR/STR Address Mode 2
|
||||
if ( ((OpCode & 0x0c000000) == 0x04000000) || ((OpCode & 0xfd70f000 ) == 0xf550f000) ) {
|
||||
offset_12 = OpCode & 0xfff;
|
||||
if ((OpCode & 0xfd70f000 ) == 0xf550f000) {
|
||||
if (((OpCode & 0x0c000000) == 0x04000000) || ((OpCode & 0xfd70f000) == 0xf550f000)) {
|
||||
Offset12 = OpCode & 0xfff;
|
||||
if ((OpCode & 0xfd70f000) == 0xf550f000) {
|
||||
Index = AsciiSPrint (Buf, Size, "PLD");
|
||||
} else {
|
||||
Index = AsciiSPrint (Buf, Size, "%a%a%a%a %a, ", L ? "LDR" : "STR", COND (OpCode), BYTE (B), (!(P) && W) ? "T":"", gReg[Rd]);
|
||||
Index = AsciiSPrint (Buf, Size, "%a%a%a%a %a, ", Load ? "LDR" : "STR", COND (OpCode), BYTE (WriteBack), (!(Pre) && Write) ? "T" : "", gReg[Rd]);
|
||||
}
|
||||
if (P) {
|
||||
if (!I) {
|
||||
|
||||
if (Pre) {
|
||||
if (!Imm) {
|
||||
// A5.2.2 [<Rn>, #+/-<offset_12>]
|
||||
// A5.2.5 [<Rn>, #+/-<offset_12>]
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a0x%x]%a", gReg[Rn], SIGN (U), offset_12, WRITE (W));
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a0x%x]%a", gReg[Rn], SIGN (Up), Offset12, WRITE (Write));
|
||||
} else if ((OpCode & 0x03000ff0) == 0x03000000) {
|
||||
// A5.2.3 [<Rn>, +/-<Rm>]
|
||||
// A5.2.6 [<Rn>, +/-<Rm>]!
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a]%a", gReg[Rn], SIGN (U), WRITE (W));
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a]%a", gReg[Rn], SIGN (Up), WRITE (Write));
|
||||
} else {
|
||||
// A5.2.4 [<Rn>, +/-<Rm>, LSL #<shift_imm>]
|
||||
// A5.2.7 [<Rn>, +/-<Rm>, LSL #<shift_imm>]!
|
||||
shift_imm = (OpCode >> 7) & 0x1f;
|
||||
shift = (OpCode >> 5) & 0x3;
|
||||
if (shift == 0x0) {
|
||||
ShiftImm = (OpCode >> 7) & 0x1f;
|
||||
Shift = (OpCode >> 5) & 0x3;
|
||||
if (Shift == 0x0) {
|
||||
Type = "LSL";
|
||||
} else if (shift == 0x1) {
|
||||
} else if (Shift == 0x1) {
|
||||
Type = "LSR";
|
||||
if (shift_imm == 0) {
|
||||
shift_imm = 32;
|
||||
if (ShiftImm == 0) {
|
||||
ShiftImm = 32;
|
||||
}
|
||||
} else if (shift == 0x2) {
|
||||
} else if (Shift == 0x2) {
|
||||
Type = "ASR";
|
||||
} else if (shift_imm == 0) {
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a, %a, RRX]%a", gReg[Rn], SIGN (U), gReg[Rm], WRITE (W));
|
||||
} else if (ShiftImm == 0) {
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a, %a, RRX]%a", gReg[Rn], SIGN (Up), gReg[Rm], WRITE (Write));
|
||||
return;
|
||||
} else {
|
||||
Type = "ROR";
|
||||
}
|
||||
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a, %a, #%d]%a", gReg[Rn], SIGN (U), gReg[Rm], Type, shift_imm, WRITE (W));
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a, %a, #%d]%a", gReg[Rn], SIGN (Up), gReg[Rm], Type, ShiftImm, WRITE (Write));
|
||||
}
|
||||
} else { // !P
|
||||
if (!I) {
|
||||
} else {
|
||||
// !Pre
|
||||
if (!Imm) {
|
||||
// A5.2.8 [<Rn>], #+/-<offset_12>
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a0x%x", gReg[Rn], SIGN (U), offset_12);
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a0x%x", gReg[Rn], SIGN (Up), Offset12);
|
||||
} else if ((OpCode & 0x03000ff0) == 0x03000000) {
|
||||
// A5.2.9 [<Rn>], +/-<Rm>
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a", gReg[Rn], SIGN (U), gReg[Rm]);
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a", gReg[Rn], SIGN (Up), gReg[Rm]);
|
||||
} else {
|
||||
// A5.2.10 [<Rn>], +/-<Rm>, LSL #<shift_imm>
|
||||
shift_imm = (OpCode >> 7) & 0x1f;
|
||||
shift = (OpCode >> 5) & 0x3;
|
||||
ShiftImm = (OpCode >> 7) & 0x1f;
|
||||
Shift = (OpCode >> 5) & 0x3;
|
||||
|
||||
if (shift == 0x0) {
|
||||
if (Shift == 0x0) {
|
||||
Type = "LSL";
|
||||
} else if (shift == 0x1) {
|
||||
} else if (Shift == 0x1) {
|
||||
Type = "LSR";
|
||||
if (shift_imm == 0) {
|
||||
shift_imm = 32;
|
||||
if (ShiftImm == 0) {
|
||||
ShiftImm = 32;
|
||||
}
|
||||
} else if (shift == 0x2) {
|
||||
} else if (Shift == 0x2) {
|
||||
Type = "ASR";
|
||||
} else if (shift_imm == 0) {
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a, %a, RRX", gReg[Rn], SIGN (U), gReg[Rm]);
|
||||
} else if (ShiftImm == 0) {
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a, %a, RRX", gReg[Rn], SIGN (Up), gReg[Rm]);
|
||||
// FIx me
|
||||
return;
|
||||
} else {
|
||||
Type = "ROR";
|
||||
}
|
||||
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a, %a, #%d", gReg[Rn], SIGN (U), gReg[Rm], Type, shift_imm);
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a, %a, #%d", gReg[Rn], SIGN (Up), gReg[Rm], Type, ShiftImm);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((OpCode & 0x0e000000) == 0x00000000) {
|
||||
// LDR/STR address mode 3
|
||||
// LDR|STR{<cond>}H|SH|SB|D <Rd>, <addressing_mode>
|
||||
if (L) {
|
||||
if (!S) {
|
||||
if (Load) {
|
||||
if (!Sign) {
|
||||
Root = "LDR%aH %a, ";
|
||||
} else if (!H) {
|
||||
} else if (!Half) {
|
||||
Root = "LDR%aSB %a, ";
|
||||
} else {
|
||||
Root = "LDR%aSH %a, ";
|
||||
}
|
||||
} else {
|
||||
if (!S) {
|
||||
if (!Sign) {
|
||||
Root = "STR%aH %a ";
|
||||
} else if (!H) {
|
||||
} else if (!Half) {
|
||||
Root = "LDR%aD %a ";
|
||||
} else {
|
||||
Root = "STR%aD %a ";
|
||||
@@ -312,49 +317,50 @@ DisassembleArmInstruction (
|
||||
|
||||
Index = AsciiSPrint (Buf, Size, Root, COND (OpCode), gReg[Rd]);
|
||||
|
||||
S = (OpCode & BIT6) == BIT6;
|
||||
H = (OpCode & BIT5) == BIT5;
|
||||
offset_8 = ((OpCode >> 4) | (OpCode * 0xf)) & 0xff;
|
||||
if (P & !W) {
|
||||
Sign = (OpCode & BIT6) == BIT6;
|
||||
Half = (OpCode & BIT5) == BIT5;
|
||||
Offset8 = ((OpCode >> 4) | (OpCode * 0xf)) & 0xff;
|
||||
if (Pre & !Write) {
|
||||
// Immediate offset/index
|
||||
if (B) {
|
||||
if (WriteBack) {
|
||||
// A5.3.2 [<Rn>, #+/-<offset_8>]
|
||||
// A5.3.4 [<Rn>, #+/-<offset_8>]!
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%d]%a", gReg[Rn], SIGN (U), offset_8, WRITE (W));
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%d]%a", gReg[Rn], SIGN (Up), Offset8, WRITE (Write));
|
||||
} else {
|
||||
// A5.3.3 [<Rn>, +/-<Rm>]
|
||||
// A5.3.5 [<Rn>, +/-<Rm>]!
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%]a", gReg[Rn], SIGN (U), gReg[Rm], WRITE (W));
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%]a", gReg[Rn], SIGN (Up), gReg[Rm], WRITE (Write));
|
||||
}
|
||||
} else {
|
||||
// Register offset/index
|
||||
if (B) {
|
||||
if (WriteBack) {
|
||||
// A5.3.6 [<Rn>], #+/-<offset_8>
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%d", gReg[Rn], SIGN (U), offset_8);
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%d", gReg[Rn], SIGN (Up), Offset8);
|
||||
} else {
|
||||
// A5.3.7 [<Rn>], +/-<Rm>
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a", gReg[Rn], SIGN (U), gReg[Rm]);
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a", gReg[Rn], SIGN (Up), gReg[Rm]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((OpCode & 0x0fb000f0) == 0x01000050) {
|
||||
// A4.1.108 SWP SWP{<cond>}B <Rd>, <Rm>, [<Rn>]
|
||||
// A4.1.109 SWPB SWP{<cond>}B <Rd>, <Rm>, [<Rn>]
|
||||
AsciiSPrint (Buf, Size, "SWP%a%a %a, %a, [%a]", COND (OpCode), BYTE (B), gReg[Rd], gReg[Rm], gReg[Rn]);
|
||||
AsciiSPrint (Buf, Size, "SWP%a%a %a, %a, [%a]", COND (OpCode), BYTE (WriteBack), gReg[Rd], gReg[Rm], gReg[Rn]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((OpCode & 0xfe5f0f00) == 0xf84d0500) {
|
||||
// A4.1.90 SRS SRS<addressing_mode> #<mode>{!}
|
||||
AsciiSPrint (Buf, Size, "SRS%a #0x%x%a", gLdmStack[(OpCode >> 23) & 3], OpCode & 0x1f, WRITE (W));
|
||||
AsciiSPrint (Buf, Size, "SRS%a #0x%x%a", gLdmStack[(OpCode >> 23) & 3], OpCode & 0x1f, WRITE (Write));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((OpCode & 0xfe500f00) == 0xf8100500) {
|
||||
// A4.1.59 RFE<addressing_mode> <Rn>{!}
|
||||
AsciiSPrint (Buf, Size, "RFE%a %a", gLdmStack[(OpCode >> 23) & 3], gReg[Rn], WRITE (W));
|
||||
AsciiSPrint (Buf, Size, "RFE%a %a", gLdmStack[(OpCode >> 23) & 3], gReg[Rn], WRITE (Write));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -369,16 +375,21 @@ DisassembleArmInstruction (
|
||||
if (((OpCode >> 6) & 0x7) == 0) {
|
||||
AsciiSPrint (Buf, Size, "CPS #0x%x", (OpCode & 0x2f));
|
||||
} else {
|
||||
imode = (OpCode >> 18) & 0x3;
|
||||
Index = AsciiSPrint (Buf, Size, "CPS%a %a%a%a",
|
||||
(imode == 3) ? "ID":"IE",
|
||||
((OpCode & BIT8) != 0) ? "A":"",
|
||||
((OpCode & BIT7) != 0) ? "I":"",
|
||||
((OpCode & BIT6) != 0) ? "F":"");
|
||||
IMod = (OpCode >> 18) & 0x3;
|
||||
Index = AsciiSPrint (
|
||||
Buf,
|
||||
Size,
|
||||
"CPS%a %a%a%a",
|
||||
(IMod == 3) ? "ID" : "IE",
|
||||
((OpCode & BIT8) != 0) ? "A" : "",
|
||||
((OpCode & BIT7) != 0) ? "I" : "",
|
||||
((OpCode & BIT6) != 0) ? "F" : ""
|
||||
);
|
||||
if ((OpCode & BIT17) != 0) {
|
||||
AsciiSPrint (&Buf[Index], Size - Index, ", #0x%x", OpCode & 0x1f);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -390,20 +401,20 @@ DisassembleArmInstruction (
|
||||
|
||||
if ((OpCode & 0x0fb00000) == 0x01000000) {
|
||||
// A4.1.38 MRS{<cond>} <Rd>, CPSR MRS{<cond>} <Rd>, SPSR
|
||||
AsciiSPrint (Buf, Size, "MRS%a %a, %a", COND (OpCode), gReg[Rd], B ? "SPSR" : "CPSR");
|
||||
AsciiSPrint (Buf, Size, "MRS%a %a, %a", COND (OpCode), gReg[Rd], WriteBack ? "SPSR" : "CPSR");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((OpCode & 0x0db00000) == 0x01200000) {
|
||||
// A4.1.38 MSR{<cond>} CPSR_<fields>, #<immediate> MSR{<cond>} CPSR_<fields>, <Rm>
|
||||
if (I) {
|
||||
if (Imm) {
|
||||
// MSR{<cond>} CPSR_<fields>, #<immediate>
|
||||
AsciiSPrint (Buf, Size, "MRS%a %a_%a, #0x%x", COND (OpCode), B ? "SPSR" : "CPSR", FieldMask ((OpCode >> 16) & 0xf), RotateRight (OpCode & 0xf, ((OpCode >> 8) & 0xf) *2));
|
||||
AsciiSPrint (Buf, Size, "MRS%a %a_%a, #0x%x", COND (OpCode), WriteBack ? "SPSR" : "CPSR", FieldMask ((OpCode >> 16) & 0xf), RotateRight (OpCode & 0xf, ((OpCode >> 8) & 0xf) *2));
|
||||
} else {
|
||||
// MSR{<cond>} CPSR_<fields>, <Rm>
|
||||
AsciiSPrint (Buf, Size, "MRS%a %a_%a, %a", COND (OpCode), B ? "SPSR" : "CPSR", gReg[Rd]);
|
||||
AsciiSPrint (Buf, Size, "MRS%a %a_%a, %a", COND (OpCode), WriteBack ? "SPSR" : "CPSR", gReg[Rd]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,35 +427,34 @@ DisassembleArmInstruction (
|
||||
if ((OpCode & 0x0e000000) == 0x0c000000) {
|
||||
// A4.1.19 LDC and A4.1.96 SDC
|
||||
if ((OpCode & 0xf0000000) == 0xf0000000) {
|
||||
Index = AsciiSPrint (Buf, Size, "%a2 0x%x, CR%d, ", L ? "LDC":"SDC", (OpCode >> 8) & 0xf, Rd);
|
||||
Index = AsciiSPrint (Buf, Size, "%a2 0x%x, CR%d, ", Load ? "LDC" : "SDC", (OpCode >> 8) & 0xf, Rd);
|
||||
} else {
|
||||
Index = AsciiSPrint (Buf, Size, "%a%a 0x%x, CR%d, ", L ? "LDC":"SDC", COND (OpCode), (OpCode >> 8) & 0xf, Rd);
|
||||
Index = AsciiSPrint (Buf, Size, "%a%a 0x%x, CR%d, ", Load ? "LDC" : "SDC", COND (OpCode), (OpCode >> 8) & 0xf, Rd);
|
||||
}
|
||||
|
||||
if (!P) {
|
||||
if (!W) {
|
||||
if (!Pre) {
|
||||
if (!Write) {
|
||||
// A5.5.5.5 [<Rn>], <option>
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], {0x%x}", gReg[Rn], OpCode & 0xff);
|
||||
} else {
|
||||
// A.5.5.4 [<Rn>], #+/-<offset_8>*4
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a0x%x*4", gReg[Rn], SIGN (U), OpCode & 0xff);
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a0x%x*4", gReg[Rn], SIGN (Up), OpCode & 0xff);
|
||||
}
|
||||
} else {
|
||||
// A5.5.5.2 [<Rn>, #+/-<offset_8>*4 ]!
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a0x%x*4]%a", gReg[Rn], SIGN (U), OpCode & 0xff, WRITE (W));
|
||||
AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a0x%x*4]%a", gReg[Rn], SIGN (Up), OpCode & 0xff, WRITE (Write));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((OpCode & 0x0f000010) == 0x0e000010) {
|
||||
// A4.1.32 MRC2, MCR2
|
||||
AsciiSPrint (Buf, Size, "%a%a 0x%x, 0x%x, %a, CR%d, CR%d, 0x%x", L ? "MRC":"MCR", COND (OpCode), (OpCode >> 8) & 0xf, (OpCode >> 20) & 0xf, gReg[Rd], Rn, Rm, (OpCode >> 5) &0x7);
|
||||
AsciiSPrint (Buf, Size, "%a%a 0x%x, 0x%x, %a, CR%d, CR%d, 0x%x", Load ? "MRC" : "MCR", COND (OpCode), (OpCode >> 8) & 0xf, (OpCode >> 20) & 0xf, gReg[Rd], Rn, Rm, (OpCode >> 5) &0x7);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((OpCode & 0x0ff00000) == 0x0c400000) {
|
||||
// A4.1.33 MRRC2, MCRR2
|
||||
AsciiSPrint (Buf, Size, "%a%a 0x%x, 0x%x, %a, %a, CR%d", L ? "MRRC":"MCRR", COND (OpCode), (OpCode >> 4) & 0xf, (OpCode >> 20) & 0xf, gReg[Rd], gReg[Rn], Rm);
|
||||
AsciiSPrint (Buf, Size, "%a%a 0x%x, 0x%x, %a, %a, CR%d", Load ? "MRRC" : "MCRR", COND (OpCode), (OpCode >> 4) & 0xf, (OpCode >> 20) & 0xf, gReg[Rd], gReg[Rn], Rm);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -453,4 +463,3 @@ DisassembleArmInstruction (
|
||||
*OpCodePtr += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
try to reuse existing case entries if possible.
|
||||
|
||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -92,9 +93,6 @@ extern CHAR8 *gReg[];
|
||||
#define THUMB2_MRS 235
|
||||
#define THUMB2_MSR 236
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
CHAR8 *Start;
|
||||
UINT32 OpCode;
|
||||
@@ -103,109 +101,108 @@ typedef struct {
|
||||
} THUMB_INSTRUCTIONS;
|
||||
|
||||
THUMB_INSTRUCTIONS gOpThumb[] = {
|
||||
// Thumb 16-bit instructions
|
||||
// Op Mask Format
|
||||
{ "ADC" , 0x4140, 0xffc0, DATA_FORMAT5 }, // ADC <Rndn>, <Rm>
|
||||
// Thumb 16-bit instructions
|
||||
// Op Mask Format
|
||||
{ "ADC", 0x4140, 0xffc0, DATA_FORMAT5 }, // ADC <Rndn>, <Rm>
|
||||
{ "ADR", 0xa000, 0xf800, ADR_FORMAT }, // ADR <Rd>, <label>
|
||||
{ "ADD" , 0x1c00, 0xfe00, DATA_FORMAT2 },
|
||||
{ "ADD" , 0x3000, 0xf800, DATA_FORMAT3 },
|
||||
{ "ADD" , 0x1800, 0xfe00, DATA_FORMAT1 },
|
||||
{ "ADD" , 0x4400, 0xff00, DATA_FORMAT8 }, // A8.6.9
|
||||
{ "ADD" , 0xa000, 0xf100, DATA_FORMAT6_PC },
|
||||
{ "ADD" , 0xa800, 0xf800, DATA_FORMAT6_SP },
|
||||
{ "ADD" , 0xb000, 0xff80, DATA_FORMAT7 },
|
||||
{ "ADD", 0x1c00, 0xfe00, DATA_FORMAT2 },
|
||||
{ "ADD", 0x3000, 0xf800, DATA_FORMAT3 },
|
||||
{ "ADD", 0x1800, 0xfe00, DATA_FORMAT1 },
|
||||
{ "ADD", 0x4400, 0xff00, DATA_FORMAT8 }, // A8.6.9
|
||||
{ "ADD", 0xa000, 0xf100, DATA_FORMAT6_PC },
|
||||
{ "ADD", 0xa800, 0xf800, DATA_FORMAT6_SP },
|
||||
{ "ADD", 0xb000, 0xff80, DATA_FORMAT7 },
|
||||
|
||||
{ "AND" , 0x4000, 0xffc0, DATA_FORMAT5 },
|
||||
{ "AND", 0x4000, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "ASR" , 0x1000, 0xf800, DATA_FORMAT4 },
|
||||
{ "ASR" , 0x4100, 0xffc0, DATA_FORMAT5 },
|
||||
{ "ASR", 0x1000, 0xf800, DATA_FORMAT4 },
|
||||
{ "ASR", 0x4100, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "B" , 0xd000, 0xf000, CONDITIONAL_BRANCH },
|
||||
{ "B" , 0xe000, 0xf800, UNCONDITIONAL_BRANCH_SHORT },
|
||||
{ "BLX" , 0x4780, 0xff80, BRANCH_EXCHANGE },
|
||||
{ "BX" , 0x4700, 0xff87, BRANCH_EXCHANGE },
|
||||
{ "B", 0xd000, 0xf000, CONDITIONAL_BRANCH },
|
||||
{ "B", 0xe000, 0xf800, UNCONDITIONAL_BRANCH_SHORT },
|
||||
{ "BLX", 0x4780, 0xff80, BRANCH_EXCHANGE },
|
||||
{ "BX", 0x4700, 0xff87, BRANCH_EXCHANGE },
|
||||
|
||||
{ "BIC" , 0x4380, 0xffc0, DATA_FORMAT5 },
|
||||
{ "BIC", 0x4380, 0xffc0, DATA_FORMAT5 },
|
||||
{ "BKPT", 0xdf00, 0xff00, IMMED_8 },
|
||||
{ "CBZ", 0xb100, 0xfd00, DATA_CBZ },
|
||||
{ "CBNZ", 0xb900, 0xfd00, DATA_CBZ },
|
||||
{ "CMN" , 0x42c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "CMN", 0x42c0, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "CMP" , 0x2800, 0xf800, DATA_FORMAT3 },
|
||||
{ "CMP" , 0x4280, 0xffc0, DATA_FORMAT5 },
|
||||
{ "CMP" , 0x4500, 0xff00, DATA_FORMAT8 },
|
||||
{ "CMP", 0x2800, 0xf800, DATA_FORMAT3 },
|
||||
{ "CMP", 0x4280, 0xffc0, DATA_FORMAT5 },
|
||||
{ "CMP", 0x4500, 0xff00, DATA_FORMAT8 },
|
||||
|
||||
{ "CPS" , 0xb660, 0xffe8, CPS_FORMAT },
|
||||
{ "MOV" , 0x4600, 0xff00, DATA_FORMAT8 },
|
||||
{ "EOR" , 0x4040, 0xffc0, DATA_FORMAT5 },
|
||||
{ "CPS", 0xb660, 0xffe8, CPS_FORMAT },
|
||||
{ "MOV", 0x4600, 0xff00, DATA_FORMAT8 },
|
||||
{ "EOR", 0x4040, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "LDMIA" , 0xc800, 0xf800, LOAD_STORE_MULTIPLE_FORMAT1 },
|
||||
{ "LDR" , 0x6800, 0xf800, LOAD_STORE_FORMAT1 }, // LDR <Rt>, [<Rn> {,#<imm>}]
|
||||
{ "LDR" , 0x5800, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "LDR" , 0x4800, 0xf800, LOAD_STORE_FORMAT3 },
|
||||
{ "LDR" , 0x9800, 0xf800, LOAD_STORE_FORMAT4 }, // LDR <Rt>, [SP, #<imm>]
|
||||
{ "LDRB" , 0x7800, 0xf800, LOAD_STORE_FORMAT1_B },
|
||||
{ "LDRB" , 0x5c00, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "LDRH" , 0x8800, 0xf800, LOAD_STORE_FORMAT1_H },
|
||||
{ "LDRH" , 0x7a00, 0xfe00, LOAD_STORE_FORMAT2 },
|
||||
{ "LDRSB" , 0x5600, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "LDRSH" , 0x5e00, 0xfe00, LOAD_STORE_FORMAT2 },
|
||||
{ "LDMIA", 0xc800, 0xf800, LOAD_STORE_MULTIPLE_FORMAT1 },
|
||||
{ "LDR", 0x6800, 0xf800, LOAD_STORE_FORMAT1 }, // LDR <Rt>, [<Rn> {,#<imm>}]
|
||||
{ "LDR", 0x5800, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "LDR", 0x4800, 0xf800, LOAD_STORE_FORMAT3 },
|
||||
{ "LDR", 0x9800, 0xf800, LOAD_STORE_FORMAT4 }, // LDR <Rt>, [SP, #<imm>]
|
||||
{ "LDRB", 0x7800, 0xf800, LOAD_STORE_FORMAT1_B },
|
||||
{ "LDRB", 0x5c00, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "LDRH", 0x8800, 0xf800, LOAD_STORE_FORMAT1_H },
|
||||
{ "LDRH", 0x7a00, 0xfe00, LOAD_STORE_FORMAT2 },
|
||||
{ "LDRSB", 0x5600, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "LDRSH", 0x5e00, 0xfe00, LOAD_STORE_FORMAT2 },
|
||||
|
||||
{ "MOVS", 0x0000, 0xffc0, DATA_FORMAT5 }, // LSL with imm5 == 0 is a MOVS, so this must go before LSL
|
||||
{ "LSL" , 0x0000, 0xf800, DATA_FORMAT4 },
|
||||
{ "LSL" , 0x4080, 0xffc0, DATA_FORMAT5 },
|
||||
{ "LSR" , 0x0001, 0xf800, DATA_FORMAT4 },
|
||||
{ "LSR" , 0x40c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "LSL", 0x0000, 0xf800, DATA_FORMAT4 },
|
||||
{ "LSL", 0x4080, 0xffc0, DATA_FORMAT5 },
|
||||
{ "LSR", 0x0001, 0xf800, DATA_FORMAT4 },
|
||||
{ "LSR", 0x40c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "LSRS", 0x0800, 0xf800, DATA_FORMAT4 }, // LSRS <Rd>, <Rm>, #<imm5>
|
||||
|
||||
{ "MOVS", 0x2000, 0xf800, DATA_FORMAT3 },
|
||||
{ "MOV" , 0x1c00, 0xffc0, DATA_FORMAT3 },
|
||||
{ "MOV" , 0x4600, 0xff00, DATA_FORMAT8 },
|
||||
{ "MOV", 0x1c00, 0xffc0, DATA_FORMAT3 },
|
||||
{ "MOV", 0x4600, 0xff00, DATA_FORMAT8 },
|
||||
|
||||
{ "MUL" , 0x4340, 0xffc0, DATA_FORMAT5 },
|
||||
{ "MVN" , 0x41c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "NEG" , 0x4240, 0xffc0, DATA_FORMAT5 },
|
||||
{ "ORR" , 0x4300, 0xffc0, DATA_FORMAT5 },
|
||||
{ "POP" , 0xbc00, 0xfe00, POP_FORMAT },
|
||||
{ "MUL", 0x4340, 0xffc0, DATA_FORMAT5 },
|
||||
{ "MVN", 0x41c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "NEG", 0x4240, 0xffc0, DATA_FORMAT5 },
|
||||
{ "ORR", 0x4300, 0xffc0, DATA_FORMAT5 },
|
||||
{ "POP", 0xbc00, 0xfe00, POP_FORMAT },
|
||||
{ "PUSH", 0xb400, 0xfe00, PUSH_FORMAT },
|
||||
|
||||
{ "REV" , 0xba00, 0xffc0, DATA_FORMAT5 },
|
||||
{ "REV16" , 0xba40, 0xffc0, DATA_FORMAT5 },
|
||||
{ "REVSH" , 0xbac0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "REV", 0xba00, 0xffc0, DATA_FORMAT5 },
|
||||
{ "REV16", 0xba40, 0xffc0, DATA_FORMAT5 },
|
||||
{ "REVSH", 0xbac0, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "ROR" , 0x41c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "SBC" , 0x4180, 0xffc0, DATA_FORMAT5 },
|
||||
{ "SETEND" , 0xb650, 0xfff0, ENDIAN_FORMAT },
|
||||
{ "ROR", 0x41c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "SBC", 0x4180, 0xffc0, DATA_FORMAT5 },
|
||||
{ "SETEND", 0xb650, 0xfff0, ENDIAN_FORMAT },
|
||||
|
||||
{ "STMIA" , 0xc000, 0xf800, LOAD_STORE_MULTIPLE_FORMAT1 },
|
||||
{ "STR" , 0x6000, 0xf800, LOAD_STORE_FORMAT1 }, // STR <Rt>, [<Rn> {,#<imm>}]
|
||||
{ "STR" , 0x5000, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "STR" , 0x9000, 0xf800, LOAD_STORE_FORMAT4 }, // STR <Rt>, [SP, #<imm>]
|
||||
{ "STRB" , 0x7000, 0xf800, LOAD_STORE_FORMAT1_B }, // STRB <Rt>, [<Rn>, #<imm5>]
|
||||
{ "STRB" , 0x5400, 0xfe00, LOAD_STORE_FORMAT2 }, // STRB <Rt>, [<Rn>, <Rm>]
|
||||
{ "STRH" , 0x8000, 0xf800, LOAD_STORE_FORMAT1_H }, // STRH <Rt>, [<Rn>{,#<imm>}]
|
||||
{ "STRH" , 0x5200, 0xfe00, LOAD_STORE_FORMAT2 }, // STRH <Rt>, [<Rn>, <Rm>]
|
||||
{ "STMIA", 0xc000, 0xf800, LOAD_STORE_MULTIPLE_FORMAT1 },
|
||||
{ "STR", 0x6000, 0xf800, LOAD_STORE_FORMAT1 }, // STR <Rt>, [<Rn> {,#<imm>}]
|
||||
{ "STR", 0x5000, 0xfe00, LOAD_STORE_FORMAT2 }, // STR <Rt>, [<Rn>, <Rm>]
|
||||
{ "STR", 0x9000, 0xf800, LOAD_STORE_FORMAT4 }, // STR <Rt>, [SP, #<imm>]
|
||||
{ "STRB", 0x7000, 0xf800, LOAD_STORE_FORMAT1_B }, // STRB <Rt>, [<Rn>, #<imm5>]
|
||||
{ "STRB", 0x5400, 0xfe00, LOAD_STORE_FORMAT2 }, // STRB <Rt>, [<Rn>, <Rm>]
|
||||
{ "STRH", 0x8000, 0xf800, LOAD_STORE_FORMAT1_H }, // STRH <Rt>, [<Rn>{,#<imm>}]
|
||||
{ "STRH", 0x5200, 0xfe00, LOAD_STORE_FORMAT2 }, // STRH <Rt>, [<Rn>, <Rm>]
|
||||
|
||||
{ "SUB" , 0x1e00, 0xfe00, DATA_FORMAT2 },
|
||||
{ "SUB" , 0x3800, 0xf800, DATA_FORMAT3 },
|
||||
{ "SUB" , 0x1a00, 0xfe00, DATA_FORMAT1 },
|
||||
{ "SUB" , 0xb080, 0xff80, DATA_FORMAT7 },
|
||||
{ "SUB", 0x1e00, 0xfe00, DATA_FORMAT2 },
|
||||
{ "SUB", 0x3800, 0xf800, DATA_FORMAT3 },
|
||||
{ "SUB", 0x1a00, 0xfe00, DATA_FORMAT1 },
|
||||
{ "SUB", 0xb080, 0xff80, DATA_FORMAT7 },
|
||||
|
||||
{ "SBC" , 0x4180, 0xffc0, DATA_FORMAT5 },
|
||||
{ "SBC", 0x4180, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "SWI" , 0xdf00, 0xff00, IMMED_8 },
|
||||
{ "SWI", 0xdf00, 0xff00, IMMED_8 },
|
||||
{ "SXTB", 0xb240, 0xffc0, DATA_FORMAT5 },
|
||||
{ "SXTH", 0xb200, 0xffc0, DATA_FORMAT5 },
|
||||
{ "TST" , 0x4200, 0xffc0, DATA_FORMAT5 },
|
||||
{ "TST", 0x4200, 0xffc0, DATA_FORMAT5 },
|
||||
{ "UXTB", 0xb2c0, 0xffc0, DATA_FORMAT5 },
|
||||
{ "UXTH", 0xb280, 0xffc0, DATA_FORMAT5 },
|
||||
|
||||
{ "IT", 0xbf00, 0xff00, IT_BLOCK }
|
||||
|
||||
};
|
||||
|
||||
THUMB_INSTRUCTIONS gOpThumb2[] = {
|
||||
//Instruct OpCode OpCode Mask Addressig Mode
|
||||
// Instruct OpCode OpCode Mask Addressig Mode
|
||||
|
||||
{ "ADR", 0xf2af0000, 0xfbff8000, ADR_THUMB2 }, // ADDR <Rd>, <label> ;Needs to go before ADDW
|
||||
{ "CMN", 0xf1100f00, 0xfff08f00, CMN_THUMB2 }, // CMN <Rn>, #<const> ;Needs to go before ADD
|
||||
@@ -280,7 +277,6 @@ THUMB_INSTRUCTIONS gOpThumb2[] = {
|
||||
{ "MLA", 0xfb000000, 0xfff000f0, THUMB2_4REGS }, // MLA <Rd>, <Rn>, <Rm>, <Ra>
|
||||
{ "MLS", 0xfb000010, 0xfff000f0, THUMB2_4REGS }, // MLA <Rd>, <Rn>, <Rm>, <Ra>
|
||||
|
||||
|
||||
{ "SMLABB", 0xfb100000, 0xfff000f0, THUMB2_4REGS }, // SMLABB <Rd>, <Rn>, <Rm>, <Ra>
|
||||
{ "SMLABT", 0xfb100010, 0xfff000f0, THUMB2_4REGS }, // SMLABT <Rd>, <Rn>, <Rm>, <Ra>
|
||||
{ "SMLABB", 0xfb100020, 0xfff000f0, THUMB2_4REGS }, // SMLATB <Rd>, <Rn>, <Rm>, <Ra>
|
||||
@@ -297,7 +293,6 @@ THUMB_INSTRUCTIONS gOpThumb2[] = {
|
||||
{ "SMLAD", 0xfb200000, 0xfff000f0, THUMB2_4REGS }, // SMLAD <Rd>, <Rn>, <Rm>, <Ra>
|
||||
{ "SMLADX", 0xfb200010, 0xfff000f0, THUMB2_4REGS }, // SMLADX <Rd>, <Rn>, <Rm>, <Ra>
|
||||
|
||||
|
||||
{ "B", 0xf0008000, 0xf800d000, B_T3 }, // B<c> <label>
|
||||
{ "B", 0xf0009000, 0xf800d000, B_T4 }, // B<c> <label>
|
||||
{ "BL", 0xf000d000, 0xf800d000, B_T4 }, // BL<c> <label>
|
||||
@@ -307,9 +302,9 @@ THUMB_INSTRUCTIONS gOpThumb2[] = {
|
||||
{ "POP", 0xf85d0b04, 0xffff0fff, POP_T3 }, // POP <register>
|
||||
{ "PUSH", 0xe8ad0000, 0xffffa000, POP_T2 }, // PUSH <registers>
|
||||
{ "PUSH", 0xf84d0d04, 0xffff0fff, POP_T3 }, // PUSH <register>
|
||||
{ "STM" , 0xe8800000, 0xffd0a000, STM_FORMAT }, // STM <Rn>{!},<registers>
|
||||
{ "STM", 0xe8800000, 0xffd0a000, STM_FORMAT }, // STM <Rn>{!},<registers>
|
||||
{ "STMDB", 0xe9800000, 0xffd0a000, STM_FORMAT }, // STMDB <Rn>{!},<registers>
|
||||
{ "LDM" , 0xe8900000, 0xffd02000, STM_FORMAT }, // LDM <Rn>{!},<registers>
|
||||
{ "LDM", 0xe8900000, 0xffd02000, STM_FORMAT }, // LDM <Rn>{!},<registers>
|
||||
{ "LDMDB", 0xe9100000, 0xffd02000, STM_FORMAT }, // LDMDB <Rn>{!},<registers>
|
||||
|
||||
{ "LDR", 0xf8d00000, 0xfff00000, LDM_REG_IMM12 }, // LDR <rt>, [<rn>, {, #<imm12>]}
|
||||
@@ -334,9 +329,9 @@ THUMB_INSTRUCTIONS gOpThumb2[] = {
|
||||
{ "LDRBT", 0xf8100e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRBT <rt>, [<rn>, {, #<imm8>]}
|
||||
{ "LDRHT", 0xf8300e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRHT <rt>, [<rn>, {, #<imm8>]}
|
||||
{ "LDRSB", 0xf9100800, 0xfff00800, LDM_REG_IMM8 }, // LDRHT <rt>, [<rn>, {, #<imm8>]} {!} form?
|
||||
{ "LDRSBT",0xf9100e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRHBT <rt>, [<rn>, {, #<imm8>]} {!} form?
|
||||
{ "LDRSH" ,0xf9300800, 0xfff00800, LDM_REG_IMM8 }, // LDRSH <rt>, [<rn>, {, #<imm8>]}
|
||||
{ "LDRSHT",0xf9300e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRSHT <rt>, [<rn>, {, #<imm8>]}
|
||||
{ "LDRSBT", 0xf9100e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRHBT <rt>, [<rn>, {, #<imm8>]} {!} form?
|
||||
{ "LDRSH", 0xf9300800, 0xfff00800, LDM_REG_IMM8 }, // LDRSH <rt>, [<rn>, {, #<imm8>]}
|
||||
{ "LDRSHT", 0xf9300e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRSHT <rt>, [<rn>, {, #<imm8>]}
|
||||
{ "LDRT", 0xf8500e00, 0xfff00f00, LDM_REG_IMM8 }, // LDRT <rt>, [<rn>, {, #<imm8>]}
|
||||
|
||||
{ "LDRD", 0xe8500000, 0xfe500000, LDRD_REG_IMM8_SIGNED }, // LDRD <rt>, <rt2>, [<rn>, {, #<imm8>]}{!}
|
||||
@@ -371,9 +366,9 @@ THUMB_INSTRUCTIONS gOpThumb2[] = {
|
||||
{ "STREXD", 0xe8d00f4f, 0xfff00fff, LDREXD }, // STREXD <Rd>, <Rt>, <Rt2>, [<Rn>]
|
||||
|
||||
{ "SRSDB", 0xe80dc000, 0xffdffff0, SRS_FORMAT }, // SRSDB<c> SP{!},#<mode>
|
||||
{ "SRS" , 0xe98dc000, 0xffdffff0, SRS_FORMAT }, // SRS{IA}<c> SP{!},#<mode>
|
||||
{ "SRS", 0xe98dc000, 0xffdffff0, SRS_FORMAT }, // SRS{IA}<c> SP{!},#<mode>
|
||||
{ "RFEDB", 0xe810c000, 0xffd0ffff, RFE_FORMAT }, // RFEDB<c> <Rn>{!}
|
||||
{ "RFE" , 0xe990c000, 0xffd0ffff, RFE_FORMAT } // RFE{IA}<c> <Rn>{!}
|
||||
{ "RFE", 0xe990c000, 0xffd0ffff, RFE_FORMAT } // RFE{IA}<c> <Rn>{!}
|
||||
};
|
||||
|
||||
CHAR8 *gShiftType[] = {
|
||||
@@ -418,9 +413,11 @@ ThumbMRegList (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (First) {
|
||||
AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "ERROR");
|
||||
}
|
||||
|
||||
AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "}");
|
||||
|
||||
// BugBug: Make caller pass in buffer it is cleaner
|
||||
@@ -451,7 +448,7 @@ SignExtend32 (
|
||||
// in the instruction address and you get back the aligned answer
|
||||
//
|
||||
UINT32
|
||||
PCAlign4 (
|
||||
PcAlign4 (
|
||||
IN UINT32 Data
|
||||
)
|
||||
{
|
||||
@@ -486,12 +483,19 @@ DisassembleThumbInstruction (
|
||||
UINT32 Index;
|
||||
UINT32 Offset;
|
||||
UINT16 Rd, Rn, Rm, Rt, Rt2;
|
||||
BOOLEAN H1, H2, imod;
|
||||
//BOOLEAN ItFlag;
|
||||
UINT32 PC, Target, msbit, lsbit;
|
||||
BOOLEAN H1Bit; // H1
|
||||
BOOLEAN H2Bit; // H2
|
||||
BOOLEAN IMod; // imod
|
||||
// BOOLEAN ItFlag;
|
||||
UINT32 Pc, Target, MsBit, LsBit;
|
||||
CHAR8 *Cond;
|
||||
BOOLEAN S, J1, J2, P, U, W;
|
||||
UINT32 coproc, opc1, opc2, CRd, CRn, CRm;
|
||||
BOOLEAN Sign; // S
|
||||
BOOLEAN J1Bit; // J1
|
||||
BOOLEAN J2Bit; // J2
|
||||
BOOLEAN Pre; // P
|
||||
BOOLEAN UAdd; // U
|
||||
BOOLEAN WriteBack; // W
|
||||
UINT32 Coproc, Opc1, Opc2, CRd, CRn, CRm;
|
||||
UINT32 Mask;
|
||||
|
||||
OpCodePtr = *OpCodePtrPtr;
|
||||
@@ -504,15 +508,16 @@ DisassembleThumbInstruction (
|
||||
Rd = OpCode & 0x7;
|
||||
Rn = (OpCode >> 3) & 0x7;
|
||||
Rm = (OpCode >> 6) & 0x7;
|
||||
H1 = (OpCode & BIT7) != 0;
|
||||
H2 = (OpCode & BIT6) != 0;
|
||||
imod = (OpCode & BIT4) != 0;
|
||||
PC = (UINT32)(UINTN)OpCodePtr;
|
||||
H1Bit = (OpCode & BIT7) != 0;
|
||||
H2Bit = (OpCode & BIT6) != 0;
|
||||
IMod = (OpCode & BIT4) != 0;
|
||||
Pc = (UINT32)(UINTN)OpCodePtr;
|
||||
|
||||
// Increment by the minimum instruction size, Thumb2 could be bigger
|
||||
*OpCodePtrPtr += 1;
|
||||
|
||||
// Manage IT Block ItFlag TRUE means we are in an IT block
|
||||
|
||||
/*if (*ItBlock != 0) {
|
||||
ItFlag = TRUE;
|
||||
*ItBlock -= 1;
|
||||
@@ -527,6 +532,7 @@ DisassembleThumbInstruction (
|
||||
} else {
|
||||
Offset = AsciiSPrint (Buf, Size, "%-6a", gOpThumb[Index].Start);
|
||||
}
|
||||
|
||||
switch (gOpThumb[Index].AddressMode) {
|
||||
case LOAD_STORE_FORMAT1:
|
||||
// A6.5.1 <Rd>, [<Rn>, #<5_bit_offset>]
|
||||
@@ -548,7 +554,7 @@ DisassembleThumbInstruction (
|
||||
case LOAD_STORE_FORMAT3:
|
||||
// A6.5.1 <Rd>, [PC, #<8_bit_offset>]
|
||||
Target = (OpCode & 0xff) << 2;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " r%d, [pc, #0x%x] ;0x%08x", (OpCode >> 8) & 7, Target, PCAlign4 (PC) + Target);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " r%d, [pc, #0x%x] ;0x%08x", (OpCode >> 8) & 7, Target, PcAlign4 (Pc) + Target);
|
||||
return;
|
||||
case LOAD_STORE_FORMAT4:
|
||||
// Rt, [SP, #imm8]
|
||||
@@ -571,7 +577,6 @@ DisassembleThumbInstruction (
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a", ThumbMRegList ((OpCode & 0xff) | ((OpCode & BIT8) == BIT8 ? BIT14 : 0)));
|
||||
return;
|
||||
|
||||
|
||||
case IMMED_8:
|
||||
// A6.7 <immed_8>
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%x", OpCode & 0xff);
|
||||
@@ -583,16 +588,16 @@ DisassembleThumbInstruction (
|
||||
Cond = gCondition[(OpCode >> 8) & 0xf];
|
||||
Buf[Offset-5] = *Cond++;
|
||||
Buf[Offset-4] = *Cond;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%04x", PC + 4 + SignExtend32 ((OpCode & 0xff) << 1, BIT8));
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%04x", Pc + 4 + SignExtend32 ((OpCode & 0xff) << 1, BIT8));
|
||||
return;
|
||||
case UNCONDITIONAL_BRANCH_SHORT:
|
||||
// A6.3.2 B <target_address>
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%04x", PC + 4 + SignExtend32 ((OpCode & 0x3ff) << 1, BIT11));
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%04x", Pc + 4 + SignExtend32 ((OpCode & 0x3ff) << 1, BIT11));
|
||||
return;
|
||||
|
||||
case BRANCH_EXCHANGE:
|
||||
// A6.3.3 BX|BLX <Rm>
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a", gReg[Rn | (H2 ? 8:0)]);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a", gReg[Rn | (H2Bit ? 8 : 0)]);
|
||||
return;
|
||||
|
||||
case DATA_FORMAT1:
|
||||
@@ -629,29 +634,29 @@ DisassembleThumbInstruction (
|
||||
return;
|
||||
case DATA_FORMAT8:
|
||||
// A6.4.3 <Rd>|<Rn>, <Rm>
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a", gReg[Rd | (H1 ? 8:0)], gReg[Rn | (H2 ? 8:0)]);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a", gReg[Rd | (H1Bit ? 8 : 0)], gReg[Rn | (H2Bit ? 8 : 0)]);
|
||||
return;
|
||||
|
||||
case CPS_FORMAT:
|
||||
// A7.1.24
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "%a %a%a%a", imod ? "ID":"IE", ((OpCode & BIT2) == 0) ? "":"a", ((OpCode & BIT1) == 0) ? "":"i", ((OpCode & BIT0) == 0) ? "":"f");
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "%a %a%a%a", IMod ? "ID" : "IE", ((OpCode & BIT2) == 0) ? "" : "a", ((OpCode & BIT1) == 0) ? "" : "i", ((OpCode & BIT0) == 0) ? "" : "f");
|
||||
return;
|
||||
|
||||
case ENDIAN_FORMAT:
|
||||
// A7.1.24
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a", (OpCode & BIT3) == 0 ? "LE":"BE");
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a", (OpCode & BIT3) == 0 ? "LE" : "BE");
|
||||
return;
|
||||
|
||||
case DATA_CBZ:
|
||||
// CB{N}Z <Rn>, <Lable>
|
||||
Target = ((OpCode >> 2) & 0x3e) | (((OpCode & BIT9) == BIT9) ? BIT6 : 0);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %08x", gReg[Rd], PC + 4 + Target);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %08x", gReg[Rd], Pc + 4 + Target);
|
||||
return;
|
||||
|
||||
case ADR_FORMAT:
|
||||
// ADR <Rd>, <Label>
|
||||
Target = (OpCode & 0xff) << 2;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %08x", gReg[(OpCode >> 8) & 7], PCAlign4 (PC) + Target);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %08x", gReg[(OpCode >> 8) & 7], PcAlign4 (Pc) + Target);
|
||||
return;
|
||||
|
||||
case IT_BLOCK:
|
||||
@@ -666,23 +671,23 @@ DisassembleThumbInstruction (
|
||||
Mask = (OpCode & 0xf);
|
||||
if ((Mask & 0x1) == 0x1) {
|
||||
*ItBlock = 4;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, "%a%a%a", (Mask & BIT3)?"T":"E", (Mask & BIT2)?"T":"E", (Mask & BIT1)?"T":"E");
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, "%a%a%a", (Mask & BIT3) ? "T" : "E", (Mask & BIT2) ? "T" : "E", (Mask & BIT1) ? "T" : "E");
|
||||
} else if ((OpCode & 0x3) == 0x2) {
|
||||
*ItBlock = 3;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, "%a%a", (Mask & BIT3)?"T":"E", (Mask & BIT2)?"T":"E");
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, "%a%a", (Mask & BIT3) ? "T" : "E", (Mask & BIT2) ? "T" : "E");
|
||||
} else if ((OpCode & 0x7) == 0x4) {
|
||||
*ItBlock = 2;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, "%a", (Mask & BIT3)?"T":"E");
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, "%a", (Mask & BIT3) ? "T" : "E");
|
||||
} else if ((OpCode & 0xf) == 0x8) {
|
||||
*ItBlock = 1;
|
||||
}
|
||||
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a", gCondition[(OpCode >> 4) & 0xf]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Thumb2 are 32-bit instructions
|
||||
*OpCodePtrPtr += 1;
|
||||
Rt = (OpCode32 >> 12) & 0xf;
|
||||
@@ -697,6 +702,7 @@ DisassembleThumbInstruction (
|
||||
} else {
|
||||
Offset = AsciiSPrint (Buf, Size, " %-6a", gOpThumb2[Index].Start);
|
||||
}
|
||||
|
||||
switch (gOpThumb2[Index].AddressMode) {
|
||||
case B_T3:
|
||||
Cond = gCondition[(OpCode32 >> 22) & 0xf];
|
||||
@@ -704,36 +710,36 @@ DisassembleThumbInstruction (
|
||||
Buf[Offset-4] = *Cond;
|
||||
// S:J2:J1:imm6:imm11:0
|
||||
Target = ((OpCode32 << 1) & 0xffe) + ((OpCode32 >> 4) & 0x3f000);
|
||||
Target |= ((OpCode32 & BIT11) == BIT11)? BIT19 : 0; // J2
|
||||
Target |= ((OpCode32 & BIT13) == BIT13)? BIT18 : 0; // J1
|
||||
Target |= ((OpCode32 & BIT26) == BIT26)? BIT20 : 0; // S
|
||||
Target |= ((OpCode32 & BIT11) == BIT11) ? BIT19 : 0; // J2
|
||||
Target |= ((OpCode32 & BIT13) == BIT13) ? BIT18 : 0; // J1
|
||||
Target |= ((OpCode32 & BIT26) == BIT26) ? BIT20 : 0; // S
|
||||
Target = SignExtend32 (Target, BIT20);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%08x", PC + 4 + Target);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%08x", Pc + 4 + Target);
|
||||
return;
|
||||
case B_T4:
|
||||
// S:I1:I2:imm10:imm11:0
|
||||
Target = ((OpCode32 << 1) & 0xffe) + ((OpCode32 >> 4) & 0x3ff000);
|
||||
S = (OpCode32 & BIT26) == BIT26;
|
||||
J1 = (OpCode32 & BIT13) == BIT13;
|
||||
J2 = (OpCode32 & BIT11) == BIT11;
|
||||
Target |= (!(J2 ^ S) ? BIT22 : 0); // I2
|
||||
Target |= (!(J1 ^ S) ? BIT23 : 0); // I1
|
||||
Target |= (S ? BIT24 : 0); // S
|
||||
Sign = (OpCode32 & BIT26) == BIT26;
|
||||
J1Bit = (OpCode32 & BIT13) == BIT13;
|
||||
J2Bit = (OpCode32 & BIT11) == BIT11;
|
||||
Target |= (!(J2Bit ^ Sign) ? BIT22 : 0); // I2
|
||||
Target |= (!(J1Bit ^ Sign) ? BIT23 : 0); // I1
|
||||
Target |= (Sign ? BIT24 : 0); // S
|
||||
Target = SignExtend32 (Target, BIT24);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%08x", PC + 4 + Target);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%08x", Pc + 4 + Target);
|
||||
return;
|
||||
|
||||
case BL_T2:
|
||||
// BLX S:I1:I2:imm10:imm11:0
|
||||
Target = ((OpCode32 << 1) & 0xffc) + ((OpCode32 >> 4) & 0x3ff000);
|
||||
S = (OpCode32 & BIT26) == BIT26;
|
||||
J1 = (OpCode32 & BIT13) == BIT13;
|
||||
J2 = (OpCode32 & BIT11) == BIT11;
|
||||
Target |= (!(J2 ^ S) ? BIT23 : 0); // I2
|
||||
Target |= (!(J1 ^ S) ? BIT24 : 0); // I1
|
||||
Target |= (S ? BIT25 : 0); // S
|
||||
Sign = (OpCode32 & BIT26) == BIT26;
|
||||
J1Bit = (OpCode32 & BIT13) == BIT13;
|
||||
J2Bit = (OpCode32 & BIT11) == BIT11;
|
||||
Target |= (!(J2Bit ^ Sign) ? BIT23 : 0); // I2
|
||||
Target |= (!(J1Bit ^ Sign) ? BIT24 : 0); // I1
|
||||
Target |= (Sign ? BIT25 : 0); // S
|
||||
Target = SignExtend32 (Target, BIT25);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%08x", PCAlign4 (PC) + Target);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " 0x%08x", PcAlign4 (Pc) + Target);
|
||||
return;
|
||||
|
||||
case POP_T2:
|
||||
@@ -748,8 +754,8 @@ DisassembleThumbInstruction (
|
||||
|
||||
case STM_FORMAT:
|
||||
// <Rn>{!}, <registers>
|
||||
W = (OpCode32 & BIT21) == BIT21;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a%a, %a", gReg[(OpCode32 >> 16) & 0xf], W ? "!":"", ThumbMRegList (OpCode32 & 0xffff));
|
||||
WriteBack = (OpCode32 & BIT21) == BIT21;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a%a, %a", gReg[(OpCode32 >> 16) & 0xf], WriteBack ? "!" : "", ThumbMRegList (OpCode32 & 0xffff));
|
||||
return;
|
||||
|
||||
case LDM_REG_IMM12_SIGNED:
|
||||
@@ -759,7 +765,8 @@ DisassembleThumbInstruction (
|
||||
// U == 0 means subtrack, U == 1 means add
|
||||
Target = -Target;
|
||||
}
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a", gReg[(OpCode32 >> 12) & 0xf], PCAlign4 (PC) + Target);
|
||||
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a", gReg[(OpCode32 >> 12) & 0xf], PcAlign4 (Pc) + Target);
|
||||
return;
|
||||
|
||||
case LDM_REG_INDIRECT_LSL:
|
||||
@@ -770,6 +777,7 @@ DisassembleThumbInstruction (
|
||||
} else {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", LSL #%d]", (OpCode32 >> 4) & 3);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case LDM_REG_IMM12:
|
||||
@@ -780,42 +788,45 @@ DisassembleThumbInstruction (
|
||||
} else {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #0x%x]", OpCode32 & 0xfff);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case LDM_REG_IMM8:
|
||||
// <rt>, [<rn>, {, #<imm8>}]{!}
|
||||
W = (OpCode32 & BIT8) == BIT8;
|
||||
U = (OpCode32 & BIT9) == BIT9;
|
||||
P = (OpCode32 & BIT10) == BIT10;
|
||||
WriteBack = (OpCode32 & BIT8) == BIT8;
|
||||
UAdd = (OpCode32 & BIT9) == BIT9;
|
||||
Pre = (OpCode32 & BIT10) == BIT10;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " %a, [%a", gReg[Rt], gReg[Rn]);
|
||||
if (P) {
|
||||
if (Pre) {
|
||||
if ((OpCode32 & 0xff) == 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "]%a", W?"!":"");
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "]%a", WriteBack ? "!" : "");
|
||||
} else {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #%a0x%x]%a", U?"":"-" , OpCode32 & 0xff, W?"!":"");
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #%a0x%x]%a", UAdd ? "" : "-", OpCode32 & 0xff, WriteBack ? "!" : "");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "], #%a0x%x", U?"":"-", OpCode32 & 0xff);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "], #%a0x%x", UAdd ? "" : "-", OpCode32 & 0xff);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case LDRD_REG_IMM8_SIGNED:
|
||||
// LDRD <rt>, <rt2>, [<rn>, {, #<imm8>]}{!}
|
||||
P = (OpCode32 & BIT24) == BIT24; // index = P
|
||||
U = (OpCode32 & BIT23) == BIT23;
|
||||
W = (OpCode32 & BIT21) == BIT21;
|
||||
Pre = (OpCode32 & BIT24) == BIT24; // index = P
|
||||
UAdd = (OpCode32 & BIT23) == BIT23;
|
||||
WriteBack = (OpCode32 & BIT21) == BIT21;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, [%a", gReg[Rt], gReg[Rt2], gReg[Rn]);
|
||||
if (P) {
|
||||
if (Pre) {
|
||||
if ((OpCode32 & 0xff) == 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, "]");
|
||||
} else {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #%a0x%x]%a", U?"":"-", (OpCode32 & 0xff) << 2, W?"!":"");
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #%a0x%x]%a", UAdd ? "" : "-", (OpCode32 & 0xff) << 2, WriteBack ? "!" : "");
|
||||
}
|
||||
} else {
|
||||
if ((OpCode32 & 0xff) != 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #%a0x%x", U?"":"-", (OpCode32 & 0xff) << 2);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", #%a0x%x", UAdd ? "" : "-", (OpCode32 & 0xff) << 2);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case LDRD_REG_IMM8:
|
||||
@@ -825,7 +836,8 @@ DisassembleThumbInstruction (
|
||||
// U == 0 means subtrack, U == 1 means add
|
||||
Target = -Target;
|
||||
}
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, %a", gReg[Rt], gReg[Rt2], PC + 4 + Target);
|
||||
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, %a", gReg[Rt], gReg[Rt2], Pc + 4 + Target);
|
||||
return;
|
||||
|
||||
case LDREXB:
|
||||
@@ -840,14 +852,14 @@ DisassembleThumbInstruction (
|
||||
|
||||
case SRS_FORMAT:
|
||||
// SP{!}, #<mode>
|
||||
W = (OpCode32 & BIT21) == BIT21;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " SP%a, #0x%x", W?"!":"", OpCode32 & 0x1f);
|
||||
WriteBack = (OpCode32 & BIT21) == BIT21;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " SP%a, #0x%x", WriteBack ? "!" : "", OpCode32 & 0x1f);
|
||||
return;
|
||||
|
||||
case RFE_FORMAT:
|
||||
// <Rn>{!}
|
||||
W = (OpCode32 & BIT21) == BIT21;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a%a, #0x%x", gReg[Rn], W?"!":"");
|
||||
WriteBack = (OpCode32 & BIT21) == BIT21;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a%a, #0x%x", gReg[Rn], WriteBack ? "!" : "");
|
||||
return;
|
||||
|
||||
case ADD_IMM12:
|
||||
@@ -855,6 +867,7 @@ DisassembleThumbInstruction (
|
||||
if ((OpCode32 & BIT20) == BIT20) {
|
||||
Buf[Offset - 3] = 'S'; // assume %-6a
|
||||
}
|
||||
|
||||
Target = (OpCode32 & 0xff) | ((OpCode32 >> 4) & 0x700) | ((OpCode & BIT26) == BIT26 ? BIT11 : 0);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, #0x%x", gReg[Rd], gReg[Rn], Target);
|
||||
return;
|
||||
@@ -864,6 +877,7 @@ DisassembleThumbInstruction (
|
||||
if ((OpCode32 & BIT20) == BIT20) {
|
||||
Buf[Offset - 3] = 'S'; // assume %-6a
|
||||
}
|
||||
|
||||
Target = (OpCode32 & 0xff) | ((OpCode32 >> 4) & 0x700) | ((OpCode & BIT26) == BIT26 ? BIT11 : 0);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, #0x%x", gReg[Rd], Target);
|
||||
return;
|
||||
@@ -880,11 +894,13 @@ DisassembleThumbInstruction (
|
||||
if ((OpCode32 & BIT20) == BIT20) {
|
||||
Buf[Offset - 3] = 'S'; // assume %-6a
|
||||
}
|
||||
|
||||
Target = ((OpCode32 >> 6) & 3) | ((OpCode32 >> 10) & 0x1c0);
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, %a", gReg[Rd], gReg[Rn], gReg[Rm]);
|
||||
if (Target != 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", LSL %d", gShiftType[(OpCode >> 5) & 3], Target);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case ADD_IMM5_2REG:
|
||||
@@ -895,12 +911,12 @@ DisassembleThumbInstruction (
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ", LSL %d", gShiftType[(OpCode >> 5) & 3], Target);
|
||||
}
|
||||
|
||||
|
||||
case ASR_IMM5:
|
||||
// ARS <Rd>, <Rm> #<const>} imm3:imm2
|
||||
if ((OpCode32 & BIT20) == BIT20) {
|
||||
Buf[Offset - 3] = 'S'; // assume %-6a
|
||||
}
|
||||
|
||||
Target = ((OpCode32 >> 6) & 3) | ((OpCode32 >> 10) & 0x1c0);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a #%d", gReg[Rd], gReg[Rm], Target);
|
||||
return;
|
||||
@@ -910,6 +926,7 @@ DisassembleThumbInstruction (
|
||||
if ((OpCode32 & BIT20) == BIT20) {
|
||||
Buf[Offset - 3] = 'S'; // assume %-6a
|
||||
}
|
||||
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a %a", gReg[Rd], gReg[Rn], gReg[Rm]);
|
||||
return;
|
||||
|
||||
@@ -917,10 +934,11 @@ DisassembleThumbInstruction (
|
||||
// ADDR <Rd>, <label>
|
||||
Target = (OpCode32 & 0xff) | ((OpCode32 >> 8) & 0x700) | ((OpCode & BIT26) == BIT26 ? BIT11 : 0);
|
||||
if ((OpCode & (BIT23 | BIT21)) == (BIT23 | BIT21)) {
|
||||
Target = PCAlign4 (PC) - Target;
|
||||
Target = PcAlign4 (Pc) - Target;
|
||||
} else {
|
||||
Target = PCAlign4 (PC) + Target;
|
||||
Target = PcAlign4 (Pc) + Target;
|
||||
}
|
||||
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, 0x%08x", gReg[Rd], Target);
|
||||
return;
|
||||
|
||||
@@ -932,52 +950,55 @@ DisassembleThumbInstruction (
|
||||
|
||||
case BFC_THUMB2:
|
||||
// BFI <Rd>, <Rn>, #<lsb>, #<width>
|
||||
msbit = OpCode32 & 0x1f;
|
||||
lsbit = ((OpCode32 >> 6) & 3) | ((OpCode >> 10) & 0x1c);
|
||||
if ((Rn == 0xf) & (AsciiStrCmp (gOpThumb2[Index].Start, "BFC") == 0)){
|
||||
MsBit = OpCode32 & 0x1f;
|
||||
LsBit = ((OpCode32 >> 6) & 3) | ((OpCode >> 10) & 0x1c);
|
||||
if ((Rn == 0xf) & (AsciiStrCmp (gOpThumb2[Index].Start, "BFC") == 0)) {
|
||||
// BFC <Rd>, #<lsb>, #<width>
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, #%d, #%d", gReg[Rd], lsbit, msbit - lsbit + 1);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, #%d, #%d", gReg[Rd], LsBit, MsBit - LsBit + 1);
|
||||
} else if (AsciiStrCmp (gOpThumb2[Index].Start, "BFI") == 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, #%d, #%d", gReg[Rd], gReg[Rn], lsbit, msbit - lsbit + 1);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, #%d, #%d", gReg[Rd], gReg[Rn], LsBit, MsBit - LsBit + 1);
|
||||
} else {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, #%d, #%d", gReg[Rd], gReg[Rn], lsbit, msbit + 1);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " %a, %a, #%d, #%d", gReg[Rd], gReg[Rn], LsBit, MsBit + 1);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case CPD_THUMB2:
|
||||
// <coproc>,<opc1>,<CRd>,<CRn>,<CRm>,<opc2>
|
||||
coproc = (OpCode32 >> 8) & 0xf;
|
||||
opc1 = (OpCode32 >> 20) & 0xf;
|
||||
opc2 = (OpCode32 >> 5) & 0x7;
|
||||
Coproc = (OpCode32 >> 8) & 0xf;
|
||||
Opc1 = (OpCode32 >> 20) & 0xf;
|
||||
Opc2 = (OpCode32 >> 5) & 0x7;
|
||||
CRd = (OpCode32 >> 12) & 0xf;
|
||||
CRn = (OpCode32 >> 16) & 0xf;
|
||||
CRm = OpCode32 & 0xf;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " p%d,#%d,c%d,c%d,c%d", coproc, opc1, CRd, CRn, CRm);
|
||||
if (opc2 != 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ",#%d,", opc2);
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " p%d,#%d,c%d,c%d,c%d", Coproc, Opc1, CRd, CRn, CRm);
|
||||
if (Opc2 != 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ",#%d,", Opc2);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case MRC_THUMB2:
|
||||
// MRC <coproc>,<opc1>,<Rt>,<CRn>,<CRm>,<opc2>
|
||||
coproc = (OpCode32 >> 8) & 0xf;
|
||||
opc1 = (OpCode32 >> 20) & 0xf;
|
||||
opc2 = (OpCode32 >> 5) & 0x7;
|
||||
Coproc = (OpCode32 >> 8) & 0xf;
|
||||
Opc1 = (OpCode32 >> 20) & 0xf;
|
||||
Opc2 = (OpCode32 >> 5) & 0x7;
|
||||
CRn = (OpCode32 >> 16) & 0xf;
|
||||
CRm = OpCode32 & 0xf;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " p%d,#%d,%a,c%d,c%d", coproc, opc1, gReg[Rt], CRn, CRm);
|
||||
if (opc2 != 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ",#%d,", opc2);
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " p%d,#%d,%a,c%d,c%d", Coproc, Opc1, gReg[Rt], CRn, CRm);
|
||||
if (Opc2 != 0) {
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, ",#%d,", Opc2);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case MRRC_THUMB2:
|
||||
// MRC <coproc>,<opc1>,<Rt>,<Rt2>,<CRm>,<opc2>
|
||||
coproc = (OpCode32 >> 8) & 0xf;
|
||||
opc1 = (OpCode32 >> 20) & 0xf;
|
||||
Coproc = (OpCode32 >> 8) & 0xf;
|
||||
Opc1 = (OpCode32 >> 20) & 0xf;
|
||||
CRn = (OpCode32 >> 16) & 0xf;
|
||||
CRm = OpCode32 & 0xf;
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " p%d,#%d,%a,%a,c%d", coproc, opc1, gReg[Rt], gReg[Rt2], CRm);
|
||||
Offset += AsciiSPrint (&Buf[Offset], Size - Offset, " p%d,#%d,%a,%a,c%d", Coproc, Opc1, gReg[Rt], gReg[Rt2], CRm);
|
||||
return;
|
||||
|
||||
case THUMB2_2REGS:
|
||||
@@ -998,7 +1019,7 @@ DisassembleThumbInstruction (
|
||||
case THUMB2_MSR:
|
||||
// MRS CPSR_<fields>, <Rd>
|
||||
Target = (OpCode32 >> 10) & 3;
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " CPSR_%a%a, %a", (Target & 2) == 0 ? "":"f", (Target & 1) == 0 ? "":"s", gReg[Rd]);
|
||||
AsciiSPrint (&Buf[Offset], Size - Offset, " CPSR_%a%a, %a", (Target & 2) == 0 ? "" : "f", (Target & 1) == 0 ? "" : "s", gReg[Rd]);
|
||||
return;
|
||||
|
||||
case THUMB2_NO_ARGS:
|
||||
@@ -1011,8 +1032,6 @@ DisassembleThumbInstruction (
|
||||
AsciiSPrint (Buf, Size, "0x%08x", OpCode32);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
DisassembleArmInstruction (
|
||||
IN UINT32 **OpCodePtr,
|
||||
@@ -1021,7 +1040,6 @@ DisassembleArmInstruction (
|
||||
IN BOOLEAN Extended
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to
|
||||
point to next instruction.
|
||||
@@ -1053,4 +1071,3 @@ DisassembleInstruction (
|
||||
DisassembleArmInstruction ((UINT32 **)OpCodePtr, Buf, Size, Extended);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
* Exception Handling support specific for AArch64
|
||||
*
|
||||
* Copyright (c) 2016 HP Development Company, L.P.
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
@@ -27,7 +28,8 @@ RegisterEl0Stack (
|
||||
IN VOID *Stack
|
||||
);
|
||||
|
||||
RETURN_STATUS ArchVectorConfig(
|
||||
RETURN_STATUS
|
||||
ArchVectorConfig (
|
||||
IN UINTN VectorBaseAddress
|
||||
)
|
||||
{
|
||||
@@ -38,13 +40,13 @@ RETURN_STATUS ArchVectorConfig(
|
||||
(VOID *)(((UINTN)mNewStackBase + EL0_STACK_SIZE) & ~0xFUL)
|
||||
);
|
||||
|
||||
if (ArmReadCurrentEL() == AARCH64_EL2) {
|
||||
HcrReg = ArmReadHcr();
|
||||
if (ArmReadCurrentEL () == AARCH64_EL2) {
|
||||
HcrReg = ArmReadHcr ();
|
||||
|
||||
// Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
|
||||
HcrReg |= ARM_HCR_TGE;
|
||||
|
||||
ArmWriteHcr(HcrReg);
|
||||
ArmWriteHcr (HcrReg);
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2011 - 2014 ARM LTD. All rights reserved.<BR>
|
||||
// Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
// Portion of Copyright (c) 2014 NVIDIA Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2016 HP Development Company, L.P.
|
||||
//
|
||||
@@ -200,19 +200,19 @@ ASM_PFX(SErrorSP0):
|
||||
//
|
||||
// Current EL with SPx: 0x200 - 0x380
|
||||
//
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPx_SYNC)
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPX_SYNC)
|
||||
ASM_PFX(SynchronousExceptionSPx):
|
||||
ExceptionEntry EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS, SP0
|
||||
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPx_IRQ)
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPX_IRQ)
|
||||
ASM_PFX(IrqSPx):
|
||||
ExceptionEntry EXCEPT_AARCH64_IRQ
|
||||
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPx_FIQ)
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPX_FIQ)
|
||||
ASM_PFX(FiqSPx):
|
||||
ExceptionEntry EXCEPT_AARCH64_FIQ
|
||||
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPx_SERR)
|
||||
VECTOR_ENTRY(ExceptionHandlersStart, ARM_VECTOR_CUR_SPX_SERR)
|
||||
ASM_PFX(SErrorSPx):
|
||||
ExceptionEntry EXCEPT_AARCH64_SERROR
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* Exception handling support specific for ARM
|
||||
*
|
||||
* Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
* Copyright (c) 2014, ARM Limited. All rights reserved.<BR>
|
||||
* Copyright (c) 2014 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
* Copyright (c) 2016 HP Development Company, L.P.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
@@ -26,18 +26,18 @@ PHYSICAL_ADDRESS gExceptionVectorAlignmentMask = ARM_VECTOR_TABLE_ALIGNME
|
||||
// NOTE: This code assumes vectors are ARM and not Thumb code
|
||||
UINTN gDebuggerNoHandlerValue = 0xEAFFFFFE;
|
||||
|
||||
RETURN_STATUS ArchVectorConfig(
|
||||
RETURN_STATUS
|
||||
ArchVectorConfig (
|
||||
IN UINTN VectorBaseAddress
|
||||
)
|
||||
{
|
||||
// if the vector address corresponds to high vectors
|
||||
if (VectorBaseAddress == 0xFFFF0000) {
|
||||
// set SCTLR.V to enable high vectors
|
||||
ArmSetHighVectors();
|
||||
}
|
||||
else {
|
||||
ArmSetHighVectors ();
|
||||
} else {
|
||||
// Set SCTLR.V to 0 to enable VBAR to be used
|
||||
ArmSetLowVectors();
|
||||
ArmSetLowVectors ();
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user