Compare commits
447 Commits
edk2-stabl
...
vUDK2018
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e72ffe8af | ||
|
|
89b2d05780 | ||
|
|
bc9cea5c29 | ||
|
|
d5bc5f1368 | ||
|
|
c91229c9b9 | ||
|
|
0a93e457f7 | ||
|
|
2e8ea3f20b | ||
|
|
cf54069a36 | ||
|
|
7970391e70 | ||
|
|
f67d8a58cd | ||
|
|
dfdb3625ef | ||
|
|
fa8dba9f2f | ||
|
|
c01ec8dc8f | ||
|
|
bd1c83ca51 | ||
|
|
f8237affd2 | ||
|
|
8cc5e08479 | ||
|
|
4e9d0da3ca | ||
|
|
a8fcbd0016 | ||
|
|
d051df63df | ||
|
|
8aa528c82a | ||
|
|
0e1be48bdd | ||
|
|
3570083129 | ||
|
|
f68206261d | ||
|
|
376e4ec9ac | ||
|
|
61c0fb297d | ||
|
|
ca0b3a0ef2 | ||
|
|
5af1943160 | ||
|
|
f4d825eb43 | ||
|
|
8f75e458a0 | ||
|
|
61384921e0 | ||
|
|
a508ac4b01 | ||
|
|
7e3639367e | ||
|
|
db82ec1d2f | ||
|
|
6a46ff8910 | ||
|
|
c5108f74f8 | ||
|
|
7edd705c04 | ||
|
|
81725e2278 | ||
|
|
c54db16f84 | ||
|
|
c20577b42c | ||
|
|
428d9f2825 | ||
|
|
25d984be12 | ||
|
|
2dbb81890c | ||
|
|
50274a868f | ||
|
|
70fab05654 | ||
|
|
bd8a50bac5 | ||
|
|
3d7738a3fd | ||
|
|
d223f9e697 | ||
|
|
f03a5c11bc | ||
|
|
5a4224fded | ||
|
|
4bf91b3056 | ||
|
|
3f8cd2a2b3 | ||
|
|
78a8545b8b | ||
|
|
f4e90c31d2 | ||
|
|
a2aa1d9d77 | ||
|
|
cfcb6002d8 | ||
|
|
7f3898286c | ||
|
|
524d708130 | ||
|
|
cdca0dc4a1 | ||
|
|
5ecb58bafc | ||
|
|
49e58b59c5 | ||
|
|
d7508770f9 | ||
|
|
edead44510 | ||
|
|
c2ce97ad3e | ||
|
|
02a7774295 | ||
|
|
ee528d4356 | ||
|
|
4ad2e33198 | ||
|
|
3986490ce0 | ||
|
|
be80d16679 | ||
|
|
048174c51e | ||
|
|
4a5c1b917b | ||
|
|
0dc76480ad | ||
|
|
89df7dcc82 | ||
|
|
766ee32201 | ||
|
|
921c3d11f3 | ||
|
|
5f215c812b | ||
|
|
902e44cf26 | ||
|
|
49e3ed1416 | ||
|
|
320449821c | ||
|
|
aa512b0eb4 | ||
|
|
41ba79ea1e | ||
|
|
d42b261973 | ||
|
|
74b58de20f | ||
|
|
b5fdf331cc | ||
|
|
e6deaf9dbe | ||
|
|
bb63309662 | ||
|
|
ad291ed384 | ||
|
|
58b72e10c0 | ||
|
|
63abed3519 | ||
|
|
e03c9515e1 | ||
|
|
bf042da6a0 | ||
|
|
dbc2b7698c | ||
|
|
8212084061 | ||
|
|
38cde47ec5 | ||
|
|
86445d72de | ||
|
|
7fee1fab40 | ||
|
|
c3ac218240 | ||
|
|
97cf199254 | ||
|
|
cabcd57dfe | ||
|
|
adac28f4d7 | ||
|
|
608d86b447 | ||
|
|
6be81412b3 | ||
|
|
87bc6f9bd7 | ||
|
|
a82eb50d8c | ||
|
|
e9cae1ca15 | ||
|
|
78664a7301 | ||
|
|
31c73450f7 | ||
|
|
43473e3dcd | ||
|
|
194ae4278a | ||
|
|
60a79a8871 | ||
|
|
5ee2485fc5 | ||
|
|
74ed3adde1 | ||
|
|
a48b8bd259 | ||
|
|
b7f22b334c | ||
|
|
48daa7fa24 | ||
|
|
3fca88b2b9 | ||
|
|
a763560aa6 | ||
|
|
d307a8284c | ||
|
|
b75fe39d53 | ||
|
|
71da3c9f12 | ||
|
|
15912adc0f | ||
|
|
6c524c3a70 | ||
|
|
270bc06e99 | ||
|
|
c5b32c02a4 | ||
|
|
bce451d5f3 | ||
|
|
3124cd3a36 | ||
|
|
cc476eb7ef | ||
|
|
65208a68ce | ||
|
|
dded7cddfc | ||
|
|
0fab234b80 | ||
|
|
413b649783 | ||
|
|
82caf21987 | ||
|
|
36cec4c2ba | ||
|
|
d6711a2751 | ||
|
|
8be643d1f0 | ||
|
|
ef2f5a4cb0 | ||
|
|
342865cd61 | ||
|
|
50c1780c3b | ||
|
|
91de220b8d | ||
|
|
cdfc829893 | ||
|
|
5d5add96c8 | ||
|
|
7ed77269fb | ||
|
|
fe7c413c90 | ||
|
|
9f2696e487 | ||
|
|
bae94d0a6b | ||
|
|
4d5b86ca83 | ||
|
|
369e0bc4a1 | ||
|
|
8ed0f5f188 | ||
|
|
1a7e6a252e | ||
|
|
9a47d8a3d4 | ||
|
|
4347b17b96 | ||
|
|
529973681c | ||
|
|
6754622171 | ||
|
|
d0cd330069 | ||
|
|
675e75c591 | ||
|
|
85767a590c | ||
|
|
7a718a2537 | ||
|
|
9aea281020 | ||
|
|
04da8cbd1f | ||
|
|
cf7481e2f6 | ||
|
|
a694289ba9 | ||
|
|
6cc21aa625 | ||
|
|
a46b556690 | ||
|
|
ece2cc8ed7 | ||
|
|
40c6dc594e | ||
|
|
b59d1dabd3 | ||
|
|
4eb8a350c6 | ||
|
|
eca073d92f | ||
|
|
602d05c5ee | ||
|
|
315184d135 | ||
|
|
2408ef3317 | ||
|
|
b73df32873 | ||
|
|
166be39c8d | ||
|
|
99239d7098 | ||
|
|
87b7caf67c | ||
|
|
2d1a8a008f | ||
|
|
ada0c62e24 | ||
|
|
6740ed2219 | ||
|
|
e88e191cde | ||
|
|
e7e98746b1 | ||
|
|
49a776c9ad | ||
|
|
71d920beec | ||
|
|
db8cd726bc | ||
|
|
3192b349c9 | ||
|
|
3827af5e5c | ||
|
|
6c5ffada1f | ||
|
|
d1e9cbacb8 | ||
|
|
8b501e7138 | ||
|
|
472f866bac | ||
|
|
8ed7b6d57d | ||
|
|
a1011d6445 | ||
|
|
635bf4f0a3 | ||
|
|
c0ed99b306 | ||
|
|
dccb8d991d | ||
|
|
a59c401089 | ||
|
|
acd7a8a637 | ||
|
|
471a089bd3 | ||
|
|
f3b9b98827 | ||
|
|
27a8608eaa | ||
|
|
b39c572e70 | ||
|
|
7d675727fa | ||
|
|
b7bb3bcbdf | ||
|
|
9b2fbbeed5 | ||
|
|
d0abf8cace | ||
|
|
51dc9dc1b0 | ||
|
|
134f708957 | ||
|
|
f727cdad8d | ||
|
|
2879864592 | ||
|
|
43cfd6a831 | ||
|
|
fe71cd7948 | ||
|
|
917cb49e14 | ||
|
|
e21ccea66d | ||
|
|
19140b37c3 | ||
|
|
9d02c4b101 | ||
|
|
22af60ef0c | ||
|
|
5d10c5a3a1 | ||
|
|
165e857d99 | ||
|
|
b638171f67 | ||
|
|
d8fd99b903 | ||
|
|
20f8e6aad6 | ||
|
|
ecb4b8a61d | ||
|
|
6a6e61d427 | ||
|
|
e8e1dc3cbc | ||
|
|
019c7b79a6 | ||
|
|
b61e257fe8 | ||
|
|
54d960ebf9 | ||
|
|
9bec5aed4f | ||
|
|
768e193eb4 | ||
|
|
c376e657c2 | ||
|
|
7423a64227 | ||
|
|
44fa08ab7c | ||
|
|
c1ec9d0194 | ||
|
|
1c65ddbf24 | ||
|
|
3885ffd841 | ||
|
|
068b00d7da | ||
|
|
dfea53f000 | ||
|
|
aa2c146bb2 | ||
|
|
5508504e23 | ||
|
|
82a4f0cf4e | ||
|
|
3b5e8efa46 | ||
|
|
cd59051481 | ||
|
|
6908dd1655 | ||
|
|
f4aaa6f2ae | ||
|
|
abb0427276 | ||
|
|
2504544636 | ||
|
|
7fa431ea7f | ||
|
|
c46ac8ca03 | ||
|
|
810bf8c328 | ||
|
|
ffa1916276 | ||
|
|
12204aa47f | ||
|
|
deaaaa9364 | ||
|
|
9730ca2d50 | ||
|
|
393908e084 | ||
|
|
9fd71feb30 | ||
|
|
ce58945513 | ||
|
|
a8809711ba | ||
|
|
24c4086758 | ||
|
|
b6eef092f6 | ||
|
|
ed536b27f1 | ||
|
|
b38d570423 | ||
|
|
c5c0f5e23c | ||
|
|
a55e485723 | ||
|
|
e4de673b54 | ||
|
|
bfb539c101 | ||
|
|
5e69443e82 | ||
|
|
1de7f6464a | ||
|
|
fde92af67d | ||
|
|
cb3a39107e | ||
|
|
4dfaf65c8c | ||
|
|
c71d8cc19a | ||
|
|
1285ca0a27 | ||
|
|
ec37c40e5f | ||
|
|
4fa13b6957 | ||
|
|
3f251a864a | ||
|
|
1a8a1978ea | ||
|
|
e8bfb85874 | ||
|
|
910e904d9c | ||
|
|
b2b7bff4db | ||
|
|
217f8c5912 | ||
|
|
48aa7b264e | ||
|
|
a919bfcd28 | ||
|
|
f9697b7634 | ||
|
|
e21f0bddef | ||
|
|
96fc62864e | ||
|
|
cac4da695e | ||
|
|
22efda70bb | ||
|
|
fc15259c5e | ||
|
|
1a908b736a | ||
|
|
bc32f1b0fa | ||
|
|
ef4864d8d9 | ||
|
|
b90f32046f | ||
|
|
4672455e80 | ||
|
|
b650d6da4e | ||
|
|
f15dd88d04 | ||
|
|
cd4ae3e155 | ||
|
|
2946f624a5 | ||
|
|
57d1436760 | ||
|
|
157bfbda78 | ||
|
|
14553a2e5d | ||
|
|
1ed328a0d7 | ||
|
|
c4e2b684d2 | ||
|
|
c14a1acf9e | ||
|
|
fde36f597e | ||
|
|
b0821b18eb | ||
|
|
1bc6e00bb1 | ||
|
|
2bf01a60be | ||
|
|
9ca7351cec | ||
|
|
83d6fe4156 | ||
|
|
bf5d5af234 | ||
|
|
292241519f | ||
|
|
672629b214 | ||
|
|
3547f62336 | ||
|
|
6d005df6f7 | ||
|
|
c99948a2d1 | ||
|
|
c0c7e24862 | ||
|
|
07a6b195e7 | ||
|
|
3ab4e71ce7 | ||
|
|
8e6dff048a | ||
|
|
67a282e0cd | ||
|
|
1bfcdd264a | ||
|
|
15bb108d5f | ||
|
|
0bc9d2d64a | ||
|
|
77ba92a2ad | ||
|
|
4fe6697310 | ||
|
|
dfb02fb2cd | ||
|
|
b0978b5733 | ||
|
|
75b525e0e2 | ||
|
|
3992cba4f0 | ||
|
|
2b5c3808f5 | ||
|
|
dea2caf4b9 | ||
|
|
7be94525b8 | ||
|
|
82e0348c77 | ||
|
|
7070817c36 | ||
|
|
a76ff42a3b | ||
|
|
f6b2f35191 | ||
|
|
4420eee99f | ||
|
|
09759b282b | ||
|
|
37300101db | ||
|
|
e6aea36c3a | ||
|
|
34fa6fe307 | ||
|
|
fe5adb77df | ||
|
|
7ce3491760 | ||
|
|
a46544a8b0 | ||
|
|
4fd863634a | ||
|
|
79e67b2967 | ||
|
|
eae0c9e2df | ||
|
|
b4cb082f12 | ||
|
|
da98ddb057 | ||
|
|
0f650f4735 | ||
|
|
e145a3eb02 | ||
|
|
1fd5d06c72 | ||
|
|
c740cc2aeb | ||
|
|
31deb5f2f6 | ||
|
|
dfe7067a3f | ||
|
|
c0565b7ae7 | ||
|
|
484841f816 | ||
|
|
38b5e31e0e | ||
|
|
7540b23a0e | ||
|
|
280997bcfa | ||
|
|
e01d69c659 | ||
|
|
0b1d2b08f2 | ||
|
|
42871887be | ||
|
|
53c9a3c746 | ||
|
|
c5db839aa4 | ||
|
|
0d0adb6206 | ||
|
|
aa722ab271 | ||
|
|
b82655fe20 | ||
|
|
194a398db0 | ||
|
|
9bebced571 | ||
|
|
ae665c4fa1 | ||
|
|
ba5a29b790 | ||
|
|
cd4b3c9004 | ||
|
|
6cb913e09b | ||
|
|
feb9b8fe52 | ||
|
|
5070c3f408 | ||
|
|
b6c446b77e | ||
|
|
ce45421cb6 | ||
|
|
a6f4c90a05 | ||
|
|
20e16af964 | ||
|
|
1378dd73eb | ||
|
|
a5f3470200 | ||
|
|
8639f8f74e | ||
|
|
5bf7864b8c | ||
|
|
8ceccce6cd | ||
|
|
221ec8fe8f | ||
|
|
a1683b9efd | ||
|
|
f910c3b290 | ||
|
|
c7585c861c | ||
|
|
4f50b16caa | ||
|
|
32685c2040 | ||
|
|
57bcc39da2 | ||
|
|
a23808f09d | ||
|
|
472c2834e9 | ||
|
|
4114569b07 | ||
|
|
5f2e08e40a | ||
|
|
7065b59990 | ||
|
|
afa9d3959d | ||
|
|
c41d8c62f2 | ||
|
|
4dd49c1907 | ||
|
|
9bdb89e8ba | ||
|
|
e2cef60f80 | ||
|
|
8d129948e9 | ||
|
|
96facbf773 | ||
|
|
237bc205b8 | ||
|
|
fbeacd6c2e | ||
|
|
6f5c108a54 | ||
|
|
a908ec6d17 | ||
|
|
e4f03dac7d | ||
|
|
a721de0d00 | ||
|
|
d660c7868a | ||
|
|
26a58bbd36 | ||
|
|
ddec61f2a0 | ||
|
|
26f4998c74 | ||
|
|
84a7c3b270 | ||
|
|
102117a7d0 | ||
|
|
a337c6e311 | ||
|
|
69fabe97be | ||
|
|
28f0a65a4b | ||
|
|
4c33ac7a72 | ||
|
|
4276a38532 | ||
|
|
e10986608c | ||
|
|
7595e9e14c | ||
|
|
20c436f729 | ||
|
|
5ef439ae08 | ||
|
|
02f4147f02 | ||
|
|
4a4fe8f63e | ||
|
|
8cc5355693 | ||
|
|
8776b1ba58 | ||
|
|
b4498caada | ||
|
|
db269dae16 | ||
|
|
e4a45bb8b2 | ||
|
|
667fdaaac8 | ||
|
|
d22bce7905 | ||
|
|
49070f3bd3 | ||
|
|
ffa44f7b87 | ||
|
|
73001d1c98 | ||
|
|
d811a6d681 | ||
|
|
3c9184534e | ||
|
|
ebcee41c32 | ||
|
|
6f992a1cd4 | ||
|
|
010097b08c | ||
|
|
f04d0a9ad7 | ||
|
|
66ce5b6787 | ||
|
|
2bd5224c01 | ||
|
|
7412c459f8 | ||
|
|
fc0eeeb5c7 | ||
|
|
012f4ed508 | ||
|
|
a9f96b0513 |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "CryptoPkg/Library/OpensslLib/openssl"]
|
||||||
|
path = CryptoPkg/Library/OpensslLib/openssl
|
||||||
|
url = https://github.com/openssl/openssl
|
||||||
@@ -307,13 +307,12 @@
|
|||||||
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
# FAT filesystem + GPT/MBR partitioning
|
||||||
#
|
#
|
||||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||||
FatPkg/EnhancedFatDxe/Fat.inf
|
FatPkg/EnhancedFatDxe/Fat.inf
|
||||||
MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bds
|
# Bds
|
||||||
|
|||||||
@@ -83,13 +83,12 @@ READ_LOCK_STATUS = TRUE
|
|||||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
# FAT filesystem + GPT/MBR partitioning
|
||||||
#
|
#
|
||||||
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||||
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||||
INF FatPkg/EnhancedFatDxe/Fat.inf
|
INF FatPkg/EnhancedFatDxe/Fat.inf
|
||||||
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||||
INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Platform Driver
|
# Platform Driver
|
||||||
|
|||||||
@@ -296,13 +296,12 @@
|
|||||||
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
# FAT filesystem + GPT/MBR partitioning
|
||||||
#
|
#
|
||||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||||
FatPkg/EnhancedFatDxe/Fat.inf
|
FatPkg/EnhancedFatDxe/Fat.inf
|
||||||
MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bds
|
# Bds
|
||||||
|
|||||||
@@ -194,13 +194,12 @@
|
|||||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
# FAT filesystem + GPT/MBR partitioning
|
||||||
#
|
#
|
||||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||||
FatPkg/EnhancedFatDxe/Fat.inf
|
FatPkg/EnhancedFatDxe/Fat.inf
|
||||||
MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bds
|
# Bds
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ READ_LOCK_STATUS = TRUE
|
|||||||
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||||
INF FatPkg/EnhancedFatDxe/Fat.inf
|
INF FatPkg/EnhancedFatDxe/Fat.inf
|
||||||
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||||
INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# UEFI application (Shell Embedded Boot Loader)
|
# UEFI application (Shell Embedded Boot Loader)
|
||||||
|
|||||||
29
BaseTools/BinWrappers/PosixLike/DevicePath
Executable file
29
BaseTools/BinWrappers/PosixLike/DevicePath
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
|
||||||
|
dir=$(dirname "$full_cmd")
|
||||||
|
cmd=${full_cmd##*/}
|
||||||
|
|
||||||
|
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
|
||||||
|
then
|
||||||
|
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
|
||||||
|
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
|
||||||
|
then
|
||||||
|
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
|
||||||
|
then
|
||||||
|
echo "BaseTools C Tool binary was not found ($cmd)"
|
||||||
|
echo "You may need to run:"
|
||||||
|
echo " make -C $EDK_TOOLS_PATH/Source/C"
|
||||||
|
else
|
||||||
|
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
|
||||||
|
fi
|
||||||
|
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
|
||||||
|
then
|
||||||
|
exec "$dir/../../Source/C/bin/$cmd" "$@"
|
||||||
|
else
|
||||||
|
echo "Unable to find the real '$cmd' to run"
|
||||||
|
echo "This message was printed by"
|
||||||
|
echo " $0"
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -182,7 +182,6 @@
|
|||||||
|
|
||||||
<Command>
|
<Command>
|
||||||
|
|
||||||
|
|
||||||
[Assembly-Code-File.COMMON.COMMON]
|
[Assembly-Code-File.COMMON.COMMON]
|
||||||
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
|
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
|
||||||
?.asm, ?.Asm, ?.ASM
|
?.asm, ?.Asm, ?.ASM
|
||||||
@@ -207,6 +206,36 @@
|
|||||||
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
|
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
|
||||||
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
|
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
|
||||||
|
|
||||||
|
[Assembly-Code-File.COMMON.ARM]
|
||||||
|
# Remove --convert-hex for ARM as it breaks MSFT assemblers
|
||||||
|
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
|
||||||
|
?.asm, ?.Asm, ?.ASM
|
||||||
|
|
||||||
|
<InputFile.GCC, InputFile.GCCLD>
|
||||||
|
?.S, ?.s
|
||||||
|
|
||||||
|
<ExtraDependency>
|
||||||
|
$(MAKE_FILE)
|
||||||
|
|
||||||
|
<OutputFile>
|
||||||
|
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
|
||||||
|
|
||||||
|
<Command.INTEL>
|
||||||
|
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
|
||||||
|
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
|
||||||
|
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
|
||||||
|
|
||||||
|
<Command.MSFT>
|
||||||
|
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
|
||||||
|
Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
|
||||||
|
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
|
||||||
|
|
||||||
|
<Command.GCC, Command.GCCLD, Command.RVCT>
|
||||||
|
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
|
||||||
|
Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
|
||||||
|
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
|
||||||
|
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
|
||||||
|
|
||||||
[Nasm-Assembly-Code-File.COMMON.COMMON]
|
[Nasm-Assembly-Code-File.COMMON.COMMON]
|
||||||
<InputFile>
|
<InputFile>
|
||||||
?.nasm
|
?.nasm
|
||||||
@@ -249,8 +278,8 @@
|
|||||||
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb
|
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb
|
||||||
|
|
||||||
<Command.GCC>
|
<Command.GCC>
|
||||||
"$(PP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
|
"$(DTCPP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
|
||||||
"$(DTC)" -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i
|
"$(DTC)" $(DTC_FLAGS) -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i
|
||||||
|
|
||||||
[Visual-Form-Representation-File]
|
[Visual-Form-Representation-File]
|
||||||
<InputFile>
|
<InputFile>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -59,10 +59,14 @@ TOOL_CHAIN_CONF = Conf/tools_def.txt
|
|||||||
# used for the build. The list uses space character separation.
|
# used for the build. The list uses space character separation.
|
||||||
TOOL_CHAIN_TAG = MYTOOLS
|
TOOL_CHAIN_TAG = MYTOOLS
|
||||||
|
|
||||||
# MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent threads. Recommend to set this
|
# MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent threads. If not specified or set
|
||||||
# value to one more than the number of your compurter
|
# to zero, tool automatically detect number of processor
|
||||||
# cores or CPUs. Less than 2 means disable multithread build.
|
# threads. Recommend to set this value to one less than the
|
||||||
MAX_CONCURRENT_THREAD_NUMBER = 1
|
# number of your computer cores or CPUs. When value set to 1,
|
||||||
|
# means disable multi-thread build, value set to more than 1,
|
||||||
|
# means user specify the thread number to build. Not specify
|
||||||
|
# the default value in this file.
|
||||||
|
# MAX_CONCURRENT_THREAD_NUMBER = 1
|
||||||
|
|
||||||
|
|
||||||
# BUILD_RULE_CONF Filename Optional Specify the file name to use for the build rules that are followed
|
# BUILD_RULE_CONF Filename Optional Specify the file name to use for the build rules that are followed
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
# Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
# Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||||
# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>
|
# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>
|
||||||
@@ -79,6 +79,7 @@ DEFINE VS2017_HOST = x86
|
|||||||
DEFINE VS2017_BIN_HOST = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\DEF(VS2017_HOST)
|
DEFINE VS2017_BIN_HOST = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\DEF(VS2017_HOST)
|
||||||
DEFINE VS2017_BIN_IA32 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x86
|
DEFINE VS2017_BIN_IA32 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x86
|
||||||
DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x64
|
DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x64
|
||||||
|
DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm
|
||||||
|
|
||||||
DEFINE WINSDK_BIN = ENV(WINSDK_PREFIX)
|
DEFINE WINSDK_BIN = ENV(WINSDK_PREFIX)
|
||||||
DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
|
DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
|
||||||
@@ -236,6 +237,7 @@ DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Develope
|
|||||||
|
|
||||||
DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin
|
DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin
|
||||||
|
|
||||||
|
DEFINE DTCPP_BIN = ENV(DTCPP_PREFIX)cpp
|
||||||
DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
|
DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
|
||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
@@ -335,6 +337,9 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
|
|||||||
# Required to build platforms or ACPI tables:
|
# Required to build platforms or ACPI tables:
|
||||||
# Intel(r) ACPI Compiler (iasl.exe) from
|
# Intel(r) ACPI Compiler (iasl.exe) from
|
||||||
# https://acpica.org/downloads
|
# https://acpica.org/downloads
|
||||||
|
# Note:
|
||||||
|
# Building of XIP firmware images for ARM is not currently supported (only applications).
|
||||||
|
# /FILEALIGN:4096 and other changes are needed for ARM firmware builds.
|
||||||
# DDK3790 -win32- Requires:
|
# DDK3790 -win32- Requires:
|
||||||
# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
|
# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
|
||||||
# Optional:
|
# Optional:
|
||||||
@@ -4169,6 +4174,33 @@ NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
|
|||||||
RELEASE_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
|
RELEASE_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
|
||||||
NOOPT_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
|
NOOPT_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
|
||||||
|
|
||||||
|
#################
|
||||||
|
# ARM definitions
|
||||||
|
#################
|
||||||
|
*_VS2017_ARM_CC_PATH = DEF(VS2017_BIN_ARM)\cl.exe
|
||||||
|
*_VS2017_ARM_VFRPP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
|
||||||
|
*_VS2017_ARM_SLINK_PATH = DEF(VS2017_BIN_ARM)\lib.exe
|
||||||
|
*_VS2017_ARM_DLINK_PATH = DEF(VS2017_BIN_ARM)\link.exe
|
||||||
|
*_VS2017_ARM_APP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
|
||||||
|
*_VS2017_ARM_PP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
|
||||||
|
*_VS2017_ARM_ASM_PATH = DEF(VS2017_BIN_ARM)\armasm.exe
|
||||||
|
*_VS2017_ARM_ASLCC_PATH = DEF(VS2017_BIN_ARM)\cl.exe
|
||||||
|
*_VS2017_ARM_ASLPP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
|
||||||
|
*_VS2017_ARM_ASLDLINK_PATH = DEF(VS2017_BIN_ARM)\link.exe
|
||||||
|
|
||||||
|
*_VS2017_ARM_MAKE_FLAGS = /nologo
|
||||||
|
DEBUG_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Gw /Oi-
|
||||||
|
RELEASE_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
|
||||||
|
NOOPT_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od /Oi-
|
||||||
|
|
||||||
|
DEBUG_VS2017_ARM_ASM_FLAGS = /nologo /g
|
||||||
|
RELEASE_VS2017_ARM_ASM_FLAGS = /nologo
|
||||||
|
NOOPT_VS2017_ARM_ASM_FLAGS = /nologo
|
||||||
|
|
||||||
|
DEBUG_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
|
||||||
|
RELEASE_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
|
||||||
|
NOOPT_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# EBC definitions
|
# EBC definitions
|
||||||
##################
|
##################
|
||||||
@@ -4467,6 +4499,9 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF
|
|||||||
DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
|
DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
|
||||||
RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG =
|
RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG =
|
||||||
NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
|
NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
|
||||||
|
*_*_*_DTC_FLAGS = -H epapr
|
||||||
|
*_*_*_DTCPP_PATH = DEF(DTCPP_BIN)
|
||||||
|
*_*_*_DTC_PATH = DEF(DTC_BIN)
|
||||||
|
|
||||||
DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
|
DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
|
||||||
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
|
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
|
||||||
@@ -4880,7 +4915,6 @@ RELEASE_GCC45_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS) -Os
|
|||||||
*_GCC46_*_MAKE_PATH = DEF(GCC46_IA32_PREFIX)make
|
*_GCC46_*_MAKE_PATH = DEF(GCC46_IA32_PREFIX)make
|
||||||
*_GCC46_*_*_DLL = ENV(GCC46_DLL)
|
*_GCC46_*_*_DLL = ENV(GCC46_DLL)
|
||||||
*_GCC46_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_GCC46_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_GCC46_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_GCC46_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
*_GCC46_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
||||||
*_GCC46_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
*_GCC46_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
||||||
@@ -4991,7 +5025,6 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v
|
|||||||
*_GCC47_*_MAKE_PATH = DEF(GCC47_IA32_PREFIX)make
|
*_GCC47_*_MAKE_PATH = DEF(GCC47_IA32_PREFIX)make
|
||||||
*_GCC47_*_*_DLL = ENV(GCC47_DLL)
|
*_GCC47_*_*_DLL = ENV(GCC47_DLL)
|
||||||
*_GCC47_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_GCC47_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_GCC47_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_GCC47_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
*_GCC47_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
||||||
*_GCC47_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
*_GCC47_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
||||||
@@ -5131,7 +5164,6 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
|
|||||||
*_GCC48_*_MAKE_PATH = DEF(GCC48_IA32_PREFIX)make
|
*_GCC48_*_MAKE_PATH = DEF(GCC48_IA32_PREFIX)make
|
||||||
*_GCC48_*_*_DLL = ENV(GCC48_DLL)
|
*_GCC48_*_*_DLL = ENV(GCC48_DLL)
|
||||||
*_GCC48_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_GCC48_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_GCC48_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_GCC48_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
*_GCC48_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
||||||
*_GCC48_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
*_GCC48_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
||||||
@@ -5271,7 +5303,6 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
|
|||||||
*_GCC49_*_MAKE_PATH = DEF(GCC49_IA32_PREFIX)make
|
*_GCC49_*_MAKE_PATH = DEF(GCC49_IA32_PREFIX)make
|
||||||
*_GCC49_*_*_DLL = ENV(GCC49_DLL)
|
*_GCC49_*_*_DLL = ENV(GCC49_DLL)
|
||||||
*_GCC49_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_GCC49_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_GCC49_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_GCC49_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
*_GCC49_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
||||||
*_GCC49_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
*_GCC49_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
||||||
@@ -5417,7 +5448,6 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
|
|||||||
*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make
|
*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make
|
||||||
*_GCC5_*_*_DLL = ENV(GCC5_DLL)
|
*_GCC5_*_*_DLL = ENV(GCC5_DLL)
|
||||||
*_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_GCC5_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
*_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
||||||
*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
|
||||||
@@ -5574,7 +5604,6 @@ RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(W
|
|||||||
*_CLANG35_*_MAKE_PATH = make
|
*_CLANG35_*_MAKE_PATH = make
|
||||||
*_CLANG35_*_*_DLL = ENV(CLANG35_DLL)
|
*_CLANG35_*_*_DLL = ENV(CLANG35_DLL)
|
||||||
*_CLANG35_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_CLANG35_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_CLANG35_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_CLANG35_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
*_CLANG35_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
|
||||||
*_CLANG35_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
|
*_CLANG35_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
|
||||||
@@ -5595,7 +5624,7 @@ RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(W
|
|||||||
DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabihf
|
DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabihf
|
||||||
DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu
|
DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu
|
||||||
|
|
||||||
DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body
|
DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unknown-warning-option
|
||||||
DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) DEF(CLANG35_WARNING_OVERRIDES)
|
DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) DEF(CLANG35_WARNING_OVERRIDES)
|
||||||
DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
|
DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
|
||||||
|
|
||||||
@@ -5652,7 +5681,6 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
|
|||||||
*_CLANG38_*_MAKE_PATH = make
|
*_CLANG38_*_MAKE_PATH = make
|
||||||
*_CLANG38_*_*_DLL = ENV(CLANG38_DLL)
|
*_CLANG38_*_*_DLL = ENV(CLANG38_DLL)
|
||||||
*_CLANG38_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
*_CLANG38_*_ASL_PATH = DEF(UNIX_IASL_BIN)
|
||||||
*_CLANG38_*_DTC_PATH = DEF(DTC_BIN)
|
|
||||||
|
|
||||||
*_CLANG38_*_APP_FLAGS =
|
*_CLANG38_*_APP_FLAGS =
|
||||||
*_CLANG38_*_ASL_FLAGS = DEF(IASL_FLAGS)
|
*_CLANG38_*_ASL_FLAGS = DEF(IASL_FLAGS)
|
||||||
@@ -5664,8 +5692,8 @@ DEFINE CLANG38_X64_PREFIX = ENV(CLANG38_BIN)
|
|||||||
DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu
|
DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu
|
||||||
DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu
|
DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu
|
||||||
|
|
||||||
DEFINE CLANG38_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs
|
DEFINE CLANG38_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option
|
||||||
DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-unknown-warning-option
|
DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# CLANG38 IA32 definitions
|
# CLANG38 IA32 definitions
|
||||||
@@ -7500,7 +7528,6 @@ NOOPT_MYTOOLS_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
|
|||||||
|
|
||||||
*_XCODE5_*_*_FAMILY = GCC
|
*_XCODE5_*_*_FAMILY = GCC
|
||||||
*_XCODE5_*_*_BUILDRULEFAMILY = XCODE
|
*_XCODE5_*_*_BUILDRULEFAMILY = XCODE
|
||||||
*_XCODE5_*_*_BUILDRULEORDER = S s nasm
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# use xcode-select to change Xcode version of command line tools
|
# use xcode-select to change Xcode version of command line tools
|
||||||
@@ -7550,9 +7577,9 @@ RELEASE_XCODE5_IA32_ASM_FLAGS = -arch i386
|
|||||||
*_XCODE5_IA32_NASM_FLAGS = -f macho32
|
*_XCODE5_IA32_NASM_FLAGS = -f macho32
|
||||||
|
|
||||||
|
|
||||||
DEBUG_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
|
DEBUG_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
|
||||||
RELEASE_XCODE5_IA32_CC_FLAGS = -arch i386 -c -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
|
RELEASE_XCODE5_IA32_CC_FLAGS = -arch i386 -c -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -Wno-unused-const-variable -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
|
||||||
NOOPT_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -O0 -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
|
NOOPT_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -O0 -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# X64 definitions
|
# X64 definitions
|
||||||
@@ -7569,9 +7596,9 @@ RELEASE_XCODE5_X64_ASM_FLAGS = -arch x86_64
|
|||||||
*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
|
*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
|
||||||
*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
||||||
|
|
||||||
DEBUG_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
|
DEBUG_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
|
||||||
NOOPT_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -O0 -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
|
NOOPT_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -O0 -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
|
||||||
RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
|
RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -Wno-unused-const-variable -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
|
||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
#
|
#
|
||||||
|
|||||||
19
BaseTools/Scripts/PackageDocumentTools/Readme.md
Normal file
19
BaseTools/Scripts/PackageDocumentTools/Readme.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Prerequisite Tools:
|
||||||
|
1. Install Python 2.7.3 from https://www.python.org/download/releases/2.7.3/
|
||||||
|
2. Install wxPython 2.8.12.1 from https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
|
||||||
|
generally the libraries will be installed at python's subfolder, for example in windows: c:\python27\Lib\site-packages\
|
||||||
|
3. Install DoxyGen 1.8.6 from https://sourceforge.net/projects/doxygen/files/rel-1.8.6/
|
||||||
|
4. (Windows only) Install Htmlhelp tool from https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985(v=vs.85).aspx
|
||||||
|
|
||||||
|
Limitation:
|
||||||
|
1. Current tool doesn't work on latest wxPython and DoxyGen tool. Please use the sepecific version in above.
|
||||||
|
|
||||||
|
Run the Tool:
|
||||||
|
a) Run with GUI:
|
||||||
|
1. Enter src folder, double click "packagedocapp.pyw" or run command "python packagedocapp.pyw" to open the GUI.
|
||||||
|
2. Make sure all the information in blank are correct.
|
||||||
|
3. Click "Generate Package Document!"
|
||||||
|
b) Run with command line:
|
||||||
|
1. Open command line window
|
||||||
|
2. Enter src folder, for example: "cd C:\PackageDocumentTools\src"
|
||||||
|
3. Run "python packagedoc_cli.py --help" for detail command.
|
||||||
12
BaseTools/Scripts/PackageDocumentTools/__init__.py
Normal file
12
BaseTools/Scripts/PackageDocumentTools/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
429
BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
Normal file
429
BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
Normal file
@@ -0,0 +1,429 @@
|
|||||||
|
## @file
|
||||||
|
# This module provide command line entry for generating package document!
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import os, sys, logging, traceback, subprocess
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
import plugins.EdkPlugins.edk2.model.baseobject as baseobject
|
||||||
|
import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen
|
||||||
|
|
||||||
|
gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER',
|
||||||
|
'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS',
|
||||||
|
'IA32_GNU' : 'MDE_CPU_IA32 __GNUC__',
|
||||||
|
'X64_MSFT' : 'MDE_CPU_X64 _MSC_EXTENSIONS ASM_PFX= OPTIONAL= ',
|
||||||
|
'X64_GNU' : 'MDE_CPU_X64 __GNUC__ ASM_PFX= OPTIONAL= ',
|
||||||
|
'IPF_MSFT' : 'MDE_CPU_IPF _MSC_EXTENSIONS ASM_PFX= OPTIONAL= ',
|
||||||
|
'IPF_GNU' : 'MDE_CPU_IPF __GNUC__ ASM_PFX= OPTIONAL= ',
|
||||||
|
'EBC_INTEL': 'MDE_CPU_EBC __INTEL_COMPILER ASM_PFX= OPTIONAL= '}
|
||||||
|
|
||||||
|
def parseCmdArgs():
|
||||||
|
parser = OptionParser(version="Package Document Generation Tools - Version 0.1")
|
||||||
|
parser.add_option('-w', '--workspace', action='store', type='string', dest='WorkspacePath',
|
||||||
|
help='Specify workspace absolute path. For example: c:\\tianocore')
|
||||||
|
parser.add_option('-p', '--decfile', action='store', dest='PackagePath',
|
||||||
|
help='Specify the absolute path for package DEC file. For example: c:\\tianocore\\MdePkg\\MdePkg.dec')
|
||||||
|
parser.add_option('-x', '--doxygen', action='store', dest='DoxygenPath',
|
||||||
|
help='Specify the absolute path of doxygen tools installation. For example: C:\\Program Files\\doxygen\bin\doxygen.exe')
|
||||||
|
parser.add_option('-o', '--output', action='store', dest='OutputPath',
|
||||||
|
help='Specify the document output path. For example: c:\\docoutput')
|
||||||
|
parser.add_option('-a', '--arch', action='store', dest='Arch', choices=gArchMarcoDict.keys(),
|
||||||
|
help='Specify the architecture used in preprocess package\'s source. For example: -a IA32_MSFT')
|
||||||
|
parser.add_option('-m', '--mode', action='store', dest='DocumentMode', choices=['CHM', 'HTML'],
|
||||||
|
help='Specify the document mode from : CHM or HTML')
|
||||||
|
parser.add_option('-i', '--includeonly', action='store_true', dest='IncludeOnly',
|
||||||
|
help='Only generate document for package\'s public interfaces produced by include folder. ')
|
||||||
|
parser.add_option('-c', '--htmlworkshop', dest='HtmlWorkshopPath',
|
||||||
|
help='Specify the absolute path for Microsoft HTML Workshop\'s hhc.exe file. For example: C:\\Program Files\\HTML Help Workshop\\hhc.exe')
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
# validate the options
|
||||||
|
errors = []
|
||||||
|
if options.WorkspacePath == None:
|
||||||
|
errors.append('- Please specify workspace path via option -w!')
|
||||||
|
elif not os.path.exists(options.WorkspacePath):
|
||||||
|
errors.append("- Invalid workspace path %s! The workspace path should be exist in absolute path!" % options.WorkspacePath)
|
||||||
|
|
||||||
|
if options.PackagePath == None:
|
||||||
|
errors.append('- Please specify package DEC file path via option -p!')
|
||||||
|
elif not os.path.exists(options.PackagePath):
|
||||||
|
errors.append("- Invalid package's DEC file path %s! The DEC path should be exist in absolute path!" % options.PackagePath)
|
||||||
|
|
||||||
|
default = "C:\\Program Files\\doxygen\\bin\\doxygen.exe"
|
||||||
|
if options.DoxygenPath == None:
|
||||||
|
if os.path.exists(default):
|
||||||
|
print "Warning: Assume doxygen tool is installed at %s. If not, please specify via -x" % default
|
||||||
|
options.DoxygenPath = default
|
||||||
|
else:
|
||||||
|
errors.append('- Please specify the path of doxygen tool installation via option -x! or install it in default path %s' % default)
|
||||||
|
elif not os.path.exists(options.DoxygenPath):
|
||||||
|
errors.append("- Invalid doxygen tool path %s! The doxygen tool path should be exist in absolute path!" % options.DoxygenPath)
|
||||||
|
|
||||||
|
if options.OutputPath != None:
|
||||||
|
if not os.path.exists(options.OutputPath):
|
||||||
|
# create output
|
||||||
|
try:
|
||||||
|
os.makedirs(options.OutputPath)
|
||||||
|
except:
|
||||||
|
errors.append('- Fail to create the output directory %s' % options.OutputPath)
|
||||||
|
else:
|
||||||
|
if options.PackagePath != None and os.path.exists(options.PackagePath):
|
||||||
|
dirpath = os.path.dirname(options.PackagePath)
|
||||||
|
default = os.path.join (dirpath, "Document")
|
||||||
|
print 'Warning: Assume document output at %s. If not, please specify via option -o' % default
|
||||||
|
options.OutputPath = default
|
||||||
|
if not os.path.exists(default):
|
||||||
|
try:
|
||||||
|
os.makedirs(default)
|
||||||
|
except:
|
||||||
|
errors.append('- Fail to create default output directory %s! Please specify document output diretory via option -o' % default)
|
||||||
|
else:
|
||||||
|
errors.append('- Please specify document output path via option -o!')
|
||||||
|
|
||||||
|
if options.Arch == None:
|
||||||
|
options.Arch = 'ALL'
|
||||||
|
print "Warning: Assume arch is \"ALL\". If not, specify via -a"
|
||||||
|
|
||||||
|
if options.DocumentMode == None:
|
||||||
|
options.DocumentMode = "HTML"
|
||||||
|
print "Warning: Assume document mode is \"HTML\". If not, specify via -m"
|
||||||
|
|
||||||
|
if options.IncludeOnly == None:
|
||||||
|
options.IncludeOnly = False
|
||||||
|
print "Warning: Assume generate package document for all package\'s source including publich interfaces and implementation libraries and modules."
|
||||||
|
|
||||||
|
if options.DocumentMode.lower() == 'chm':
|
||||||
|
default = "C:\\Program Files\\HTML Help Workshop\\hhc.exe"
|
||||||
|
if options.HtmlWorkshopPath == None:
|
||||||
|
if os.path.exists(default):
|
||||||
|
print 'Warning: Assume the installation path of Microsoft HTML Workshop is %s. If not, specify via option -c.' % default
|
||||||
|
options.HtmlWorkshopPath = default
|
||||||
|
else:
|
||||||
|
errors.append('- Please specify the installation path of Microsoft HTML Workshop via option -c!')
|
||||||
|
elif not os.path.exists(options.HtmlWorkshopPath):
|
||||||
|
errors.append('- The installation path of Microsoft HTML Workshop %s does not exists. ' % options.HtmlWorkshopPath)
|
||||||
|
|
||||||
|
if len(errors) != 0:
|
||||||
|
print '\n'
|
||||||
|
parser.error('Fail to start due to following reasons: \n%s' %'\n'.join(errors))
|
||||||
|
return (options.WorkspacePath, options.PackagePath, options.DoxygenPath, options.OutputPath,
|
||||||
|
options.Arch, options.DocumentMode, options.IncludeOnly, options.HtmlWorkshopPath)
|
||||||
|
|
||||||
|
def createPackageObject(wsPath, pkgPath):
|
||||||
|
try:
|
||||||
|
pkgObj = baseobject.Package(None, wsPath)
|
||||||
|
pkgObj.Load(pkgPath)
|
||||||
|
except:
|
||||||
|
logging.getLogger().error ('Fail to create package object!')
|
||||||
|
return None
|
||||||
|
|
||||||
|
return pkgObj
|
||||||
|
|
||||||
|
def callbackLogMessage(msg, level):
|
||||||
|
print msg.strip()
|
||||||
|
|
||||||
|
def callbackCreateDoxygenProcess(doxPath, configPath):
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
cmd = '"%s" %s' % (doxPath, configPath)
|
||||||
|
else:
|
||||||
|
cmd = '%s %s' % (doxPath, configPath)
|
||||||
|
print cmd
|
||||||
|
subprocess.call(cmd, shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
def DocumentFixup(outPath, arch):
|
||||||
|
# find BASE_LIBRARY_JUMP_BUFFER structure reference page
|
||||||
|
|
||||||
|
print '\n >>> Start fixup document \n'
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(outPath):
|
||||||
|
for dir in dirs:
|
||||||
|
if dir.lower() in ['.svn', '_svn', 'cvs']:
|
||||||
|
dirs.remove(dir)
|
||||||
|
for file in files:
|
||||||
|
if not file.lower().endswith('.html'): continue
|
||||||
|
fullpath = os.path.join(outPath, root, file)
|
||||||
|
try:
|
||||||
|
f = open(fullpath, 'r')
|
||||||
|
text = f.read()
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
logging.getLogger().error('\nFail to open file %s\n' % fullpath)
|
||||||
|
continue
|
||||||
|
if arch.lower() == 'all':
|
||||||
|
if text.find('BASE_LIBRARY_JUMP_BUFFER Struct Reference') != -1:
|
||||||
|
FixPageBASE_LIBRARY_JUMP_BUFFER(fullpath, text)
|
||||||
|
if text.find('MdePkg/Include/Library/BaseLib.h File Reference') != -1:
|
||||||
|
FixPageBaseLib(fullpath, text)
|
||||||
|
if text.find('IA32_IDT_GATE_DESCRIPTOR Union Reference') != -1:
|
||||||
|
FixPageIA32_IDT_GATE_DESCRIPTOR(fullpath, text)
|
||||||
|
if text.find('MdePkg/Include/Library/UefiDriverEntryPoint.h File Reference') != -1:
|
||||||
|
FixPageUefiDriverEntryPoint(fullpath, text)
|
||||||
|
if text.find('MdePkg/Include/Library/UefiApplicationEntryPoint.h File Reference') != -1:
|
||||||
|
FixPageUefiApplicationEntryPoint(fullpath, text)
|
||||||
|
|
||||||
|
print ' >>> Finish all document fixing up! \n'
|
||||||
|
|
||||||
|
def FixPageBaseLib(path, text):
|
||||||
|
print ' >>> Fixup BaseLib file page at file %s \n' % path
|
||||||
|
lines = text.split('\n')
|
||||||
|
lastBaseJumpIndex = -1
|
||||||
|
lastIdtGateDescriptor = -1
|
||||||
|
for index in range(len(lines) - 1, -1, -1):
|
||||||
|
line = lines[index]
|
||||||
|
if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4 </td>':
|
||||||
|
lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4 [IA32] </td>'
|
||||||
|
if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 0x10 </td>':
|
||||||
|
lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 0x10 [IPF] </td>'
|
||||||
|
if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8 </td>':
|
||||||
|
lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 9 [EBC, x64] </td>'
|
||||||
|
if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 4') != -1:
|
||||||
|
lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 4',
|
||||||
|
'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 4 [IA32]')
|
||||||
|
if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 0x10') != -1:
|
||||||
|
lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 0x10',
|
||||||
|
'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 0x10 [IPF]')
|
||||||
|
if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 8') != -1:
|
||||||
|
lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 8',
|
||||||
|
'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a> 8 [x64, EBC]')
|
||||||
|
if line.find('>BASE_LIBRARY_JUMP_BUFFER</a>') != -1:
|
||||||
|
if lastBaseJumpIndex != -1:
|
||||||
|
del lines[lastBaseJumpIndex]
|
||||||
|
lastBaseJumpIndex = index
|
||||||
|
if line.find('>IA32_IDT_GATE_DESCRIPTOR</a></td>') != -1:
|
||||||
|
if lastIdtGateDescriptor != -1:
|
||||||
|
del lines[lastIdtGateDescriptor]
|
||||||
|
lastIdtGateDescriptor = index
|
||||||
|
try:
|
||||||
|
f = open(path, 'w')
|
||||||
|
f.write('\n'.join(lines))
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
|
||||||
|
return
|
||||||
|
print " <<< Finish to fixup file %s\n" % path
|
||||||
|
|
||||||
|
def FixPageIA32_IDT_GATE_DESCRIPTOR(path, text):
|
||||||
|
print ' >>> Fixup structure reference IA32_IDT_GATE_DESCRIPTOR at file %s \n' % path
|
||||||
|
lines = text.split('\n')
|
||||||
|
for index in range(len(lines) - 1, -1, -1):
|
||||||
|
line = lines[index].strip()
|
||||||
|
if line.find('struct {</td>') != -1 and lines[index - 2].find('>Uint64</a></td>') != -1:
|
||||||
|
lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>')
|
||||||
|
if line.find('struct {</td>') != -1 and lines[index - 1].find('Data Fields') != -1:
|
||||||
|
lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>')
|
||||||
|
try:
|
||||||
|
f = open(path, 'w')
|
||||||
|
f.write('\n'.join(lines))
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
|
||||||
|
return
|
||||||
|
print " <<< Finish to fixup file %s\n" % path
|
||||||
|
|
||||||
|
def FixPageBASE_LIBRARY_JUMP_BUFFER(path, text):
|
||||||
|
print ' >>> Fixup structure reference BASE_LIBRARY_JUMP_BUFFER at file %s \n' % path
|
||||||
|
lines = text.split('\n')
|
||||||
|
bInDetail = True
|
||||||
|
bNeedRemove = False
|
||||||
|
for index in range(len(lines) - 1, -1, -1):
|
||||||
|
line = lines[index]
|
||||||
|
if line.find('Detailed Description') != -1:
|
||||||
|
bInDetail = False
|
||||||
|
if line.startswith('EBC context buffer used by') and lines[index - 1].startswith('x64 context buffer'):
|
||||||
|
lines[index] = "IA32/IPF/X64/" + line
|
||||||
|
bNeedRemove = True
|
||||||
|
if line.startswith("x64 context buffer") or line.startswith('IPF context buffer used by') or \
|
||||||
|
line.startswith('IA32 context buffer used by'):
|
||||||
|
if bNeedRemove:
|
||||||
|
lines.remove(line)
|
||||||
|
if line.find('>R0</a>') != -1 and not bInDetail:
|
||||||
|
if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For EBC</h2></td></tr>':
|
||||||
|
lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For EBC</h2></td></tr>')
|
||||||
|
if line.find('>Rbx</a>') != -1 and not bInDetail:
|
||||||
|
if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>':
|
||||||
|
lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>')
|
||||||
|
if line.find('>F2</a>') != -1 and not bInDetail:
|
||||||
|
if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For IPF</h2></td></tr>':
|
||||||
|
lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IPF</h2></td></tr>')
|
||||||
|
if line.find('>Ebx</a>') != -1 and not bInDetail:
|
||||||
|
if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>':
|
||||||
|
lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>')
|
||||||
|
try:
|
||||||
|
f = open(path, 'w')
|
||||||
|
f.write('\n'.join(lines))
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
||||||
|
return
|
||||||
|
print " <<< Finish to fixup file %s\n" % path
|
||||||
|
|
||||||
|
def FixPageUefiDriverEntryPoint(path, text):
|
||||||
|
print ' >>> Fixup file reference MdePkg/Include/Library/UefiDriverEntryPoint.h at file %s \n' % path
|
||||||
|
lines = text.split('\n')
|
||||||
|
bInModuleEntry = False
|
||||||
|
bInEfiMain = False
|
||||||
|
ModuleEntryDlCount = 0
|
||||||
|
ModuleEntryDelStart = 0
|
||||||
|
ModuleEntryDelEnd = 0
|
||||||
|
EfiMainDlCount = 0
|
||||||
|
EfiMainDelStart = 0
|
||||||
|
EfiMainDelEnd = 0
|
||||||
|
|
||||||
|
for index in range(len(lines)):
|
||||||
|
line = lines[index].strip()
|
||||||
|
if line.find('EFI_STATUS</a> EFIAPI _ModuleEntryPoint </td>') != -1:
|
||||||
|
bInModuleEntry = True
|
||||||
|
if line.find('EFI_STATUS</a> EFIAPI EfiMain </td>') != -1:
|
||||||
|
bInEfiMain = True
|
||||||
|
if line.startswith('<p>References <a'):
|
||||||
|
if bInModuleEntry:
|
||||||
|
ModuleEntryDelEnd = index - 1
|
||||||
|
bInModuleEntry = False
|
||||||
|
elif bInEfiMain:
|
||||||
|
EfiMainDelEnd = index - 1
|
||||||
|
bInEfiMain = False
|
||||||
|
if bInModuleEntry:
|
||||||
|
if line.startswith('</dl>'):
|
||||||
|
ModuleEntryDlCount = ModuleEntryDlCount + 1
|
||||||
|
if ModuleEntryDlCount == 1:
|
||||||
|
ModuleEntryDelStart = index + 1
|
||||||
|
if bInEfiMain:
|
||||||
|
if line.startswith('</dl>'):
|
||||||
|
EfiMainDlCount = EfiMainDlCount + 1
|
||||||
|
if EfiMainDlCount == 1:
|
||||||
|
EfiMainDelStart = index + 1
|
||||||
|
|
||||||
|
if EfiMainDelEnd > EfiMainDelStart:
|
||||||
|
for index in range(EfiMainDelEnd, EfiMainDelStart, -1):
|
||||||
|
del lines[index]
|
||||||
|
if ModuleEntryDelEnd > ModuleEntryDelStart:
|
||||||
|
for index in range(ModuleEntryDelEnd, ModuleEntryDelStart, -1):
|
||||||
|
del lines[index]
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open(path, 'w')
|
||||||
|
f.write('\n'.join(lines))
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
||||||
|
return
|
||||||
|
print " <<< Finish to fixup file %s\n" % path
|
||||||
|
|
||||||
|
|
||||||
|
def FixPageUefiApplicationEntryPoint(path, text):
|
||||||
|
print ' >>> Fixup file reference MdePkg/Include/Library/UefiApplicationEntryPoint.h at file %s \n' % path
|
||||||
|
lines = text.split('\n')
|
||||||
|
bInModuleEntry = False
|
||||||
|
bInEfiMain = False
|
||||||
|
ModuleEntryDlCount = 0
|
||||||
|
ModuleEntryDelStart = 0
|
||||||
|
ModuleEntryDelEnd = 0
|
||||||
|
EfiMainDlCount = 0
|
||||||
|
EfiMainDelStart = 0
|
||||||
|
EfiMainDelEnd = 0
|
||||||
|
|
||||||
|
for index in range(len(lines)):
|
||||||
|
line = lines[index].strip()
|
||||||
|
if line.find('EFI_STATUS</a> EFIAPI _ModuleEntryPoint </td>') != -1:
|
||||||
|
bInModuleEntry = True
|
||||||
|
if line.find('EFI_STATUS</a> EFIAPI EfiMain </td>') != -1:
|
||||||
|
bInEfiMain = True
|
||||||
|
if line.startswith('<p>References <a'):
|
||||||
|
if bInModuleEntry:
|
||||||
|
ModuleEntryDelEnd = index - 1
|
||||||
|
bInModuleEntry = False
|
||||||
|
elif bInEfiMain:
|
||||||
|
EfiMainDelEnd = index - 1
|
||||||
|
bInEfiMain = False
|
||||||
|
if bInModuleEntry:
|
||||||
|
if line.startswith('</dl>'):
|
||||||
|
ModuleEntryDlCount = ModuleEntryDlCount + 1
|
||||||
|
if ModuleEntryDlCount == 1:
|
||||||
|
ModuleEntryDelStart = index + 1
|
||||||
|
if bInEfiMain:
|
||||||
|
if line.startswith('</dl>'):
|
||||||
|
EfiMainDlCount = EfiMainDlCount + 1
|
||||||
|
if EfiMainDlCount == 1:
|
||||||
|
EfiMainDelStart = index + 1
|
||||||
|
|
||||||
|
if EfiMainDelEnd > EfiMainDelStart:
|
||||||
|
for index in range(EfiMainDelEnd, EfiMainDelStart, -1):
|
||||||
|
del lines[index]
|
||||||
|
if ModuleEntryDelEnd > ModuleEntryDelStart:
|
||||||
|
for index in range(ModuleEntryDelEnd, ModuleEntryDelStart, -1):
|
||||||
|
del lines[index]
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open(path, 'w')
|
||||||
|
f.write('\n'.join(lines))
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
||||||
|
return
|
||||||
|
print " <<< Finish to fixup file %s\n" % path
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
wspath, pkgpath, doxpath, outpath, archtag, docmode, isinc, hwpath = parseCmdArgs()
|
||||||
|
|
||||||
|
# configure logging system
|
||||||
|
logfilepath = os.path.join(outpath, 'log.txt')
|
||||||
|
logging.basicConfig(format='%(levelname)-8s %(message)s', level=logging.DEBUG)
|
||||||
|
|
||||||
|
# create package model object firstly
|
||||||
|
pkgObj = createPackageObject(wspath, pkgpath)
|
||||||
|
if pkgObj == None:
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
# create doxygen action model
|
||||||
|
arch = None
|
||||||
|
tooltag = None
|
||||||
|
if archtag.lower() != 'all':
|
||||||
|
arch = archtag.split('_')[0]
|
||||||
|
tooltag = archtag.split('_')[1]
|
||||||
|
else:
|
||||||
|
arch = 'all'
|
||||||
|
tooltag = 'all'
|
||||||
|
|
||||||
|
# preprocess package and call doxygen
|
||||||
|
try:
|
||||||
|
action = doxygengen.PackageDocumentAction(doxpath,
|
||||||
|
hwpath,
|
||||||
|
outpath,
|
||||||
|
pkgObj,
|
||||||
|
docmode,
|
||||||
|
callbackLogMessage,
|
||||||
|
arch,
|
||||||
|
tooltag,
|
||||||
|
isinc,
|
||||||
|
True)
|
||||||
|
action.RegisterCallbackDoxygenProcess(callbackCreateDoxygenProcess)
|
||||||
|
action.Generate()
|
||||||
|
except:
|
||||||
|
message = traceback.format_exception(*sys.exc_info())
|
||||||
|
logging.getLogger().error('Fail to create doxygen action! \n%s' % ''.join(message))
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
DocumentFixup(outpath, arch)
|
||||||
|
|
||||||
|
# generate CHM is necessary
|
||||||
|
if docmode.lower() == 'chm':
|
||||||
|
indexpath = os.path.join(outpath, 'html', 'index.hhp')
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
cmd = '"%s" %s' % (hwpath, indexpath)
|
||||||
|
else:
|
||||||
|
cmd = '%s %s' % (hwpath, indexpath)
|
||||||
|
subprocess.call(cmd)
|
||||||
|
print '\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.chm')
|
||||||
|
else:
|
||||||
|
print '\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.html')
|
||||||
1066
BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw
Normal file
1066
BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
@@ -0,0 +1,449 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from message import *
|
||||||
|
|
||||||
|
class BaseDoxygeItem:
|
||||||
|
def __init__(self, name, tag=''):
|
||||||
|
self.mName = name
|
||||||
|
self.mTag = tag
|
||||||
|
self.mDescription = ''
|
||||||
|
self.mText = []
|
||||||
|
|
||||||
|
def AddDescription(self, desc):
|
||||||
|
self.mDescription = '%s%s' % (self.mDescription, desc)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '\n'.join(self.mText)
|
||||||
|
|
||||||
|
def Generate(self):
|
||||||
|
"""This interface need to be override"""
|
||||||
|
|
||||||
|
class Section(BaseDoxygeItem):
|
||||||
|
def Generate(self):
|
||||||
|
"""This interface need to be override"""
|
||||||
|
if len(self.mTag) != 0:
|
||||||
|
self.mText.append(' \section %s %s' % (self.mName, self.mTag))
|
||||||
|
else:
|
||||||
|
self.mText.append(' \section %s' % self.mName)
|
||||||
|
|
||||||
|
self.mText.append(self.mDescription)
|
||||||
|
return self.mText
|
||||||
|
|
||||||
|
class Page(BaseDoxygeItem):
|
||||||
|
def __init__(self, name, tag=None, isSort=True):
|
||||||
|
BaseDoxygeItem.__init__(self, name, tag)
|
||||||
|
self.mSubPages = []
|
||||||
|
self.mIsMainPage = False
|
||||||
|
self.mSections = []
|
||||||
|
self.mIsSort = isSort
|
||||||
|
|
||||||
|
def GetSubpageCount(self):
|
||||||
|
return len(self.mSubPages)
|
||||||
|
|
||||||
|
def AddPage(self, subpage):
|
||||||
|
self.mSubPages.append(subpage)
|
||||||
|
return subpage
|
||||||
|
|
||||||
|
def AddPages(self, pageArray):
|
||||||
|
if pageArray == None:
|
||||||
|
return
|
||||||
|
for page in pageArray:
|
||||||
|
self.AddPage(page)
|
||||||
|
|
||||||
|
def AddSection(self, section):
|
||||||
|
self.mSections.append(section)
|
||||||
|
self.mSections.sort(cmp=lambda x,y: cmp(x.mName.lower(), y.mName.lower()))
|
||||||
|
|
||||||
|
def Generate(self):
|
||||||
|
if self.mIsMainPage:
|
||||||
|
self.mText.append('/** \mainpage %s' % self.mName)
|
||||||
|
self.mIsSort = False
|
||||||
|
else:
|
||||||
|
self.mText.append('/** \page %s %s' % (self.mTag, self.mName))
|
||||||
|
|
||||||
|
if len(self.mDescription) != 0:
|
||||||
|
self.mText.append(self.mDescription)
|
||||||
|
endIndex = len(self.mText)
|
||||||
|
|
||||||
|
self.mSections.sort()
|
||||||
|
for sect in self.mSections:
|
||||||
|
self.mText += sect.Generate()
|
||||||
|
|
||||||
|
endIndex = len(self.mText)
|
||||||
|
|
||||||
|
if len(self.mSubPages) != 0:
|
||||||
|
self.mText.insert(endIndex, "<p> \section content_index INDEX")
|
||||||
|
endIndex = len(self.mText)
|
||||||
|
self.mText.insert(endIndex, '<ul>')
|
||||||
|
endIndex += 1
|
||||||
|
if self.mIsSort:
|
||||||
|
self.mSubPages.sort(cmp=lambda x,y: cmp(x.mName.lower(), y.mName.lower()))
|
||||||
|
for page in self.mSubPages:
|
||||||
|
self.mText.insert(endIndex, '<li>\subpage %s \"%s\" </li>' % (page.mTag, page.mName))
|
||||||
|
endIndex += 1
|
||||||
|
self.mText += page.Generate()
|
||||||
|
self.mText.insert(endIndex, '</ul>')
|
||||||
|
endIndex += 1
|
||||||
|
self.mText.insert(endIndex, ' **/')
|
||||||
|
return self.mText
|
||||||
|
|
||||||
|
class DoxygenFile(Page):
|
||||||
|
def __init__(self, name, file):
|
||||||
|
Page.__init__(self, name)
|
||||||
|
self.mFilename = file
|
||||||
|
self.mIsMainPage = True
|
||||||
|
|
||||||
|
def GetFilename(self):
|
||||||
|
return self.mFilename.replace('/', '\\')
|
||||||
|
|
||||||
|
def Save(self):
|
||||||
|
str = self.Generate()
|
||||||
|
try:
|
||||||
|
f = open(self.mFilename, 'w')
|
||||||
|
f.write('\n'.join(str))
|
||||||
|
f.close()
|
||||||
|
except IOError, e:
|
||||||
|
ErrorMsg ('Fail to write file %s' % self.mFilename)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
doxygenConfigTemplate = """
|
||||||
|
DOXYFILE_ENCODING = UTF-8
|
||||||
|
PROJECT_NAME = %(ProjectName)s
|
||||||
|
PROJECT_NUMBER = %(ProjectVersion)s
|
||||||
|
OUTPUT_DIRECTORY = %(OutputDir)s
|
||||||
|
CREATE_SUBDIRS = YES
|
||||||
|
OUTPUT_LANGUAGE = English
|
||||||
|
BRIEF_MEMBER_DESC = YES
|
||||||
|
REPEAT_BRIEF = YES
|
||||||
|
ABBREVIATE_BRIEF = "The $name class " \\
|
||||||
|
"The $name widget " \\
|
||||||
|
"The $name file " \\
|
||||||
|
is \\
|
||||||
|
provides \\
|
||||||
|
specifies \\
|
||||||
|
contains \\
|
||||||
|
represents \\
|
||||||
|
a \\
|
||||||
|
an \\
|
||||||
|
the
|
||||||
|
ALWAYS_DETAILED_SEC = NO
|
||||||
|
INLINE_INHERITED_MEMB = NO
|
||||||
|
FULL_PATH_NAMES = YES
|
||||||
|
STRIP_FROM_PATH = %(StripPath)s
|
||||||
|
STRIP_FROM_INC_PATH =
|
||||||
|
SHORT_NAMES = YES
|
||||||
|
JAVADOC_AUTOBRIEF = NO
|
||||||
|
QT_AUTOBRIEF = NO
|
||||||
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
DETAILS_AT_TOP = YES
|
||||||
|
INHERIT_DOCS = YES
|
||||||
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
|
TAB_SIZE = 1
|
||||||
|
ALIASES =
|
||||||
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||||
|
OPTIMIZE_OUTPUT_JAVA = NO
|
||||||
|
BUILTIN_STL_SUPPORT = NO
|
||||||
|
CPP_CLI_SUPPORT = NO
|
||||||
|
SIP_SUPPORT = NO
|
||||||
|
DISTRIBUTE_GROUP_DOC = YES
|
||||||
|
SUBGROUPING = YES
|
||||||
|
TYPEDEF_HIDES_STRUCT = NO
|
||||||
|
|
||||||
|
EXTRACT_ALL = YES
|
||||||
|
EXTRACT_PRIVATE = NO
|
||||||
|
EXTRACT_STATIC = NO
|
||||||
|
EXTRACT_LOCAL_CLASSES = NO
|
||||||
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
|
EXTRACT_ANON_NSPACES = NO
|
||||||
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
|
HIDE_UNDOC_CLASSES = NO
|
||||||
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
|
HIDE_IN_BODY_DOCS = NO
|
||||||
|
INTERNAL_DOCS = NO
|
||||||
|
CASE_SENSE_NAMES = NO
|
||||||
|
HIDE_SCOPE_NAMES = NO
|
||||||
|
SHOW_INCLUDE_FILES = NO
|
||||||
|
INLINE_INFO = YES
|
||||||
|
SORT_MEMBER_DOCS = YES
|
||||||
|
SORT_BRIEF_DOCS = NO
|
||||||
|
SORT_BY_SCOPE_NAME = YES
|
||||||
|
GENERATE_TODOLIST = YES
|
||||||
|
GENERATE_TESTLIST = YES
|
||||||
|
GENERATE_BUGLIST = YES
|
||||||
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
|
ENABLED_SECTIONS =
|
||||||
|
MAX_INITIALIZER_LINES = 30
|
||||||
|
SHOW_USED_FILES = NO
|
||||||
|
SHOW_DIRECTORIES = NO
|
||||||
|
FILE_VERSION_FILTER =
|
||||||
|
|
||||||
|
QUIET = NO
|
||||||
|
WARNINGS = YES
|
||||||
|
WARN_IF_UNDOCUMENTED = YES
|
||||||
|
WARN_IF_DOC_ERROR = YES
|
||||||
|
WARN_NO_PARAMDOC = YES
|
||||||
|
WARN_FORMAT = "$file:$line: $text "
|
||||||
|
WARN_LOGFILE = %(WarningFile)s
|
||||||
|
|
||||||
|
INPUT = %(FileList)s
|
||||||
|
INPUT_ENCODING = UTF-8
|
||||||
|
FILE_PATTERNS = %(Pattern)s
|
||||||
|
RECURSIVE = NO
|
||||||
|
EXCLUDE = *.svn
|
||||||
|
EXCLUDE_SYMLINKS = NO
|
||||||
|
EXCLUDE_PATTERNS = .svn
|
||||||
|
EXCLUDE_SYMBOLS =
|
||||||
|
EXAMPLE_PATH = %(ExamplePath)s
|
||||||
|
EXAMPLE_PATTERNS = *
|
||||||
|
EXAMPLE_RECURSIVE = NO
|
||||||
|
IMAGE_PATH =
|
||||||
|
INPUT_FILTER =
|
||||||
|
FILTER_PATTERNS =
|
||||||
|
FILTER_SOURCE_FILES = NO
|
||||||
|
|
||||||
|
SOURCE_BROWSER = NO
|
||||||
|
INLINE_SOURCES = NO
|
||||||
|
STRIP_CODE_COMMENTS = YES
|
||||||
|
REFERENCED_BY_RELATION = YES
|
||||||
|
REFERENCES_RELATION = YES
|
||||||
|
REFERENCES_LINK_SOURCE = NO
|
||||||
|
USE_HTAGS = NO
|
||||||
|
VERBATIM_HEADERS = NO
|
||||||
|
|
||||||
|
ALPHABETICAL_INDEX = NO
|
||||||
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
|
IGNORE_PREFIX =
|
||||||
|
|
||||||
|
GENERATE_HTML = YES
|
||||||
|
HTML_OUTPUT = html
|
||||||
|
HTML_FILE_EXTENSION = .html
|
||||||
|
HTML_HEADER =
|
||||||
|
HTML_FOOTER =
|
||||||
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
|
GENERATE_HTMLHELP = %(WhetherGenerateHtmlHelp)s
|
||||||
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
|
CHM_FILE = index.chm
|
||||||
|
HHC_LOCATION =
|
||||||
|
GENERATE_CHI = NO
|
||||||
|
BINARY_TOC = NO
|
||||||
|
TOC_EXPAND = NO
|
||||||
|
DISABLE_INDEX = NO
|
||||||
|
ENUM_VALUES_PER_LINE = 4
|
||||||
|
GENERATE_TREEVIEW = %(WhetherGenerateTreeView)s
|
||||||
|
TREEVIEW_WIDTH = 250
|
||||||
|
|
||||||
|
GENERATE_LATEX = NO
|
||||||
|
LATEX_OUTPUT = latex
|
||||||
|
LATEX_CMD_NAME = latex
|
||||||
|
MAKEINDEX_CMD_NAME = makeindex
|
||||||
|
COMPACT_LATEX = NO
|
||||||
|
PAPER_TYPE = a4wide
|
||||||
|
EXTRA_PACKAGES =
|
||||||
|
LATEX_HEADER =
|
||||||
|
PDF_HYPERLINKS = YES
|
||||||
|
USE_PDFLATEX = YES
|
||||||
|
LATEX_BATCHMODE = NO
|
||||||
|
LATEX_HIDE_INDICES = NO
|
||||||
|
|
||||||
|
GENERATE_RTF = NO
|
||||||
|
RTF_OUTPUT = rtf
|
||||||
|
COMPACT_RTF = NO
|
||||||
|
RTF_HYPERLINKS = NO
|
||||||
|
RTF_STYLESHEET_FILE =
|
||||||
|
RTF_EXTENSIONS_FILE =
|
||||||
|
|
||||||
|
GENERATE_MAN = NO
|
||||||
|
MAN_OUTPUT = man
|
||||||
|
MAN_EXTENSION = .3
|
||||||
|
MAN_LINKS = NO
|
||||||
|
|
||||||
|
GENERATE_XML = NO
|
||||||
|
XML_OUTPUT = xml
|
||||||
|
XML_SCHEMA =
|
||||||
|
XML_DTD =
|
||||||
|
XML_PROGRAMLISTING = YES
|
||||||
|
|
||||||
|
GENERATE_AUTOGEN_DEF = NO
|
||||||
|
|
||||||
|
GENERATE_PERLMOD = NO
|
||||||
|
PERLMOD_LATEX = NO
|
||||||
|
PERLMOD_PRETTY = YES
|
||||||
|
PERLMOD_MAKEVAR_PREFIX =
|
||||||
|
|
||||||
|
ENABLE_PREPROCESSING = YES
|
||||||
|
MACRO_EXPANSION = YES
|
||||||
|
EXPAND_ONLY_PREDEF = YES
|
||||||
|
SEARCH_INCLUDES = YES
|
||||||
|
INCLUDE_PATH = %(IncludePath)s
|
||||||
|
INCLUDE_FILE_PATTERNS = *.h
|
||||||
|
PREDEFINED = %(PreDefined)s
|
||||||
|
EXPAND_AS_DEFINED =
|
||||||
|
SKIP_FUNCTION_MACROS = NO
|
||||||
|
|
||||||
|
TAGFILES =
|
||||||
|
GENERATE_TAGFILE =
|
||||||
|
ALLEXTERNALS = NO
|
||||||
|
EXTERNAL_GROUPS = YES
|
||||||
|
PERL_PATH = /usr/bin/perl
|
||||||
|
|
||||||
|
CLASS_DIAGRAMS = NO
|
||||||
|
MSCGEN_PATH =
|
||||||
|
HIDE_UNDOC_RELATIONS = YES
|
||||||
|
HAVE_DOT = NO
|
||||||
|
CLASS_GRAPH = YES
|
||||||
|
COLLABORATION_GRAPH = YES
|
||||||
|
GROUP_GRAPHS = YES
|
||||||
|
UML_LOOK = NO
|
||||||
|
TEMPLATE_RELATIONS = NO
|
||||||
|
INCLUDE_GRAPH = YES
|
||||||
|
INCLUDED_BY_GRAPH = YES
|
||||||
|
CALL_GRAPH = NO
|
||||||
|
CALLER_GRAPH = NO
|
||||||
|
GRAPHICAL_HIERARCHY = YES
|
||||||
|
DIRECTORY_GRAPH = YES
|
||||||
|
DOT_IMAGE_FORMAT = png
|
||||||
|
DOT_PATH =
|
||||||
|
DOTFILE_DIRS =
|
||||||
|
DOT_GRAPH_MAX_NODES = 50
|
||||||
|
MAX_DOT_GRAPH_DEPTH = 1000
|
||||||
|
DOT_TRANSPARENT = YES
|
||||||
|
DOT_MULTI_TARGETS = NO
|
||||||
|
GENERATE_LEGEND = YES
|
||||||
|
DOT_CLEANUP = YES
|
||||||
|
|
||||||
|
SEARCHENGINE = NO
|
||||||
|
|
||||||
|
"""
|
||||||
|
class DoxygenConfigFile:
|
||||||
|
def __init__(self):
|
||||||
|
self.mProjectName = ''
|
||||||
|
self.mOutputDir = ''
|
||||||
|
self.mFileList = []
|
||||||
|
self.mIncludeList = []
|
||||||
|
self.mStripPath = ''
|
||||||
|
self.mExamplePath = ''
|
||||||
|
self.mPattern = ['*.c', '*.h',
|
||||||
|
'*.asm', '*.s', '.nasm', '*.html', '*.dox']
|
||||||
|
self.mMode = 'HTML'
|
||||||
|
self.mWarningFile = ''
|
||||||
|
self.mPreDefined = []
|
||||||
|
self.mProjectVersion = 0.1
|
||||||
|
|
||||||
|
def SetChmMode(self):
|
||||||
|
self.mMode = 'CHM'
|
||||||
|
|
||||||
|
def SetHtmlMode(self):
|
||||||
|
self.mMode = 'HTML'
|
||||||
|
|
||||||
|
def SetProjectName(self, str):
|
||||||
|
self.mProjectName = str
|
||||||
|
|
||||||
|
def SetProjectVersion(self, str):
|
||||||
|
self.mProjectVersion = str
|
||||||
|
|
||||||
|
def SetOutputDir(self, str):
|
||||||
|
self.mOutputDir = str
|
||||||
|
|
||||||
|
def SetStripPath(self, str):
|
||||||
|
self.mStripPath = str
|
||||||
|
|
||||||
|
def SetExamplePath(self, str):
|
||||||
|
self.mExamplePath = str
|
||||||
|
|
||||||
|
def SetWarningFilePath(self, str):
|
||||||
|
self.mWarningFile = str.replace('\\', '/')
|
||||||
|
|
||||||
|
def FileExists(self, path):
|
||||||
|
if path == None:
|
||||||
|
return False
|
||||||
|
if len(path) == 0:
|
||||||
|
return False
|
||||||
|
|
||||||
|
for p in self.mFileList:
|
||||||
|
if path.lower() == p.lower():
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
def AddFile(self, path):
|
||||||
|
if path == None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(path) == 0:
|
||||||
|
return
|
||||||
|
path = path.replace('\\', '/')
|
||||||
|
if not self.FileExists(path):
|
||||||
|
self.mFileList.append(path)
|
||||||
|
|
||||||
|
def AddIncludePath(self, path):
|
||||||
|
path = path.replace('\\', '/')
|
||||||
|
if path not in self.mIncludeList:
|
||||||
|
self.mIncludeList.append(path)
|
||||||
|
|
||||||
|
def AddPattern(self, pattern):
|
||||||
|
self.mPattern.append(pattern)
|
||||||
|
|
||||||
|
def AddPreDefined(self, macro):
|
||||||
|
self.mPreDefined.append(macro)
|
||||||
|
|
||||||
|
def Generate(self, path):
|
||||||
|
files = ' \\\n'.join(self.mFileList)
|
||||||
|
includes = ' \\\n'.join(self.mIncludeList)
|
||||||
|
patterns = ' \\\n'.join(self.mPattern)
|
||||||
|
if self.mMode.lower() == 'html':
|
||||||
|
sHtmlHelp = 'NO'
|
||||||
|
sTreeView = 'YES'
|
||||||
|
else:
|
||||||
|
sHtmlHelp = 'YES'
|
||||||
|
sTreeView = 'NO'
|
||||||
|
|
||||||
|
text = doxygenConfigTemplate % {'ProjectName':self.mProjectName,
|
||||||
|
'OutputDir':self.mOutputDir,
|
||||||
|
'StripPath':self.mStripPath,
|
||||||
|
'ExamplePath':self.mExamplePath,
|
||||||
|
'FileList':files,
|
||||||
|
'Pattern':patterns,
|
||||||
|
'WhetherGenerateHtmlHelp':sHtmlHelp,
|
||||||
|
'WhetherGenerateTreeView':sTreeView,
|
||||||
|
'IncludePath':includes,
|
||||||
|
'WarningFile':self.mWarningFile,
|
||||||
|
'PreDefined':' '.join(self.mPreDefined),
|
||||||
|
'ProjectVersion':self.mProjectVersion}
|
||||||
|
try:
|
||||||
|
f = open(path, 'w')
|
||||||
|
f.write(text)
|
||||||
|
f.close()
|
||||||
|
except IOError, e:
|
||||||
|
ErrorMsg ('Fail to generate doxygen config file %s' % path)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# TEST CODE
|
||||||
|
########################################################################
|
||||||
|
if __name__== '__main__':
|
||||||
|
df = DoxygenFile('Platform Document', 'm:\tree')
|
||||||
|
df.AddPage(Page('Module', 'module'))
|
||||||
|
p = df.AddPage(Page('Library', 'library'))
|
||||||
|
p.AddDescription(desc)
|
||||||
|
p.AddPage(Page('PCD', 'pcds'))
|
||||||
|
|
||||||
|
df.Generate()
|
||||||
|
print df
|
||||||
@@ -0,0 +1,611 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import array
|
||||||
|
import uuid
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
import core.pe as pe
|
||||||
|
|
||||||
|
def GetLogger():
|
||||||
|
return logging.getLogger('EFI Binary File')
|
||||||
|
|
||||||
|
class EFIBinaryError(Exception):
|
||||||
|
def __init__(self, message):
|
||||||
|
Exception.__init__(self)
|
||||||
|
self._message = message
|
||||||
|
|
||||||
|
def GetMessage(self):
|
||||||
|
return self._message
|
||||||
|
|
||||||
|
class EfiFd(object):
|
||||||
|
EFI_FV_HEADER_SIZE = 0x48
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._fvs = []
|
||||||
|
|
||||||
|
def Load(self, fd, size):
|
||||||
|
index = fd.tell()
|
||||||
|
while (index + self.EFI_FV_HEADER_SIZE < size):
|
||||||
|
fv = EfiFv(self)
|
||||||
|
fv.Load(fd)
|
||||||
|
self._fvs.append(fv)
|
||||||
|
index += fv.GetHeader().GetFvLength()
|
||||||
|
index = align(index, 8)
|
||||||
|
fd.seek(index)
|
||||||
|
|
||||||
|
def GetFvs(self):
|
||||||
|
return self._fvs
|
||||||
|
|
||||||
|
class EfiFv(object):
|
||||||
|
FILE_SYSTEM_GUID = uuid.UUID('{8c8ce578-8a3d-4f1c-9935-896185c32dd3}')
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
self._size = 0
|
||||||
|
self._filename = None
|
||||||
|
self._fvheader = None
|
||||||
|
self._blockentries = []
|
||||||
|
self._ffs = []
|
||||||
|
|
||||||
|
# following field is for FV in FD
|
||||||
|
self._parent = parent
|
||||||
|
self._offset = 0
|
||||||
|
self._raw = array.array('B')
|
||||||
|
|
||||||
|
def Load(self, fd):
|
||||||
|
self._offset = fd.tell()
|
||||||
|
self._filename = fd.name
|
||||||
|
|
||||||
|
# get file header
|
||||||
|
self._fvheader = EfiFirmwareVolumeHeader.Read(fd)
|
||||||
|
#self._fvheader.Dump()
|
||||||
|
|
||||||
|
self._size = self._fvheader.GetFvLength()
|
||||||
|
|
||||||
|
if self._fvheader.GetFileSystemGuid() != self.FILE_SYSTEM_GUID:
|
||||||
|
fd.seek(self._offset)
|
||||||
|
self._raw.fromfile(fd, self.GetHeader().GetFvLength())
|
||||||
|
return
|
||||||
|
|
||||||
|
# read block map
|
||||||
|
blockentry = BlockMapEntry.Read(fd)
|
||||||
|
self._blockentries.append(blockentry)
|
||||||
|
while (blockentry.GetNumberBlocks() != 0 and blockentry.GetLength() != 0):
|
||||||
|
self._blockentries.append(blockentry)
|
||||||
|
blockentry = BlockMapEntry.Read(fd)
|
||||||
|
|
||||||
|
|
||||||
|
if self._fvheader.GetSize() + (len(self._blockentries)) * 8 != \
|
||||||
|
self._fvheader.GetHeaderLength():
|
||||||
|
raise EFIBinaryError("Volume Header length not consistent with block map!")
|
||||||
|
|
||||||
|
index = align(fd.tell(), 8)
|
||||||
|
count = 0
|
||||||
|
while ((index + EfiFfs.FFS_HEADER_SIZE) < self._size):
|
||||||
|
ffs = EfiFfs.Read(fd, self)
|
||||||
|
if not isValidGuid(ffs.GetNameGuid()):
|
||||||
|
break
|
||||||
|
self._ffs.append(ffs)
|
||||||
|
count += 1
|
||||||
|
index = align(fd.tell(), 8)
|
||||||
|
|
||||||
|
fd.seek(self._offset)
|
||||||
|
self._raw.fromfile(fd, self.GetHeader().GetFvLength())
|
||||||
|
|
||||||
|
def GetFfs(self):
|
||||||
|
return self._ffs
|
||||||
|
|
||||||
|
def GetHeader(self):
|
||||||
|
return self._fvheader
|
||||||
|
|
||||||
|
def GetBlockEntries(self):
|
||||||
|
return self._blockentries
|
||||||
|
|
||||||
|
def GetHeaderRawData(self):
|
||||||
|
ret = []
|
||||||
|
ret += self._fvheader.GetRawData()
|
||||||
|
for block in self._blockentries:
|
||||||
|
ret += block.GetRawData()
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def GetOffset(self):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def GetRawData(self):
|
||||||
|
return self._raw.tolist()
|
||||||
|
|
||||||
|
class BinaryItem(object):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
self._size = 0
|
||||||
|
self._arr = array.array('B')
|
||||||
|
self._parent = parent
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def Read(cls, fd, parent=None):
|
||||||
|
item = cls(parent)
|
||||||
|
item.fromfile(fd)
|
||||||
|
return item
|
||||||
|
|
||||||
|
def Load(self, fd):
|
||||||
|
self.fromfile(fd)
|
||||||
|
|
||||||
|
def GetSize(self):
|
||||||
|
"""should be implemented by inherited class"""
|
||||||
|
|
||||||
|
def fromfile(self, fd):
|
||||||
|
self._arr.fromfile(fd, self.GetSize())
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._parent
|
||||||
|
|
||||||
|
class EfiFirmwareVolumeHeader(BinaryItem):
|
||||||
|
def GetSize(self):
|
||||||
|
return 56
|
||||||
|
|
||||||
|
def GetSigunature(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
sig = ''
|
||||||
|
for x in list[40:44]:
|
||||||
|
sig += chr(x)
|
||||||
|
return sig
|
||||||
|
|
||||||
|
def GetAttribute(self):
|
||||||
|
return list2int(self._arr.tolist()[44:48])
|
||||||
|
|
||||||
|
def GetErasePolarity(self):
|
||||||
|
list = self.GetAttrStrings()
|
||||||
|
if 'EFI_FVB2_ERASE_POLARITY' in list:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def GetAttrStrings(self):
|
||||||
|
list = []
|
||||||
|
value = self.GetAttribute()
|
||||||
|
if (value & 0x01) != 0:
|
||||||
|
list.append('EFI_FVB2_READ_DISABLED_CAP')
|
||||||
|
if (value & 0x02) != 0:
|
||||||
|
list.append('EFI_FVB2_READ_ENABLED_CAP')
|
||||||
|
if (value & 0x04) != 0:
|
||||||
|
list.append('EFI_FVB2_READ_STATUS')
|
||||||
|
if (value & 0x08) != 0:
|
||||||
|
list.append('EFI_FVB2_WRITE_DISABLED_CAP')
|
||||||
|
if (value & 0x10) != 0:
|
||||||
|
list.append('EFI_FVB2_WRITE_ENABLED_CAP')
|
||||||
|
if (value & 0x20) != 0:
|
||||||
|
list.append('EFI_FVB2_WRITE_STATUS')
|
||||||
|
if (value & 0x40) != 0:
|
||||||
|
list.append('EFI_FVB2_LOCK_CAP')
|
||||||
|
if (value & 0x80) != 0:
|
||||||
|
list.append('EFI_FVB2_LOCK_STATUS')
|
||||||
|
if (value & 0x200) != 0:
|
||||||
|
list.append('EFI_FVB2_STICKY_WRITE')
|
||||||
|
if (value & 0x400) != 0:
|
||||||
|
list.append('EFI_FVB2_MEMORY_MAPPED')
|
||||||
|
if (value & 0x800) != 0:
|
||||||
|
list.append('EFI_FVB2_ERASE_POLARITY')
|
||||||
|
if (value & 0x1000) != 0:
|
||||||
|
list.append('EFI_FVB2_READ_LOCK_CAP')
|
||||||
|
if (value & 0x00002000) != 0:
|
||||||
|
list.append('EFI_FVB2_READ_LOCK_STATUS')
|
||||||
|
if (value & 0x00004000) != 0:
|
||||||
|
list.append('EFI_FVB2_WRITE_LOCK_CAP')
|
||||||
|
if (value & 0x00008000) != 0:
|
||||||
|
list.append('EFI_FVB2_WRITE_LOCK_STATUS')
|
||||||
|
|
||||||
|
if (value == 0):
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_1')
|
||||||
|
if (value & 0x001F0000) == 0x00010000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_2')
|
||||||
|
if (value & 0x001F0000) == 0x00020000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_4')
|
||||||
|
if (value & 0x001F0000) == 0x00030000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_8')
|
||||||
|
if (value & 0x001F0000) == 0x00040000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_16')
|
||||||
|
if (value & 0x001F0000) == 0x00050000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_32')
|
||||||
|
if (value & 0x001F0000) == 0x00060000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_64')
|
||||||
|
if (value & 0x001F0000) == 0x00070000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_128')
|
||||||
|
if (value & 0x001F0000) == 0x00080000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_256')
|
||||||
|
if (value & 0x001F0000) == 0x00090000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_512')
|
||||||
|
if (value & 0x001F0000) == 0x000A0000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_1K')
|
||||||
|
if (value & 0x001F0000) == 0x000B0000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_2K')
|
||||||
|
if (value & 0x001F0000) == 0x000C0000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_4K')
|
||||||
|
if (value & 0x001F0000) == 0x000D0000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_8K')
|
||||||
|
if (value & 0x001F0000) == 0x000E0000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_16K')
|
||||||
|
if (value & 0x001F0000) == 0x000F0000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_32K')
|
||||||
|
if (value & 0x001F0000) == 0x00100000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_64K')
|
||||||
|
if (value & 0x001F0000) == 0x00110000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_128K')
|
||||||
|
if (value & 0x001F0000) == 0x00120000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_256K')
|
||||||
|
if (value & 0x001F0000) == 0x00130000:
|
||||||
|
list.append('EFI_FVB2_ALIGNMENT_512K')
|
||||||
|
|
||||||
|
return list
|
||||||
|
|
||||||
|
def GetHeaderLength(self):
|
||||||
|
return list2int(self._arr.tolist()[48:50])
|
||||||
|
|
||||||
|
def Dump(self):
|
||||||
|
print 'Signature: %s' % self.GetSigunature()
|
||||||
|
print 'Attribute: 0x%X' % self.GetAttribute()
|
||||||
|
print 'Header Length: 0x%X' % self.GetHeaderLength()
|
||||||
|
print 'File system Guid: ', self.GetFileSystemGuid()
|
||||||
|
print 'Revision: 0x%X' % self.GetRevision()
|
||||||
|
print 'FvLength: 0x%X' % self.GetFvLength()
|
||||||
|
|
||||||
|
def GetFileSystemGuid(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2guid(list[16:32])
|
||||||
|
|
||||||
|
def GetRevision(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return int(list[55])
|
||||||
|
|
||||||
|
def GetFvLength(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2int(list[32:40])
|
||||||
|
|
||||||
|
def GetRawData(self):
|
||||||
|
return self._arr.tolist()
|
||||||
|
|
||||||
|
class BlockMapEntry(BinaryItem):
|
||||||
|
def GetSize(self):
|
||||||
|
return 8
|
||||||
|
|
||||||
|
def GetNumberBlocks(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2int(list[0:4])
|
||||||
|
|
||||||
|
def GetLength(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2int(list[4:8])
|
||||||
|
|
||||||
|
def GetRawData(self):
|
||||||
|
return self._arr.tolist()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '[BlockEntry] Number = 0x%X, length=0x%X' % (self.GetNumberBlocks(), self.GetLength())
|
||||||
|
|
||||||
|
class EfiFfs(object):
|
||||||
|
FFS_HEADER_SIZE = 24
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
self._header = None
|
||||||
|
|
||||||
|
# following field is for FFS in FV file.
|
||||||
|
self._parent = parent
|
||||||
|
self._offset = 0
|
||||||
|
self._sections = []
|
||||||
|
|
||||||
|
def Load(self, fd):
|
||||||
|
self._offset = align(fd.tell(), 8)
|
||||||
|
|
||||||
|
self._header = EfiFfsHeader.Read(fd, self)
|
||||||
|
|
||||||
|
if not isValidGuid(self.GetNameGuid()):
|
||||||
|
return
|
||||||
|
|
||||||
|
index = self._offset
|
||||||
|
fileend = self._offset + self.GetSize()
|
||||||
|
while (index + EfiSection.EFI_SECTION_HEADER_SIZE < fileend):
|
||||||
|
section = EfiSection(self)
|
||||||
|
section.Load(fd)
|
||||||
|
if section.GetSize() == 0 and section.GetHeader().GetType() == 0:
|
||||||
|
break
|
||||||
|
self._sections.append(section)
|
||||||
|
index = fd.tell()
|
||||||
|
|
||||||
|
# rebase file pointer to next ffs file
|
||||||
|
index = self._offset + self._header.GetFfsSize()
|
||||||
|
index = align(index, 8)
|
||||||
|
fd.seek(index)
|
||||||
|
|
||||||
|
def GetOffset(self):
|
||||||
|
return self._offset
|
||||||
|
|
||||||
|
def GetSize(self):
|
||||||
|
return self._header.GetFfsSize()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def Read(cls, fd, parent=None):
|
||||||
|
item = cls(parent)
|
||||||
|
item.Load(fd)
|
||||||
|
return item
|
||||||
|
|
||||||
|
def GetNameGuid(self):
|
||||||
|
return self._header.GetNameGuid()
|
||||||
|
|
||||||
|
def DumpContent(self):
|
||||||
|
list = self._content.tolist()
|
||||||
|
line = []
|
||||||
|
count = 0
|
||||||
|
for item in list:
|
||||||
|
if count < 32:
|
||||||
|
line.append('0x%X' % int(item))
|
||||||
|
count += 1
|
||||||
|
else:
|
||||||
|
print ' '.join(line)
|
||||||
|
count = 0
|
||||||
|
line = []
|
||||||
|
line.append('0x%X' % int(item))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
def GetHeader(self):
|
||||||
|
return self._header
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._parent
|
||||||
|
|
||||||
|
def GetSections(self):
|
||||||
|
return self._sections
|
||||||
|
|
||||||
|
class EfiFfsHeader(BinaryItem):
|
||||||
|
ffs_state_map = {0x01:'EFI_FILE_HEADER_CONSTRUCTION',
|
||||||
|
0x02:'EFI_FILE_HEADER_VALID',
|
||||||
|
0x04:'EFI_FILE_DATA_VALID',
|
||||||
|
0x08:'EFI_FILE_MARKED_FOR_UPDATE',
|
||||||
|
0x10:'EFI_FILE_DELETED',
|
||||||
|
0x20:'EFI_FILE_HEADER_INVALID'}
|
||||||
|
|
||||||
|
def GetSize(self):
|
||||||
|
return 24
|
||||||
|
|
||||||
|
def GetNameGuid(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2guid(list[0:16])
|
||||||
|
|
||||||
|
def GetType(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return int(list[18])
|
||||||
|
|
||||||
|
|
||||||
|
def GetTypeString(self):
|
||||||
|
value = self.GetType()
|
||||||
|
if value == 0x01:
|
||||||
|
return 'EFI_FV_FILETYPE_RAW'
|
||||||
|
if value == 0x02:
|
||||||
|
return 'EFI_FV_FILETYPE_FREEFORM'
|
||||||
|
if value == 0x03:
|
||||||
|
return 'EFI_FV_FILETYPE_SECURITY_CORE'
|
||||||
|
if value == 0x04:
|
||||||
|
return 'EFI_FV_FILETYPE_PEI_CORE'
|
||||||
|
if value == 0x05:
|
||||||
|
return 'EFI_FV_FILETYPE_DXE_CORE'
|
||||||
|
if value == 0x06:
|
||||||
|
return 'EFI_FV_FILETYPE_PEIM'
|
||||||
|
if value == 0x07:
|
||||||
|
return 'EFI_FV_FILETYPE_DRIVER'
|
||||||
|
if value == 0x08:
|
||||||
|
return 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER'
|
||||||
|
if value == 0x09:
|
||||||
|
return 'EFI_FV_FILETYPE_APPLICATION'
|
||||||
|
if value == 0x0B:
|
||||||
|
return 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE'
|
||||||
|
if value == 0xc0:
|
||||||
|
return 'EFI_FV_FILETYPE_OEM_MIN'
|
||||||
|
if value == 0xdf:
|
||||||
|
return 'EFI_FV_FILETYPE_OEM_MAX'
|
||||||
|
if value == 0xe0:
|
||||||
|
return 'EFI_FV_FILETYPE_DEBUG_MIN'
|
||||||
|
if value == 0xef:
|
||||||
|
return 'EFI_FV_FILETYPE_DEBUG_MAX'
|
||||||
|
if value == 0xf0:
|
||||||
|
return 'EFI_FV_FILETYPE_FFS_PAD'
|
||||||
|
if value == 0xff:
|
||||||
|
return 'EFI_FV_FILETYPE_FFS_MAX'
|
||||||
|
return 'Unknown FFS Type'
|
||||||
|
|
||||||
|
def GetAttributes(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return int(list[19])
|
||||||
|
|
||||||
|
def GetFfsSize(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2int(list[20:23])
|
||||||
|
|
||||||
|
def GetState(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
state = int(list[23])
|
||||||
|
polarity = self.GetParent().GetParent().GetHeader().GetErasePolarity()
|
||||||
|
if polarity:
|
||||||
|
state = (~state) & 0xFF
|
||||||
|
HighestBit = 0x80
|
||||||
|
while (HighestBit != 0) and (HighestBit & state) == 0:
|
||||||
|
HighestBit = HighestBit >> 1
|
||||||
|
return HighestBit
|
||||||
|
|
||||||
|
def GetStateString(self):
|
||||||
|
state = self.GetState()
|
||||||
|
if state in self.ffs_state_map.keys():
|
||||||
|
return self.ffs_state_map[state]
|
||||||
|
return 'Unknown Ffs State'
|
||||||
|
|
||||||
|
def Dump(self):
|
||||||
|
print "FFS name: ", self.GetNameGuid()
|
||||||
|
print "FFS type: ", self.GetType()
|
||||||
|
print "FFS attr: 0x%X" % self.GetAttributes()
|
||||||
|
print "FFS size: 0x%X" % self.GetFfsSize()
|
||||||
|
print "FFS state: 0x%X" % self.GetState()
|
||||||
|
|
||||||
|
def GetRawData(self):
|
||||||
|
return self._arr.tolist()
|
||||||
|
|
||||||
|
|
||||||
|
class EfiSection(object):
|
||||||
|
EFI_SECTION_HEADER_SIZE = 4
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
self._size = 0
|
||||||
|
self._parent = parent
|
||||||
|
self._offset = 0
|
||||||
|
self._contents = array.array('B')
|
||||||
|
|
||||||
|
def Load(self, fd):
|
||||||
|
self._offset = align(fd.tell(), 4)
|
||||||
|
|
||||||
|
self._header = EfiSectionHeader.Read(fd, self)
|
||||||
|
|
||||||
|
if self._header.GetTypeString() == "EFI_SECTION_PE32":
|
||||||
|
pefile = pe.PEFile(self)
|
||||||
|
pefile.Load(fd, self.GetContentSize())
|
||||||
|
|
||||||
|
fd.seek(self._offset)
|
||||||
|
self._contents.fromfile(fd, self.GetContentSize())
|
||||||
|
|
||||||
|
# rebase file pointer to next section
|
||||||
|
index = self._offset + self.GetSize()
|
||||||
|
index = align(index, 4)
|
||||||
|
fd.seek(index)
|
||||||
|
|
||||||
|
def GetContentSize(self):
|
||||||
|
return self.GetSize() - self.EFI_SECTION_HEADER_SIZE
|
||||||
|
|
||||||
|
def GetContent(self):
|
||||||
|
return self._contents.tolist()
|
||||||
|
|
||||||
|
def GetSize(self):
|
||||||
|
return self._header.GetSectionSize()
|
||||||
|
|
||||||
|
def GetHeader(self):
|
||||||
|
return self._header
|
||||||
|
|
||||||
|
def GetSectionOffset(self):
|
||||||
|
return self._offset + self.EFI_SECTION_HEADER_SIZE
|
||||||
|
|
||||||
|
class EfiSectionHeader(BinaryItem):
|
||||||
|
section_type_map = {0x01: 'EFI_SECTION_COMPRESSION',
|
||||||
|
0x02: 'EFI_SECTION_GUID_DEFINED',
|
||||||
|
0x10: 'EFI_SECTION_PE32',
|
||||||
|
0x11: 'EFI_SECTION_PIC',
|
||||||
|
0x12: 'EFI_SECTION_TE',
|
||||||
|
0x13: 'EFI_SECTION_DXE_DEPEX',
|
||||||
|
0x14: 'EFI_SECTION_VERSION',
|
||||||
|
0x15: 'EFI_SECTION_USER_INTERFACE',
|
||||||
|
0x16: 'EFI_SECTION_COMPATIBILITY16',
|
||||||
|
0x17: 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE',
|
||||||
|
0x18: 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',
|
||||||
|
0x19: 'EFI_SECTION_RAW',
|
||||||
|
0x1B: 'EFI_SECTION_PEI_DEPEX'}
|
||||||
|
def GetSize(self):
|
||||||
|
return 4
|
||||||
|
|
||||||
|
def GetSectionSize(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return list2int(list[0:3])
|
||||||
|
|
||||||
|
def GetType(self):
|
||||||
|
list = self._arr.tolist()
|
||||||
|
return int(list[3])
|
||||||
|
|
||||||
|
def GetTypeString(self):
|
||||||
|
type = self.GetType()
|
||||||
|
if type not in self.section_type_map.keys():
|
||||||
|
return 'Unknown Section Type'
|
||||||
|
return self.section_type_map[type]
|
||||||
|
|
||||||
|
def Dump(self):
|
||||||
|
print 'size = 0x%X' % self.GetSectionSize()
|
||||||
|
print 'type = 0x%X' % self.GetType()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rMapEntry = re.compile('^(\w+)[ \(\w\)]* \(BaseAddress=([0-9a-fA-F]+), EntryPoint=([0-9a-fA-F]+), GUID=([0-9a-fA-F\-]+)')
|
||||||
|
class EfiFvMapFile(object):
|
||||||
|
def __init__(self):
|
||||||
|
self._mapentries = {}
|
||||||
|
|
||||||
|
def Load(self, path):
|
||||||
|
if not os.path.exists(path):
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
file = open(path, 'r')
|
||||||
|
lines = file.readlines()
|
||||||
|
file.close()
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
if line[0] != ' ':
|
||||||
|
# new entry
|
||||||
|
ret = rMapEntry.match(line)
|
||||||
|
if ret != None:
|
||||||
|
name = ret.groups()[0]
|
||||||
|
baseaddr = int(ret.groups()[1], 16)
|
||||||
|
entry = int(ret.groups()[2], 16)
|
||||||
|
guidstr = '{' + ret.groups()[3] + '}'
|
||||||
|
guid = uuid.UUID(guidstr)
|
||||||
|
self._mapentries[guid] = EfiFvMapFileEntry(name, baseaddr, entry, guid)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetEntry(self, guid):
|
||||||
|
if guid in self._mapentries.keys():
|
||||||
|
return self._mapentries[guid]
|
||||||
|
return None
|
||||||
|
|
||||||
|
class EfiFvMapFileEntry(object):
|
||||||
|
def __init__(self, name, baseaddr, entry, guid):
|
||||||
|
self._name = name
|
||||||
|
self._baseaddr = baseaddr
|
||||||
|
self._entry = entry
|
||||||
|
self._guid = guid
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetBaseAddress(self):
|
||||||
|
return self._baseaddr
|
||||||
|
|
||||||
|
def GetEntryPoint(self):
|
||||||
|
return self._entry
|
||||||
|
|
||||||
|
def list2guid(list):
|
||||||
|
val1 = list2int(list[0:4])
|
||||||
|
val2 = list2int(list[4:6])
|
||||||
|
val3 = list2int(list[6:8])
|
||||||
|
val4 = 0
|
||||||
|
for item in list[8:16]:
|
||||||
|
val4 = (val4 << 8) | int(item)
|
||||||
|
|
||||||
|
val = val1 << 12 * 8 | val2 << 10 * 8 | val3 << 8 * 8 | val4
|
||||||
|
guid = uuid.UUID(int=val)
|
||||||
|
return guid
|
||||||
|
|
||||||
|
def list2int(list):
|
||||||
|
val = 0
|
||||||
|
for index in range(len(list) - 1, -1, -1):
|
||||||
|
val = (val << 8) | int(list[index])
|
||||||
|
return val
|
||||||
|
|
||||||
|
def align(value, alignment):
|
||||||
|
return (value + ((alignment - value) & (alignment - 1)))
|
||||||
|
|
||||||
|
gInvalidGuid = uuid.UUID(int=0xffffffffffffffffffffffffffffffff)
|
||||||
|
def isValidGuid(guid):
|
||||||
|
if guid == gInvalidGuid:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
@@ -0,0 +1,480 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
from message import *
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
section_re = re.compile(r'^\[([\w., "]+)\]')
|
||||||
|
|
||||||
|
class BaseINIFile(object):
|
||||||
|
_objs = {}
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
"""Maintain only a single instance of this object
|
||||||
|
@return: instance of this class
|
||||||
|
|
||||||
|
"""
|
||||||
|
if len(args) == 0: return object.__new__(cls, *args, **kwargs)
|
||||||
|
filename = args[0]
|
||||||
|
parent = None
|
||||||
|
if len(args) > 1:
|
||||||
|
parent = args[1]
|
||||||
|
|
||||||
|
key = os.path.normpath(filename)
|
||||||
|
if key not in cls._objs.keys():
|
||||||
|
cls._objs[key] = object.__new__(cls, *args, **kwargs)
|
||||||
|
|
||||||
|
if parent != None:
|
||||||
|
cls._objs[key].AddParent(parent)
|
||||||
|
|
||||||
|
return cls._objs[key]
|
||||||
|
|
||||||
|
def __init__(self, filename=None, parent=None):
|
||||||
|
self._lines = []
|
||||||
|
self._sections = {}
|
||||||
|
self._filename = filename
|
||||||
|
self._globals = []
|
||||||
|
self._isModify = True
|
||||||
|
|
||||||
|
def AddParent(self, parent):
|
||||||
|
if parent == None: return
|
||||||
|
if not hasattr(self, "_parents"):
|
||||||
|
self._parents = []
|
||||||
|
|
||||||
|
if parent in self._parents:
|
||||||
|
ErrorMsg("Duplicate parent is found for INI file %s" % self._filename)
|
||||||
|
return
|
||||||
|
self._parents.append(parent)
|
||||||
|
|
||||||
|
def GetFilename(self):
|
||||||
|
return os.path.normpath(self._filename)
|
||||||
|
|
||||||
|
def IsModified(self):
|
||||||
|
return self._isModify
|
||||||
|
|
||||||
|
def Modify(self, modify=True, obj=None):
|
||||||
|
if modify == self._isModify: return
|
||||||
|
self._isModify = modify
|
||||||
|
if modify:
|
||||||
|
for parent in self._parents:
|
||||||
|
parent.Modify(True, self)
|
||||||
|
|
||||||
|
def _ReadLines(self, filename):
|
||||||
|
#
|
||||||
|
# try to open file
|
||||||
|
#
|
||||||
|
if not os.path.exists(filename):
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
handle = open(filename, 'r')
|
||||||
|
self._lines = handle.readlines()
|
||||||
|
handle.close()
|
||||||
|
except:
|
||||||
|
raise EdkException("Fail to open file %s" % filename)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetSectionInstance(self, parent, name, isCombined=False):
|
||||||
|
return BaseINISection(parent, name, isCombined)
|
||||||
|
|
||||||
|
def GetSectionByName(self, name):
|
||||||
|
arr = []
|
||||||
|
for key in self._sections.keys():
|
||||||
|
if '.private' in key:
|
||||||
|
continue
|
||||||
|
for item in self._sections[key]:
|
||||||
|
if item.GetBaseName().lower().find(name.lower()) != -1:
|
||||||
|
arr.append(item)
|
||||||
|
return arr
|
||||||
|
|
||||||
|
def GetSectionObjectsByName(self, name):
|
||||||
|
arr = []
|
||||||
|
sects = self.GetSectionByName(name)
|
||||||
|
for sect in sects:
|
||||||
|
for obj in sect.GetObjects():
|
||||||
|
arr.append(obj)
|
||||||
|
return arr
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
if not self._isModify: return True
|
||||||
|
if not self._ReadLines(self._filename): return False
|
||||||
|
|
||||||
|
sObjs = []
|
||||||
|
inGlobal = True
|
||||||
|
# process line
|
||||||
|
for index in range(len(self._lines)):
|
||||||
|
templine = self._lines[index].strip()
|
||||||
|
# skip comments
|
||||||
|
if len(templine) == 0: continue
|
||||||
|
if re.match("^\[=*\]", templine) or re.match("^#", templine) or \
|
||||||
|
re.match("\*+/", templine):
|
||||||
|
continue
|
||||||
|
|
||||||
|
m = section_re.match(templine)
|
||||||
|
if m!= None: # found a section
|
||||||
|
inGlobal = False
|
||||||
|
# Finish the latest section first
|
||||||
|
if len(sObjs) != 0:
|
||||||
|
for sObj in sObjs:
|
||||||
|
sObj._end = index - 1
|
||||||
|
if not sObj.Parse():
|
||||||
|
ErrorMsg("Fail to parse section %s" % sObj.GetBaseName(),
|
||||||
|
self._filename,
|
||||||
|
sObj._start)
|
||||||
|
|
||||||
|
# start new section
|
||||||
|
sname_arr = m.groups()[0].split(',')
|
||||||
|
sObjs = []
|
||||||
|
for name in sname_arr:
|
||||||
|
sObj = self.GetSectionInstance(self, name, (len(sname_arr) > 1))
|
||||||
|
sObj._start = index
|
||||||
|
sObjs.append(sObj)
|
||||||
|
if not self._sections.has_key(name.lower()):
|
||||||
|
self._sections[name.lower()] = [sObj]
|
||||||
|
else:
|
||||||
|
self._sections[name.lower()].append(sObj)
|
||||||
|
elif inGlobal: # not start any section and find global object
|
||||||
|
gObj = BaseINIGlobalObject(self)
|
||||||
|
gObj._start = index
|
||||||
|
gObj.Parse()
|
||||||
|
self._globals.append(gObj)
|
||||||
|
|
||||||
|
# Finish the last section
|
||||||
|
if len(sObjs) != 0:
|
||||||
|
for sObj in sObjs:
|
||||||
|
sObj._end = index
|
||||||
|
if not sObj.Parse():
|
||||||
|
ErrorMsg("Fail to parse section %s" % sObj.GetBaseName(),
|
||||||
|
self._filename,
|
||||||
|
sObj._start)
|
||||||
|
|
||||||
|
self._isModify = False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Destroy(self, parent):
|
||||||
|
|
||||||
|
# check referenced parent
|
||||||
|
if parent != None:
|
||||||
|
assert parent in self._parents, "when destory ini object, can not found parent reference!"
|
||||||
|
self._parents.remove(parent)
|
||||||
|
|
||||||
|
if len(self._parents) != 0: return
|
||||||
|
|
||||||
|
for sects in self._sections.values():
|
||||||
|
for sect in sects:
|
||||||
|
sect.Destroy()
|
||||||
|
|
||||||
|
# dereference from _objs array
|
||||||
|
assert self.GetFilename() in self._objs.keys(), "When destroy ini object, can not find obj reference!"
|
||||||
|
assert self in self._objs.values(), "When destroy ini object, can not find obj reference!"
|
||||||
|
del self._objs[self.GetFilename()]
|
||||||
|
|
||||||
|
# dereference self
|
||||||
|
self.Clear()
|
||||||
|
|
||||||
|
def GetDefine(self, name):
|
||||||
|
sects = self.GetSectionByName('Defines')
|
||||||
|
for sect in sects:
|
||||||
|
for obj in sect.GetObjects():
|
||||||
|
line = obj.GetLineByOffset(obj._start).split('#')[0].strip()
|
||||||
|
arr = line.split('=')
|
||||||
|
if arr[0].strip().lower() == name.strip().lower():
|
||||||
|
return arr[1].strip()
|
||||||
|
return None
|
||||||
|
|
||||||
|
def Clear(self):
|
||||||
|
for sects in self._sections.values():
|
||||||
|
for sect in sects:
|
||||||
|
del sect
|
||||||
|
self._sections.clear()
|
||||||
|
for gObj in self._globals:
|
||||||
|
del gObj
|
||||||
|
|
||||||
|
del self._globals[:]
|
||||||
|
del self._lines[:]
|
||||||
|
|
||||||
|
def Reload(self):
|
||||||
|
self.Clear()
|
||||||
|
ret = self.Parse()
|
||||||
|
if ret:
|
||||||
|
self._isModify = False
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def AddNewSection(self, sectName):
|
||||||
|
if sectName.lower() in self._sections.keys():
|
||||||
|
ErrorMsg('Section %s can not be created for conflict with existing section')
|
||||||
|
return None
|
||||||
|
|
||||||
|
sectionObj = self.GetSectionInstance(self, sectName)
|
||||||
|
sectionObj._start = len(self._lines)
|
||||||
|
sectionObj._end = len(self._lines) + 1
|
||||||
|
self._lines.append('[%s]\n' % sectName)
|
||||||
|
self._lines.append('\n\n')
|
||||||
|
self._sections[sectName.lower()] = sectionObj
|
||||||
|
return sectionObj
|
||||||
|
|
||||||
|
def CopySectionsByName(self, oldDscObj, nameStr):
|
||||||
|
sects = oldDscObj.GetSectionByName(nameStr)
|
||||||
|
for sect in sects:
|
||||||
|
sectObj = self.AddNewSection(sect.GetName())
|
||||||
|
sectObj.Copy(sect)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return ''.join(self._lines)
|
||||||
|
|
||||||
|
## Get file header's comment from basic INI file.
|
||||||
|
# The file comments has two style:
|
||||||
|
# 1) #/** @file
|
||||||
|
# 2) ## @file
|
||||||
|
#
|
||||||
|
def GetFileHeader(self):
|
||||||
|
desc = []
|
||||||
|
lineArr = self._lines
|
||||||
|
inHeader = False
|
||||||
|
for num in range(len(self._lines)):
|
||||||
|
line = lineArr[num].strip()
|
||||||
|
if not inHeader and (line.startswith("#/**") or line.startswith("##")) and \
|
||||||
|
line.find("@file") != -1:
|
||||||
|
inHeader = True
|
||||||
|
continue
|
||||||
|
if inHeader and (line.startswith("#**/") or line.startswith('##')):
|
||||||
|
inHeader = False
|
||||||
|
break
|
||||||
|
if inHeader:
|
||||||
|
prefixIndex = line.find('#')
|
||||||
|
if prefixIndex == -1:
|
||||||
|
desc.append(line)
|
||||||
|
else:
|
||||||
|
desc.append(line[prefixIndex + 1:])
|
||||||
|
return '<br>\n'.join(desc)
|
||||||
|
|
||||||
|
class BaseINISection(object):
|
||||||
|
def __init__(self, parent, name, isCombined=False):
|
||||||
|
self._parent = parent
|
||||||
|
self._name = name
|
||||||
|
self._isCombined = isCombined
|
||||||
|
self._start = 0
|
||||||
|
self._end = 0
|
||||||
|
self._objs = []
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
for obj in self._objs:
|
||||||
|
del obj
|
||||||
|
del self._objs[:]
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetObjects(self):
|
||||||
|
return self._objs
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._parent
|
||||||
|
|
||||||
|
def GetStartLinenumber(self):
|
||||||
|
return self._start
|
||||||
|
|
||||||
|
def GetEndLinenumber(self):
|
||||||
|
return self._end
|
||||||
|
|
||||||
|
def GetLine(self, linenumber):
|
||||||
|
return self._parent._lines[linenumber]
|
||||||
|
|
||||||
|
def GetFilename(self):
|
||||||
|
return self._parent.GetFilename()
|
||||||
|
|
||||||
|
def GetSectionINIObject(self, parent):
|
||||||
|
return BaseINISectionObject(parent)
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
# skip first line in section, it is used by section name
|
||||||
|
visit = self._start + 1
|
||||||
|
iniObj = None
|
||||||
|
while (visit <= self._end):
|
||||||
|
line = self.GetLine(visit).strip()
|
||||||
|
if re.match("^\[=*\]", line) or re.match("^#", line) or len(line) == 0:
|
||||||
|
visit += 1
|
||||||
|
continue
|
||||||
|
line = line.split('#')[0].strip()
|
||||||
|
if iniObj != None:
|
||||||
|
if line.endswith('}'):
|
||||||
|
iniObj._end = visit - self._start
|
||||||
|
if not iniObj.Parse():
|
||||||
|
ErrorMsg("Fail to parse ini object",
|
||||||
|
self.GetFilename(),
|
||||||
|
iniObj.GetStartLinenumber())
|
||||||
|
else:
|
||||||
|
self._objs.append(iniObj)
|
||||||
|
iniObj = None
|
||||||
|
else:
|
||||||
|
iniObj = self.GetSectionINIObject(self)
|
||||||
|
iniObj._start = visit - self._start
|
||||||
|
if not line.endswith('{'):
|
||||||
|
iniObj._end = visit - self._start
|
||||||
|
if not iniObj.Parse():
|
||||||
|
ErrorMsg("Fail to parse ini object",
|
||||||
|
self.GetFilename(),
|
||||||
|
iniObj.GetStartLinenumber())
|
||||||
|
else:
|
||||||
|
self._objs.append(iniObj)
|
||||||
|
iniObj = None
|
||||||
|
visit += 1
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
for obj in self._objs:
|
||||||
|
obj.Destroy()
|
||||||
|
|
||||||
|
def GetBaseName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def AddLine(self, line):
|
||||||
|
end = self.GetEndLinenumber()
|
||||||
|
self._parent._lines.insert(end, line)
|
||||||
|
self._end += 1
|
||||||
|
|
||||||
|
def Copy(self, sectObj):
|
||||||
|
index = sectObj.GetStartLinenumber() + 1
|
||||||
|
while index < sectObj.GetEndLinenumber():
|
||||||
|
line = sectObj.GetLine(index)
|
||||||
|
if not line.strip().startswith('#'):
|
||||||
|
self.AddLine(line)
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
def AddObject(self, obj):
|
||||||
|
lines = obj.GenerateLines()
|
||||||
|
for line in lines:
|
||||||
|
self.AddLine(line)
|
||||||
|
|
||||||
|
def GetComment(self):
|
||||||
|
comments = []
|
||||||
|
start = self._start - 1
|
||||||
|
bFound = False
|
||||||
|
|
||||||
|
while (start > 0):
|
||||||
|
line = self.GetLine(start).strip()
|
||||||
|
if len(line) == 0:
|
||||||
|
start -= 1
|
||||||
|
continue
|
||||||
|
if line.startswith('##'):
|
||||||
|
bFound = True
|
||||||
|
index = line.rfind('#')
|
||||||
|
if (index + 1) < len(line):
|
||||||
|
comments.append(line[index + 1:])
|
||||||
|
break
|
||||||
|
if line.startswith('#'):
|
||||||
|
start -= 1
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
if bFound:
|
||||||
|
end = start + 1
|
||||||
|
while (end < self._start):
|
||||||
|
line = self.GetLine(end).strip()
|
||||||
|
if len(line) == 0: break
|
||||||
|
if not line.startswith('#'): break
|
||||||
|
index = line.rfind('#')
|
||||||
|
if (index + 1) < len(line):
|
||||||
|
comments.append(line[index + 1:])
|
||||||
|
end += 1
|
||||||
|
return comments
|
||||||
|
|
||||||
|
class BaseINIGlobalObject(object):
|
||||||
|
def __init__(self, parent):
|
||||||
|
self._start = 0
|
||||||
|
self._end = 0
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return parent._lines[self._start]
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class BaseINISectionObject(object):
|
||||||
|
def __init__(self, parent):
|
||||||
|
self._start = 0
|
||||||
|
self._end = 0
|
||||||
|
self._parent = parent
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self._parent = None
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._parent
|
||||||
|
|
||||||
|
def GetFilename(self):
|
||||||
|
return self.GetParent().GetFilename()
|
||||||
|
|
||||||
|
def GetPackageName(self):
|
||||||
|
return self.GetFilename()
|
||||||
|
|
||||||
|
def GetFileObj(self):
|
||||||
|
return self.GetParent().GetParent()
|
||||||
|
|
||||||
|
def GetStartLinenumber(self):
|
||||||
|
return self.GetParent()._start + self._start
|
||||||
|
|
||||||
|
def GetLineByOffset(self, offset):
|
||||||
|
sect_start = self._parent.GetStartLinenumber()
|
||||||
|
linenumber = sect_start + offset
|
||||||
|
return self._parent.GetLine(linenumber)
|
||||||
|
|
||||||
|
def GetLinenumberByOffset(self, offset):
|
||||||
|
return offset + self._parent.GetStartLinenumber()
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.GetLineByOffset(self._start).strip()
|
||||||
|
|
||||||
|
def GenerateLines(self):
|
||||||
|
return ['default setion object string\n']
|
||||||
|
|
||||||
|
def GetComment(self):
|
||||||
|
comments = []
|
||||||
|
start = self.GetStartLinenumber() - 1
|
||||||
|
bFound = False
|
||||||
|
|
||||||
|
while (start > 0):
|
||||||
|
line = self.GetParent().GetLine(start).strip()
|
||||||
|
if len(line) == 0:
|
||||||
|
start -= 1
|
||||||
|
continue
|
||||||
|
if line.startswith('##'):
|
||||||
|
bFound = True
|
||||||
|
index = line.rfind('#')
|
||||||
|
if (index + 1) < len(line):
|
||||||
|
comments.append(line[index + 1:])
|
||||||
|
break
|
||||||
|
if line.startswith('#'):
|
||||||
|
start -= 1
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
if bFound:
|
||||||
|
end = start + 1
|
||||||
|
while (end <= self.GetStartLinenumber() - 1):
|
||||||
|
line = self.GetParent().GetLine(end).strip()
|
||||||
|
if len(line) == 0: break
|
||||||
|
if not line.startswith('#'): break
|
||||||
|
index = line.rfind('#')
|
||||||
|
if (index + 1) < len(line):
|
||||||
|
comments.append(line[index + 1:])
|
||||||
|
end += 1
|
||||||
|
return comments
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import core.editor
|
||||||
|
|
||||||
|
class INIDoc(core.editor.EditorDocument):
|
||||||
|
def __init__(self):
|
||||||
|
core.editor.EditorDocument.__init__(self)
|
||||||
|
self._iniobj = None
|
||||||
|
|
||||||
|
|
||||||
|
class INIView(core.editor.EditorView):
|
||||||
|
pass
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
def GetEdkLogger():
|
||||||
|
import logging
|
||||||
|
return logging.getLogger('edk')
|
||||||
|
|
||||||
|
class EdkException(Exception):
|
||||||
|
def __init__(self, message, fName=None, fNo=None):
|
||||||
|
self._message = message
|
||||||
|
ErrorMsg(message, fName, fNo)
|
||||||
|
|
||||||
|
def GetMessage(self):
|
||||||
|
return '[EDK Failure]: %s' %self._message
|
||||||
|
|
||||||
|
def ErrorMsg(mess, fName=None, fNo=None):
|
||||||
|
GetEdkLogger().error(NormalMessage('#ERR#', mess, fName, fNo))
|
||||||
|
|
||||||
|
def LogMsg(mess, fName=None, fNo=None):
|
||||||
|
GetEdkLogger().info(NormalMessage('@LOG@', mess, fName, fNo))
|
||||||
|
|
||||||
|
def WarnMsg(mess, fName=None, fNo=None):
|
||||||
|
GetEdkLogger().warning(NormalMessage('!WAR!', mess, fName, fNo))
|
||||||
|
|
||||||
|
def NormalMessage(type, mess, fName=None, fNo=None):
|
||||||
|
strMsg = type
|
||||||
|
|
||||||
|
if fName != None:
|
||||||
|
strMsg += ' %s' % fName.replace('/', '\\')
|
||||||
|
if fNo != None:
|
||||||
|
strMsg += '(%d):' % fNo
|
||||||
|
else:
|
||||||
|
strMsg += ' :'
|
||||||
|
|
||||||
|
if fName == None and fNo == None:
|
||||||
|
strMsg += ' '
|
||||||
|
strMsg += mess
|
||||||
|
|
||||||
|
return strMsg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
@@ -0,0 +1,934 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
import plugins.EdkPlugins.basemodel.ini as ini
|
||||||
|
import plugins.EdkPlugins.edk2.model.dsc as dsc
|
||||||
|
import plugins.EdkPlugins.edk2.model.inf as inf
|
||||||
|
import plugins.EdkPlugins.edk2.model.dec as dec
|
||||||
|
import os
|
||||||
|
from plugins.EdkPlugins.basemodel.message import *
|
||||||
|
|
||||||
|
class SurfaceObject(object):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
"""Maintain only a single instance of this object
|
||||||
|
@return: instance of this class
|
||||||
|
|
||||||
|
"""
|
||||||
|
obj = object.__new__(cls, *args, **kwargs)
|
||||||
|
if not cls._objs.has_key("None"):
|
||||||
|
cls._objs["None"] = []
|
||||||
|
cls._objs["None"].append(obj)
|
||||||
|
|
||||||
|
return obj
|
||||||
|
|
||||||
|
def __init__(self, parent, workspace):
|
||||||
|
self._parent = parent
|
||||||
|
self._fileObj = None
|
||||||
|
self._workspace = workspace
|
||||||
|
self._isModify = False
|
||||||
|
self._modifiedObjs = []
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
key = self.GetRelativeFilename()
|
||||||
|
self.GetFileObj().Destroy(self)
|
||||||
|
del self._fileObj
|
||||||
|
# dereference self from _objs arrary
|
||||||
|
assert self._objs.has_key(key), "when destory, object is not in obj list"
|
||||||
|
assert self in self._objs[key], "when destory, object is not in obj list"
|
||||||
|
self._objs[key].remove(self)
|
||||||
|
if len(self._objs[key]) == 0:
|
||||||
|
del self._objs[key]
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._parent
|
||||||
|
|
||||||
|
def GetWorkspace(self):
|
||||||
|
return self._workspace
|
||||||
|
|
||||||
|
def GetFileObjectClass(self):
|
||||||
|
return ini.BaseINIFile
|
||||||
|
|
||||||
|
def GetFilename(self):
|
||||||
|
return self.GetFileObj().GetFilename()
|
||||||
|
|
||||||
|
def GetFileObj(self):
|
||||||
|
return self._fileObj
|
||||||
|
|
||||||
|
def GetRelativeFilename(self):
|
||||||
|
fullPath = self.GetFilename()
|
||||||
|
return fullPath[len(self._workspace) + 1:]
|
||||||
|
|
||||||
|
def Load(self, relativePath):
|
||||||
|
# if has been loaded, directly return
|
||||||
|
if self._fileObj != None: return True
|
||||||
|
|
||||||
|
relativePath = os.path.normpath(relativePath)
|
||||||
|
fullPath = os.path.join(self._workspace, relativePath)
|
||||||
|
fullPath = os.path.normpath(fullPath)
|
||||||
|
|
||||||
|
if not os.path.exists(fullPath):
|
||||||
|
ErrorMsg("file does not exist!", fullPath)
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._fileObj = self.GetFileObjectClass()(fullPath, self)
|
||||||
|
|
||||||
|
if not self._fileObj.Parse():
|
||||||
|
ErrorMsg("Fail to parse file!", fullPath)
|
||||||
|
return False
|
||||||
|
|
||||||
|
# remove self from None list to list with filename as key
|
||||||
|
cls = self.__class__
|
||||||
|
if self not in cls._objs["None"]:
|
||||||
|
ErrorMsg("Sufrace object does not be create into None list")
|
||||||
|
cls._objs["None"].remove(self)
|
||||||
|
if not cls._objs.has_key(relativePath):
|
||||||
|
cls._objs[relativePath] = []
|
||||||
|
cls._objs[relativePath].append(self)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Reload(self, force=False):
|
||||||
|
ret = True
|
||||||
|
# whether require must be update
|
||||||
|
if force:
|
||||||
|
ret = self.GetFileObj().Reload(True)
|
||||||
|
else:
|
||||||
|
if self.IsModified():
|
||||||
|
if self.GetFileObj().IsModified():
|
||||||
|
ret = self.GetFileObj().Reload()
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def Modify(self, modify=True, modifiedObj=None):
|
||||||
|
if modify:
|
||||||
|
#LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
|
||||||
|
if issubclass(modifiedObj.__class__, ini.BaseINIFile) and self._isModify:
|
||||||
|
return
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
else:
|
||||||
|
self._isModify = modify
|
||||||
|
|
||||||
|
def IsModified(self):
|
||||||
|
return self._isModify
|
||||||
|
|
||||||
|
def GetModifiedObjs(self):
|
||||||
|
return self._modifiedObjs
|
||||||
|
|
||||||
|
def FilterObjsByArch(self, objs, arch):
|
||||||
|
arr = []
|
||||||
|
for obj in objs:
|
||||||
|
if obj.GetArch().lower() == 'common':
|
||||||
|
arr.append(obj)
|
||||||
|
continue
|
||||||
|
if obj.GetArch().lower() == arch.lower():
|
||||||
|
arr.append(obj)
|
||||||
|
continue
|
||||||
|
return arr
|
||||||
|
|
||||||
|
class Platform(SurfaceObject):
|
||||||
|
def __init__(self, parent, workspace):
|
||||||
|
SurfaceObject.__init__(self, parent, workspace)
|
||||||
|
self._modules = []
|
||||||
|
self._packages = []
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
for module in self._modules:
|
||||||
|
module.Destroy()
|
||||||
|
del self._modules[:]
|
||||||
|
|
||||||
|
del self._packages[:]
|
||||||
|
SurfaceObject.Destroy(self)
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.GetFileObj().GetDefine("PLATFORM_NAME")
|
||||||
|
|
||||||
|
def GetFileObjectClass(self):
|
||||||
|
return dsc.DSCFile
|
||||||
|
|
||||||
|
def GetModuleCount(self):
|
||||||
|
if self.GetFileObj() == None:
|
||||||
|
ErrorMsg("Fail to get module count because DSC file has not been load!")
|
||||||
|
|
||||||
|
return len(self.GetFileObj().GetComponents())
|
||||||
|
|
||||||
|
def GetSupportArchs(self):
|
||||||
|
return self.GetFileObj().GetDefine("SUPPORTED_ARCHITECTURES").strip().split('#')[0].split('|')
|
||||||
|
|
||||||
|
def LoadModules(self, precallback=None, postcallback=None):
|
||||||
|
for obj in self.GetFileObj().GetComponents():
|
||||||
|
mFilename = obj.GetFilename()
|
||||||
|
if precallback != None:
|
||||||
|
precallback(self, mFilename)
|
||||||
|
arch = obj.GetArch()
|
||||||
|
if arch.lower() == 'common':
|
||||||
|
archarr = self.GetSupportArchs()
|
||||||
|
else:
|
||||||
|
archarr = [arch]
|
||||||
|
for arch in archarr:
|
||||||
|
module = Module(self, self.GetWorkspace())
|
||||||
|
if module.Load(mFilename, arch, obj.GetOveridePcds(), obj.GetOverideLibs()):
|
||||||
|
self._modules.append(module)
|
||||||
|
if postcallback != None:
|
||||||
|
postcallback(self, module)
|
||||||
|
else:
|
||||||
|
del module
|
||||||
|
ErrorMsg("Fail to load module %s" % mFilename)
|
||||||
|
|
||||||
|
def GetModules(self):
|
||||||
|
return self._modules
|
||||||
|
|
||||||
|
def GetLibraryPath(self, classname, arch, type):
|
||||||
|
objs = self.GetFileObj().GetSectionObjectsByName("libraryclasses")
|
||||||
|
|
||||||
|
for obj in objs:
|
||||||
|
if classname.lower() != obj.GetClass().lower():
|
||||||
|
continue
|
||||||
|
if obj.GetArch().lower() != 'common' and \
|
||||||
|
obj.GetArch().lower() != arch.lower():
|
||||||
|
continue
|
||||||
|
|
||||||
|
if obj.GetModuleType().lower() != 'common' and \
|
||||||
|
obj.GetModuleType().lower() != type.lower():
|
||||||
|
continue
|
||||||
|
|
||||||
|
return obj.GetInstance()
|
||||||
|
|
||||||
|
ErrorMsg("Fail to get library class %s [%s][%s] from platform %s" % (classname, arch, type, self.GetFilename()))
|
||||||
|
return None
|
||||||
|
|
||||||
|
def GetPackage(self, path):
|
||||||
|
package = self.GetParent().GetPackage(path)
|
||||||
|
if package not in self._packages:
|
||||||
|
self._packages.append(package)
|
||||||
|
return package
|
||||||
|
|
||||||
|
def GetPcdBuildObjs(self, name, arch=None):
|
||||||
|
arr = []
|
||||||
|
objs = self.GetFileObj().GetSectionObjectsByName('pcds')
|
||||||
|
for obj in objs:
|
||||||
|
if obj.GetPcdName().lower() == name.lower():
|
||||||
|
arr.append(obj)
|
||||||
|
if arch != None:
|
||||||
|
arr = self.FilterObjsByArch(arr, arch)
|
||||||
|
return arr
|
||||||
|
|
||||||
|
def Reload(self, callback=None):
|
||||||
|
# do not care force paramter for platform object
|
||||||
|
isFileChanged = self.GetFileObj().IsModified()
|
||||||
|
ret = SurfaceObject.Reload(self, False)
|
||||||
|
if not ret: return False
|
||||||
|
if isFileChanged:
|
||||||
|
# destroy all modules and reload them again
|
||||||
|
for obj in self._modules:
|
||||||
|
obj.Destroy()
|
||||||
|
del self._modules[:]
|
||||||
|
del self._packages[:]
|
||||||
|
self.LoadModules(callback)
|
||||||
|
else:
|
||||||
|
for obj in self._modules:
|
||||||
|
callback(self, obj.GetFilename())
|
||||||
|
obj.Reload()
|
||||||
|
|
||||||
|
self.Modify(False)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Modify(self, modify=True, modifiedObj=None):
|
||||||
|
if modify:
|
||||||
|
#LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
|
||||||
|
if issubclass(modifiedObj.__class__, ini.BaseINIFile) and self._isModify:
|
||||||
|
return
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
else:
|
||||||
|
if self.GetFileObj().IsModified():
|
||||||
|
return
|
||||||
|
for obj in self._modules:
|
||||||
|
if obj.IsModified():
|
||||||
|
return
|
||||||
|
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
|
||||||
|
def GetModuleObject(self, relativePath, arch):
|
||||||
|
path = os.path.normpath(relativePath)
|
||||||
|
for obj in self._modules:
|
||||||
|
if obj.GetRelativeFilename() == path:
|
||||||
|
if arch.lower() == 'common':
|
||||||
|
return obj
|
||||||
|
if obj.GetArch() == arch:
|
||||||
|
return obj
|
||||||
|
return None
|
||||||
|
|
||||||
|
def GenerateFullReferenceDsc(self):
|
||||||
|
oldDsc = self.GetFileObj()
|
||||||
|
newDsc = dsc.DSCFile()
|
||||||
|
newDsc.CopySectionsByName(oldDsc, 'defines')
|
||||||
|
newDsc.CopySectionsByName(oldDsc, 'SkuIds')
|
||||||
|
|
||||||
|
#
|
||||||
|
# Dynamic common section should also be copied
|
||||||
|
#
|
||||||
|
newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicDefault')
|
||||||
|
newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicHii')
|
||||||
|
newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicVpd')
|
||||||
|
newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicEx')
|
||||||
|
|
||||||
|
sects = oldDsc.GetSectionByName('Components')
|
||||||
|
for oldSect in sects:
|
||||||
|
newSect = newDsc.AddNewSection(oldSect.GetName())
|
||||||
|
for oldComObj in oldSect.GetObjects():
|
||||||
|
module = self.GetModuleObject(oldComObj.GetFilename(), oldSect.GetArch())
|
||||||
|
if module == None: continue
|
||||||
|
|
||||||
|
newComObj = dsc.DSCComponentObject(newSect)
|
||||||
|
newComObj.SetFilename(oldComObj.GetFilename())
|
||||||
|
|
||||||
|
# add all library instance for override section
|
||||||
|
libdict = module.GetLibraries()
|
||||||
|
for libclass in libdict.keys():
|
||||||
|
if libdict[libclass] != None:
|
||||||
|
newComObj.AddOverideLib(libclass, libdict[libclass].GetRelativeFilename().replace('\\', '/'))
|
||||||
|
|
||||||
|
# add all pcds for override section
|
||||||
|
pcddict = module.GetPcds()
|
||||||
|
for pcd in pcddict.values():
|
||||||
|
buildPcd = pcd.GetBuildObj()
|
||||||
|
buildType = buildPcd.GetPcdType()
|
||||||
|
buildValue = None
|
||||||
|
if buildType.lower() == 'pcdsdynamichii' or \
|
||||||
|
buildType.lower() == 'pcdsdynamicvpd' or \
|
||||||
|
buildType.lower() == 'pcdsdynamicdefault':
|
||||||
|
buildType = 'PcdsDynamic'
|
||||||
|
if buildType != 'PcdsDynamic':
|
||||||
|
buildValue = buildPcd.GetPcdValue()
|
||||||
|
newComObj.AddOveridePcd(buildPcd.GetPcdName(),
|
||||||
|
buildType,
|
||||||
|
buildValue)
|
||||||
|
newSect.AddObject(newComObj)
|
||||||
|
return newDsc
|
||||||
|
|
||||||
|
class Module(SurfaceObject):
|
||||||
|
def __init__(self, parent, workspace):
|
||||||
|
SurfaceObject.__init__(self, parent, workspace)
|
||||||
|
self._arch = 'common'
|
||||||
|
self._parent = parent
|
||||||
|
self._overidePcds = {}
|
||||||
|
self._overideLibs = {}
|
||||||
|
self._libs = {}
|
||||||
|
self._pcds = {}
|
||||||
|
self._ppis = []
|
||||||
|
self._protocols = []
|
||||||
|
self._depexs = []
|
||||||
|
self._guids = []
|
||||||
|
self._packages = []
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib != None:
|
||||||
|
lib.Destroy()
|
||||||
|
self._libs.clear()
|
||||||
|
|
||||||
|
for pcd in self._pcds.values():
|
||||||
|
pcd.Destroy()
|
||||||
|
self._pcds.clear()
|
||||||
|
|
||||||
|
for ppi in self._ppis:
|
||||||
|
ppi.DeRef(self)
|
||||||
|
del self._ppis[:]
|
||||||
|
|
||||||
|
for protocol in self._protocols:
|
||||||
|
if protocol != None:
|
||||||
|
protocol.DeRef(self)
|
||||||
|
del self._protocols[:]
|
||||||
|
|
||||||
|
for guid in self._guids:
|
||||||
|
if guid != None:
|
||||||
|
guid.DeRef(self)
|
||||||
|
del self._guids[:]
|
||||||
|
|
||||||
|
del self._packages[:]
|
||||||
|
del self._depexs[:]
|
||||||
|
SurfaceObject.Destroy(self)
|
||||||
|
|
||||||
|
def GetFileObjectClass(self):
|
||||||
|
return inf.INFFile
|
||||||
|
|
||||||
|
def GetLibraries(self):
|
||||||
|
return self._libs
|
||||||
|
|
||||||
|
def Load(self, filename, arch='common', overidePcds=None, overideLibs=None):
|
||||||
|
if not SurfaceObject.Load(self, filename):
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._arch = arch
|
||||||
|
if overidePcds != None:
|
||||||
|
self._overideLibs = overideLibs
|
||||||
|
if overideLibs != None:
|
||||||
|
self._overidePcds = overidePcds
|
||||||
|
|
||||||
|
self._SearchLibraries()
|
||||||
|
self._SearchPackage()
|
||||||
|
self._SearchSurfaceItems()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
return self._arch
|
||||||
|
|
||||||
|
def GetModuleName(self):
|
||||||
|
return self.GetFileObj().GetDefine("BASE_NAME")
|
||||||
|
|
||||||
|
def GetModuleType(self):
|
||||||
|
return self.GetFileObj().GetDefine("MODULE_TYPE")
|
||||||
|
|
||||||
|
def GetPlatform(self):
|
||||||
|
return self.GetParent()
|
||||||
|
|
||||||
|
def GetModuleObj(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def GetPcds(self):
|
||||||
|
pcds = self._pcds.copy()
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib == None: continue
|
||||||
|
for name in lib._pcds.keys():
|
||||||
|
pcds[name] = lib._pcds[name]
|
||||||
|
return pcds
|
||||||
|
|
||||||
|
def GetPpis(self):
|
||||||
|
ppis = []
|
||||||
|
ppis += self._ppis
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib == None: continue
|
||||||
|
ppis += lib._ppis
|
||||||
|
return ppis
|
||||||
|
|
||||||
|
def GetProtocols(self):
|
||||||
|
pros = []
|
||||||
|
pros = self._protocols
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib == None: continue
|
||||||
|
pros += lib._protocols
|
||||||
|
return pros
|
||||||
|
|
||||||
|
def GetGuids(self):
|
||||||
|
guids = []
|
||||||
|
guids += self._guids
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib == None: continue
|
||||||
|
guids += lib._guids
|
||||||
|
return guids
|
||||||
|
|
||||||
|
def GetDepexs(self):
|
||||||
|
deps = []
|
||||||
|
deps += self._depexs
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib == None: continue
|
||||||
|
deps += lib._depexs
|
||||||
|
return deps
|
||||||
|
|
||||||
|
def IsLibrary(self):
|
||||||
|
return self.GetFileObj().GetDefine("LIBRARY_CLASS") != None
|
||||||
|
|
||||||
|
def GetLibraryInstance(self, classname, arch, type):
|
||||||
|
if classname not in self._libs.keys():
|
||||||
|
# find in overide lib firstly
|
||||||
|
if classname in self._overideLibs.keys():
|
||||||
|
self._libs[classname] = Library(self, self.GetWorkspace())
|
||||||
|
self._libs[classname].Load(self._overideLibs[classname])
|
||||||
|
return self._libs[classname]
|
||||||
|
|
||||||
|
parent = self.GetParent()
|
||||||
|
if issubclass(parent.__class__, Platform):
|
||||||
|
path = parent.GetLibraryPath(classname, arch, type)
|
||||||
|
if path == None:
|
||||||
|
ErrorMsg('Fail to get library instance for %s' % classname, self.GetFilename())
|
||||||
|
return None
|
||||||
|
self._libs[classname] = Library(self, self.GetWorkspace())
|
||||||
|
if not self._libs[classname].Load(path, self.GetArch()):
|
||||||
|
self._libs[classname] = None
|
||||||
|
else:
|
||||||
|
self._libs[classname] = parent.GetLibraryInstance(classname, arch, type)
|
||||||
|
return self._libs[classname]
|
||||||
|
|
||||||
|
def GetSourceObjs(self):
|
||||||
|
return self.GetFileObj().GetSectionObjectsByName('source')
|
||||||
|
|
||||||
|
def _SearchLibraries(self):
|
||||||
|
objs = self.GetFileObj().GetSectionObjectsByName('libraryclasses')
|
||||||
|
arch = self.GetArch()
|
||||||
|
type = self.GetModuleType()
|
||||||
|
for obj in objs:
|
||||||
|
if obj.GetArch().lower() != 'common' and \
|
||||||
|
obj.GetArch().lower() not in self.GetPlatform().GetSupportArchs():
|
||||||
|
continue
|
||||||
|
classname = obj.GetClass()
|
||||||
|
instance = self.GetLibraryInstance(classname, arch, type)
|
||||||
|
if not self.IsLibrary() and instance != None:
|
||||||
|
instance._isInherit = False
|
||||||
|
|
||||||
|
if classname not in self._libs.keys():
|
||||||
|
self._libs[classname] = instance
|
||||||
|
|
||||||
|
def _SearchSurfaceItems(self):
|
||||||
|
# get surface item from self's inf
|
||||||
|
pcds = []
|
||||||
|
ppis = []
|
||||||
|
pros = []
|
||||||
|
deps = []
|
||||||
|
guids = []
|
||||||
|
if self.GetFileObj() != None:
|
||||||
|
pcds = self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('pcd'),
|
||||||
|
self.GetArch())
|
||||||
|
for pcd in pcds:
|
||||||
|
if pcd.GetPcdName() not in self._pcds.keys():
|
||||||
|
pcdItem = PcdItem(pcd.GetPcdName(), self, pcd)
|
||||||
|
self._pcds[pcd.GetPcdName()] = ModulePcd(self,
|
||||||
|
pcd.GetPcdName(),
|
||||||
|
pcd,
|
||||||
|
pcdItem)
|
||||||
|
|
||||||
|
ppis += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('ppis'),
|
||||||
|
self.GetArch())
|
||||||
|
|
||||||
|
for ppi in ppis:
|
||||||
|
item = PpiItem(ppi.GetName(), self, ppi)
|
||||||
|
if item not in self._ppis:
|
||||||
|
self._ppis.append(item)
|
||||||
|
|
||||||
|
pros += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('protocols'),
|
||||||
|
self.GetArch())
|
||||||
|
|
||||||
|
for pro in pros:
|
||||||
|
item = ProtocolItem(pro.GetName(), self, pro)
|
||||||
|
if item not in self._protocols:
|
||||||
|
self._protocols.append(item)
|
||||||
|
|
||||||
|
deps += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('depex'),
|
||||||
|
self.GetArch())
|
||||||
|
for dep in deps:
|
||||||
|
item = DepexItem(self, dep)
|
||||||
|
self._depexs.append(item)
|
||||||
|
|
||||||
|
guids += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('guids'),
|
||||||
|
self.GetArch())
|
||||||
|
for guid in guids:
|
||||||
|
item = GuidItem(guid.GetName(), self, guid)
|
||||||
|
if item not in self._guids:
|
||||||
|
self._guids.append(item)
|
||||||
|
|
||||||
|
def _SearchPackage(self):
|
||||||
|
objs = self.GetFileObj().GetSectionObjectsByName('packages')
|
||||||
|
for obj in objs:
|
||||||
|
package = self.GetPlatform().GetPackage(obj.GetPath())
|
||||||
|
if package != None:
|
||||||
|
self._packages.append(package)
|
||||||
|
|
||||||
|
def GetPackages(self):
|
||||||
|
return self._packages
|
||||||
|
|
||||||
|
def GetPcdObjects(self):
|
||||||
|
if self.GetFileObj() == None:
|
||||||
|
return []
|
||||||
|
|
||||||
|
return self.GetFileObj().GetSectionObjectsByName('pcd')
|
||||||
|
|
||||||
|
def GetLibraryClassHeaderFilePath(self):
|
||||||
|
lcname = self.GetFileObj().GetProduceLibraryClass()
|
||||||
|
if lcname == None: return None
|
||||||
|
|
||||||
|
pkgs = self.GetPackages()
|
||||||
|
for package in pkgs:
|
||||||
|
path = package.GetLibraryClassHeaderPathByName(lcname)
|
||||||
|
if path != None:
|
||||||
|
return os.path.realpath(os.path.join(package.GetFileObj().GetPackageRootPath(), path))
|
||||||
|
return None
|
||||||
|
|
||||||
|
def Reload(self, force=False, callback=None):
|
||||||
|
if callback != None:
|
||||||
|
callback(self, "Starting reload...")
|
||||||
|
|
||||||
|
ret = SurfaceObject.Reload(self, force)
|
||||||
|
if not ret: return False
|
||||||
|
|
||||||
|
if not force and not self.IsModified():
|
||||||
|
return True
|
||||||
|
|
||||||
|
for lib in self._libs.values():
|
||||||
|
if lib != None:
|
||||||
|
lib.Destroy()
|
||||||
|
self._libs.clear()
|
||||||
|
|
||||||
|
for pcd in self._pcds.values():
|
||||||
|
pcd.Destroy()
|
||||||
|
self._pcds.clear()
|
||||||
|
|
||||||
|
for ppi in self._ppis:
|
||||||
|
ppi.DeRef(self)
|
||||||
|
del self._ppis[:]
|
||||||
|
|
||||||
|
for protocol in self._protocols:
|
||||||
|
protocol.DeRef(self)
|
||||||
|
del self._protocols[:]
|
||||||
|
|
||||||
|
for guid in self._guids:
|
||||||
|
guid.DeRef(self)
|
||||||
|
del self._guids[:]
|
||||||
|
|
||||||
|
del self._packages[:]
|
||||||
|
del self._depexs[:]
|
||||||
|
|
||||||
|
if callback != None:
|
||||||
|
callback(self, "Searching libraries...")
|
||||||
|
self._SearchLibraries()
|
||||||
|
if callback != None:
|
||||||
|
callback(self, "Searching packages...")
|
||||||
|
self._SearchPackage()
|
||||||
|
if callback != None:
|
||||||
|
callback(self, "Searching surface items...")
|
||||||
|
self._SearchSurfaceItems()
|
||||||
|
|
||||||
|
self.Modify(False)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Modify(self, modify=True, modifiedObj=None):
|
||||||
|
if modify:
|
||||||
|
#LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
|
||||||
|
if issubclass(modifiedObj.__class__, ini.BaseINIFile) and self._isModify:
|
||||||
|
return
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
else:
|
||||||
|
if self.GetFileObj().IsModified():
|
||||||
|
return
|
||||||
|
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
|
||||||
|
class Library(Module):
|
||||||
|
def __init__(self, parent, workspace):
|
||||||
|
Module.__init__(self, parent, workspace)
|
||||||
|
self._isInherit = True
|
||||||
|
|
||||||
|
def IsInherit(self):
|
||||||
|
return self._isInherit
|
||||||
|
|
||||||
|
def GetModuleType(self):
|
||||||
|
return self.GetParent().GetModuleType()
|
||||||
|
|
||||||
|
def GetPlatform(self):
|
||||||
|
return self.GetParent().GetParent()
|
||||||
|
|
||||||
|
def GetModuleObj(self):
|
||||||
|
return self.GetParent()
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
return self.GetParent().GetArch()
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
self._libs.clear()
|
||||||
|
self._pcds.clear()
|
||||||
|
SurfaceObject.Destroy(self)
|
||||||
|
|
||||||
|
class Package(SurfaceObject):
|
||||||
|
def __init__(self, parent, workspace):
|
||||||
|
SurfaceObject.__init__(self, parent, workspace)
|
||||||
|
self._pcds = {}
|
||||||
|
self._guids = {}
|
||||||
|
self._protocols = {}
|
||||||
|
self._ppis = {}
|
||||||
|
|
||||||
|
def GetPcds(self):
|
||||||
|
return self._pcds
|
||||||
|
|
||||||
|
def GetPpis(self):
|
||||||
|
return self._ppis.values()
|
||||||
|
|
||||||
|
def GetProtocols(self):
|
||||||
|
return self._protocols.values()
|
||||||
|
|
||||||
|
def GetGuids(self):
|
||||||
|
return self._guids.values()
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
for pcd in self._pcds.values():
|
||||||
|
if pcd != None:
|
||||||
|
pcd.Destroy()
|
||||||
|
for guid in self._guids.values():
|
||||||
|
if guid != None:
|
||||||
|
guid.Destroy()
|
||||||
|
for protocol in self._protocols.values():
|
||||||
|
if protocol != None:
|
||||||
|
protocol.Destroy()
|
||||||
|
for ppi in self._ppis.values():
|
||||||
|
if ppi != None:
|
||||||
|
ppi.Destroy()
|
||||||
|
self._pcds.clear()
|
||||||
|
self._guids.clear()
|
||||||
|
self._protocols.clear()
|
||||||
|
self._ppis.clear()
|
||||||
|
self._pcds.clear()
|
||||||
|
SurfaceObject.Destroy(self)
|
||||||
|
|
||||||
|
def Load(self, relativePath):
|
||||||
|
ret = SurfaceObject.Load(self, relativePath)
|
||||||
|
if not ret: return False
|
||||||
|
pcds = self.GetFileObj().GetSectionObjectsByName('pcds')
|
||||||
|
for pcd in pcds:
|
||||||
|
if pcd.GetPcdName() in self._pcds.keys():
|
||||||
|
if self._pcds[pcd.GetPcdName()] != None:
|
||||||
|
self._pcds[pcd.GetPcdName()].AddDecObj(pcd)
|
||||||
|
else:
|
||||||
|
self._pcds[pcd.GetPcdName()] = PcdItem(pcd.GetPcdName(), self, pcd)
|
||||||
|
|
||||||
|
guids = self.GetFileObj().GetSectionObjectsByName('guids')
|
||||||
|
for guid in guids:
|
||||||
|
if guid.GetName() not in self._guids.keys():
|
||||||
|
self._guids[guid.GetName()] = GuidItem(guid.GetName(), self, guid)
|
||||||
|
else:
|
||||||
|
WarnMsg("Duplicate definition for %s" % guid.GetName())
|
||||||
|
|
||||||
|
ppis = self.GetFileObj().GetSectionObjectsByName('ppis')
|
||||||
|
for ppi in ppis:
|
||||||
|
if ppi.GetName() not in self._ppis.keys():
|
||||||
|
self._ppis[ppi.GetName()] = PpiItem(ppi.GetName(), self, ppi)
|
||||||
|
else:
|
||||||
|
WarnMsg("Duplicate definition for %s" % ppi.GetName())
|
||||||
|
|
||||||
|
protocols = self.GetFileObj().GetSectionObjectsByName('protocols')
|
||||||
|
for protocol in protocols:
|
||||||
|
if protocol.GetName() not in self._protocols.keys():
|
||||||
|
self._protocols[protocol.GetName()] = ProtocolItem(protocol.GetName(), self, protocol)
|
||||||
|
else:
|
||||||
|
WarnMsg("Duplicate definition for %s" % protocol.GetName())
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetFileObjectClass(self):
|
||||||
|
return dec.DECFile
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.GetFileObj().GetDefine("PACKAGE_NAME")
|
||||||
|
|
||||||
|
def GetPcdDefineObjs(self, name=None):
|
||||||
|
arr = []
|
||||||
|
objs = self.GetFileObj().GetSectionObjectsByName('pcds')
|
||||||
|
if name == None: return objs
|
||||||
|
|
||||||
|
for obj in objs:
|
||||||
|
if obj.GetPcdName().lower() == name.lower():
|
||||||
|
arr.append(obj)
|
||||||
|
return arr
|
||||||
|
|
||||||
|
def GetLibraryClassObjs(self):
|
||||||
|
return self.GetFileObj().GetSectionObjectsByName('libraryclasses')
|
||||||
|
|
||||||
|
def Modify(self, modify=True, modifiedObj=None):
|
||||||
|
if modify:
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
else:
|
||||||
|
if self.GetFileObj().IsModified():
|
||||||
|
return
|
||||||
|
|
||||||
|
self._isModify = modify
|
||||||
|
self.GetParent().Modify(modify, self)
|
||||||
|
|
||||||
|
def GetLibraryClassHeaderPathByName(self, clsname):
|
||||||
|
objs = self.GetLibraryClassObjs()
|
||||||
|
for obj in objs:
|
||||||
|
if obj.GetClassName() == clsname:
|
||||||
|
return obj.GetHeaderFile()
|
||||||
|
return None
|
||||||
|
|
||||||
|
class DepexItem(object):
|
||||||
|
def __init__(self, parent, infObj):
|
||||||
|
self._parent = parent
|
||||||
|
self._infObj = infObj
|
||||||
|
|
||||||
|
def GetDepexString(self):
|
||||||
|
return str(self._infObj)
|
||||||
|
|
||||||
|
def GetInfObject(self):
|
||||||
|
return self._infObj
|
||||||
|
|
||||||
|
class ModulePcd(object):
|
||||||
|
_type_mapping = {'FeaturePcd': 'PcdsFeatureFlag',
|
||||||
|
'FixedPcd': 'PcdsFixedAtBuild',
|
||||||
|
'PatchPcd': 'PcdsPatchableInModule'}
|
||||||
|
|
||||||
|
def __init__(self, parent, name, infObj, pcdItem):
|
||||||
|
assert issubclass(parent.__class__, Module), "Module's PCD's parent must be module!"
|
||||||
|
assert pcdItem != None, 'Pcd %s does not in some package!' % name
|
||||||
|
|
||||||
|
self._name = name
|
||||||
|
self._parent = parent
|
||||||
|
self._pcdItem = pcdItem
|
||||||
|
self._infObj = infObj
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
return self._parent.GetArch()
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
self._pcdItem.DeRef(self._parent)
|
||||||
|
self._infObj = None
|
||||||
|
|
||||||
|
def GetBuildObj(self):
|
||||||
|
platformInfos = self._parent.GetPlatform().GetPcdBuildObjs(self._name, self.GetArch())
|
||||||
|
modulePcdType = self._infObj.GetPcdType()
|
||||||
|
|
||||||
|
# if platform do not gives pcd's value, get default value from package
|
||||||
|
if len(platformInfos) == 0:
|
||||||
|
if modulePcdType.lower() == 'pcd':
|
||||||
|
return self._pcdItem.GetDecObject()
|
||||||
|
else:
|
||||||
|
for obj in self._pcdItem.GetDecObjects():
|
||||||
|
if modulePcdType not in self._type_mapping.keys():
|
||||||
|
ErrorMsg("Invalid PCD type %s" % modulePcdType)
|
||||||
|
return None
|
||||||
|
|
||||||
|
if self._type_mapping[modulePcdType] == obj.GetPcdType():
|
||||||
|
return obj
|
||||||
|
ErrorMsg ('Module PCD type %s does not in valied range [%s] in package!' % \
|
||||||
|
(modulePcdType))
|
||||||
|
else:
|
||||||
|
if modulePcdType.lower() == 'pcd':
|
||||||
|
if len(platformInfos) > 1:
|
||||||
|
WarnMsg("Find more than one value for PCD %s in platform %s" % \
|
||||||
|
(self._name, self._parent.GetPlatform().GetFilename()))
|
||||||
|
return platformInfos[0]
|
||||||
|
else:
|
||||||
|
for obj in platformInfos:
|
||||||
|
if modulePcdType not in self._type_mapping.keys():
|
||||||
|
ErrorMsg("Invalid PCD type %s" % modulePcdType)
|
||||||
|
return None
|
||||||
|
|
||||||
|
if self._type_mapping[modulePcdType] == obj.GetPcdType():
|
||||||
|
return obj
|
||||||
|
|
||||||
|
ErrorMsg('Can not find value for pcd %s in pcd type %s' % \
|
||||||
|
(self._name, modulePcdType))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
class SurfaceItem(object):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
"""Maintain only a single instance of this object
|
||||||
|
@return: instance of this class
|
||||||
|
|
||||||
|
"""
|
||||||
|
name = args[0]
|
||||||
|
parent = args[1]
|
||||||
|
fileObj = args[2]
|
||||||
|
if issubclass(parent.__class__, Package):
|
||||||
|
if name in cls._objs.keys():
|
||||||
|
ErrorMsg("%s item is duplicated defined in packages: %s and %s" %
|
||||||
|
(name, parent.GetFilename(), cls._objs[name].GetParent().GetFilename()))
|
||||||
|
return None
|
||||||
|
obj = object.__new__(cls, *args, **kwargs)
|
||||||
|
cls._objs[name] = obj
|
||||||
|
return obj
|
||||||
|
elif issubclass(parent.__class__, Module):
|
||||||
|
if name not in cls._objs.keys():
|
||||||
|
ErrorMsg("%s item does not defined in any package! It is used by module %s" % \
|
||||||
|
(name, parent.GetFilename()))
|
||||||
|
return None
|
||||||
|
return cls._objs[name]
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, name, parent, fileObj):
|
||||||
|
if issubclass(parent.__class__, Package):
|
||||||
|
self._name = name
|
||||||
|
self._parent = parent
|
||||||
|
self._decObj = [fileObj]
|
||||||
|
self._refMods = {}
|
||||||
|
else:
|
||||||
|
self.RefModule(parent, fileObj)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def GetObjectDict(cls):
|
||||||
|
return cls._objs
|
||||||
|
|
||||||
|
def GetParent(self):
|
||||||
|
return self._parent
|
||||||
|
|
||||||
|
def GetReference(self):
|
||||||
|
return self._refMods
|
||||||
|
|
||||||
|
def RefModule(self, mObj, infObj):
|
||||||
|
if mObj in self._refMods.keys():
|
||||||
|
return
|
||||||
|
self._refMods[mObj] = infObj
|
||||||
|
|
||||||
|
def DeRef(self, mObj):
|
||||||
|
if mObj not in self._refMods.keys():
|
||||||
|
WarnMsg("%s is not referenced by module %s" % (self._name, mObj.GetFilename()))
|
||||||
|
return
|
||||||
|
del self._refMods[mObj]
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
self._refMods.clear()
|
||||||
|
cls = self.__class__
|
||||||
|
del cls._objs[self._name]
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetDecObject(self):
|
||||||
|
return self._decObj[0]
|
||||||
|
|
||||||
|
def GetDecObjects(self):
|
||||||
|
return self._decObj
|
||||||
|
|
||||||
|
class PcdItem(SurfaceItem):
|
||||||
|
def AddDecObj(self, fileObj):
|
||||||
|
for decObj in self._decObj:
|
||||||
|
if decObj.GetFilename() != fileObj.GetFilename():
|
||||||
|
ErrorMsg("Pcd %s defined in more than one packages : %s and %s" % \
|
||||||
|
(self._name, decObj.GetFilename(), fileObj.GetFilename()))
|
||||||
|
return
|
||||||
|
if decObj.GetPcdType() == fileObj.GetPcdType() and \
|
||||||
|
decObj.GetArch().lower() == fileObj.GetArch():
|
||||||
|
ErrorMsg("Pcd %s is duplicated defined in pcd type %s in package %s" % \
|
||||||
|
(self._name, decObj.GetPcdType(), decObj.GetFilename()))
|
||||||
|
return
|
||||||
|
self._decObj.append(fileObj)
|
||||||
|
|
||||||
|
def GetValidPcdType(self):
|
||||||
|
types = []
|
||||||
|
for obj in self._decObj:
|
||||||
|
if obj.GetPcdType() not in types:
|
||||||
|
types += obj.GetPcdType()
|
||||||
|
return types
|
||||||
|
|
||||||
|
class GuidItem(SurfaceItem):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class PpiItem(SurfaceItem):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ProtocolItem(SurfaceItem):
|
||||||
|
pass
|
||||||
@@ -0,0 +1,319 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import plugins.EdkPlugins.basemodel.ini as ini
|
||||||
|
import re, os
|
||||||
|
from plugins.EdkPlugins.basemodel.message import *
|
||||||
|
|
||||||
|
class DECFile(ini.BaseINIFile):
|
||||||
|
|
||||||
|
def GetSectionInstance(self, parent, name, isCombined=False):
|
||||||
|
return DECSection(parent, name, isCombined)
|
||||||
|
|
||||||
|
def GetComponents(self):
|
||||||
|
return self.GetSectionByName('Components')
|
||||||
|
|
||||||
|
def GetPackageRootPath(self):
|
||||||
|
return os.path.dirname(self.GetFilename()).strip()
|
||||||
|
|
||||||
|
def GetBaseName(self):
|
||||||
|
return self.GetDefine("PACKAGE_NAME").strip()
|
||||||
|
|
||||||
|
def GetVersion(self):
|
||||||
|
return self.GetDefine("PACKAGE_VERSION").strip()
|
||||||
|
|
||||||
|
def GetSectionObjectsByName(self, name, arch=None):
|
||||||
|
arr = []
|
||||||
|
sects = self.GetSectionByName(name)
|
||||||
|
for sect in sects:
|
||||||
|
# skip unmatched archtecture content
|
||||||
|
if not sect.IsArchMatch(arch):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for obj in sect.GetObjects():
|
||||||
|
arr.append(obj)
|
||||||
|
|
||||||
|
return arr
|
||||||
|
|
||||||
|
class DECSection(ini.BaseINISection):
|
||||||
|
def GetSectionINIObject(self, parent):
|
||||||
|
type = self.GetType()
|
||||||
|
|
||||||
|
if type.lower().find('defines') != -1:
|
||||||
|
return DECDefineSectionObject(self)
|
||||||
|
if type.lower().find('includes') != -1:
|
||||||
|
return DECIncludeObject(self)
|
||||||
|
if type.lower().find('pcd') != -1:
|
||||||
|
return DECPcdObject(self)
|
||||||
|
if type.lower() == 'libraryclasses':
|
||||||
|
return DECLibraryClassObject(self)
|
||||||
|
if type.lower() == 'guids':
|
||||||
|
return DECGuidObject(self)
|
||||||
|
if type.lower() == 'ppis':
|
||||||
|
return DECPpiObject(self)
|
||||||
|
if type.lower() == 'protocols':
|
||||||
|
return DECProtocolObject(self)
|
||||||
|
|
||||||
|
return DECSectionObject(self)
|
||||||
|
|
||||||
|
def GetType(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
return arr[0].strip()
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
if len(arr) == 1:
|
||||||
|
return 'common'
|
||||||
|
return arr[1]
|
||||||
|
|
||||||
|
def IsArchMatch(self, arch):
|
||||||
|
if arch == None or self.GetArch() == 'common':
|
||||||
|
return True
|
||||||
|
|
||||||
|
if self.GetArch().lower() != arch.lower():
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
class DECSectionObject(ini.BaseINISectionObject):
|
||||||
|
def GetArch(self):
|
||||||
|
return self.GetParent().GetArch()
|
||||||
|
|
||||||
|
class DECDefineSectionObject(DECSectionObject):
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
self._key = None
|
||||||
|
self._value = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
assert (self._start == self._end), 'The object in define section must be in single line'
|
||||||
|
|
||||||
|
line = self.GetLineByOffset(self._start).strip()
|
||||||
|
|
||||||
|
line = line.split('#')[0]
|
||||||
|
arr = line.split('=')
|
||||||
|
if len(arr) != 2:
|
||||||
|
ErrorMsg('Invalid define section object',
|
||||||
|
self.GetFilename(),
|
||||||
|
self.GetParent().GetName()
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._key = arr[0].strip()
|
||||||
|
self._value = arr[1].strip()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetKey(self):
|
||||||
|
return self._key
|
||||||
|
|
||||||
|
def GetValue(self):
|
||||||
|
return self._value
|
||||||
|
|
||||||
|
class DECGuidObject(DECSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
self._name = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
self._name = line.split('=')[0].strip()
|
||||||
|
self._guid = line.split('=')[1].strip()
|
||||||
|
objdict = DECGuidObject._objs
|
||||||
|
if self._name not in objdict.keys():
|
||||||
|
objdict[self._name] = [self]
|
||||||
|
else:
|
||||||
|
objdict[self._name].append(self)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetGuid(self):
|
||||||
|
return self._guid
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = DECGuidObject._objs
|
||||||
|
objdict[self._name].remove(self)
|
||||||
|
if len(objdict[self._name]) == 0:
|
||||||
|
del objdict[self._name]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return DECGuidObject._objs
|
||||||
|
|
||||||
|
class DECPpiObject(DECSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
self._name = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
self._name = line.split('=')[0].strip()
|
||||||
|
self._guid = line.split('=')[1].strip()
|
||||||
|
objdict = DECPpiObject._objs
|
||||||
|
if self._name not in objdict.keys():
|
||||||
|
objdict[self._name] = [self]
|
||||||
|
else:
|
||||||
|
objdict[self._name].append(self)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetGuid(self):
|
||||||
|
return self._guid
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = DECPpiObject._objs
|
||||||
|
objdict[self._name].remove(self)
|
||||||
|
if len(objdict[self._name]) == 0:
|
||||||
|
del objdict[self._name]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return DECPpiObject._objs
|
||||||
|
|
||||||
|
class DECProtocolObject(DECSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
self._name = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
self._name = line.split('=')[0].strip()
|
||||||
|
self._guid = line.split('=')[1].strip()
|
||||||
|
objdict = DECProtocolObject._objs
|
||||||
|
if self._name not in objdict.keys():
|
||||||
|
objdict[self._name] = [self]
|
||||||
|
else:
|
||||||
|
objdict[self._name].append(self)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetGuid(self):
|
||||||
|
return self._guid
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = DECProtocolObject._objs
|
||||||
|
objdict[self._name].remove(self)
|
||||||
|
if len(objdict[self._name]) == 0:
|
||||||
|
del objdict[self._name]
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return DECProtocolObject._objs
|
||||||
|
|
||||||
|
class DECLibraryClassObject(DECSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
self.mClassName = None
|
||||||
|
self.mHeaderFile = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
self.mClassName, self.mHeaderFile = line.split('|')
|
||||||
|
objdict = DECLibraryClassObject._objs
|
||||||
|
if self.mClassName not in objdict.keys():
|
||||||
|
objdict[self.mClassName] = [self]
|
||||||
|
else:
|
||||||
|
objdict[self.mClassName].append(self)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetClassName(self):
|
||||||
|
return self.mClassName
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.mClassName
|
||||||
|
|
||||||
|
def GetHeaderFile(self):
|
||||||
|
return self.mHeaderFile
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = DECLibraryClassObject._objs
|
||||||
|
objdict[self.mClassName].remove(self)
|
||||||
|
if len(objdict[self.mClassName]) == 0:
|
||||||
|
del objdict[self.mClassName]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return DECLibraryClassObject._objs
|
||||||
|
|
||||||
|
class DECIncludeObject(DECSectionObject):
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
|
||||||
|
def GetPath(self):
|
||||||
|
return self.GetLineByOffset(self._start).split('#')[0].strip()
|
||||||
|
|
||||||
|
class DECPcdObject(DECSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
DECSectionObject.__init__(self, parent)
|
||||||
|
self.mPcdName = None
|
||||||
|
self.mPcdDefaultValue = None
|
||||||
|
self.mPcdDataType = None
|
||||||
|
self.mPcdToken = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
(self.mPcdName, self.mPcdDefaultValue, self.mPcdDataType, self.mPcdToken) = line.split('|')
|
||||||
|
objdict = DECPcdObject._objs
|
||||||
|
if self.mPcdName not in objdict.keys():
|
||||||
|
objdict[self.mPcdName] = [self]
|
||||||
|
else:
|
||||||
|
objdict[self.mPcdName].append(self)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = DECPcdObject._objs
|
||||||
|
objdict[self.mPcdName].remove(self)
|
||||||
|
if len(objdict[self.mPcdName]) == 0:
|
||||||
|
del objdict[self.mPcdName]
|
||||||
|
|
||||||
|
def GetPcdType(self):
|
||||||
|
return self.GetParent().GetType()
|
||||||
|
|
||||||
|
def GetPcdName(self):
|
||||||
|
return self.mPcdName
|
||||||
|
|
||||||
|
def GetPcdValue(self):
|
||||||
|
return self.mPcdDefaultValue
|
||||||
|
|
||||||
|
def GetPcdDataType(self):
|
||||||
|
return self.mPcdDataType
|
||||||
|
|
||||||
|
def GetPcdToken(self):
|
||||||
|
return self.mPcdToken
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.GetPcdName().split('.')[1]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return DECPcdObject._objs
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,201 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import plugins.EdkPlugins.basemodel.ini as ini
|
||||||
|
import re, os
|
||||||
|
from plugins.EdkPlugins.basemodel.message import *
|
||||||
|
|
||||||
|
class DSCFile(ini.BaseINIFile):
|
||||||
|
def GetSectionInstance(self, parent, name, isCombined=False):
|
||||||
|
return DSCSection(parent, name, isCombined)
|
||||||
|
|
||||||
|
def GetComponents(self):
|
||||||
|
return self.GetSectionObjectsByName('Components')
|
||||||
|
|
||||||
|
class DSCSection(ini.BaseINISection):
|
||||||
|
def GetSectionINIObject(self, parent):
|
||||||
|
type = self.GetType()
|
||||||
|
|
||||||
|
if type.lower() == 'components':
|
||||||
|
return DSCComponentObject(self)
|
||||||
|
if type.lower() == 'libraryclasses':
|
||||||
|
return DSCLibraryClassObject(self)
|
||||||
|
if type.lower() == 'defines':
|
||||||
|
return ini.BaseINISectionObject(self)
|
||||||
|
if type.lower() == 'pcdsfeatureflag' or \
|
||||||
|
type.lower() == 'pcdsfixedatbuild' or \
|
||||||
|
type.lower() == 'pcdspatchableinmodule' or\
|
||||||
|
type.lower() == 'pcdsdynamicdefault' or \
|
||||||
|
type.lower() == 'pcdsdynamicex' or \
|
||||||
|
type.lower() == 'pcdsdynamichii' or \
|
||||||
|
type.lower() == 'pcdsdynamicvpd':
|
||||||
|
return DSCPcdObject(self)
|
||||||
|
|
||||||
|
return DSCSectionObject(self)
|
||||||
|
|
||||||
|
def GetType(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
return arr[0].strip()
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
if len(arr) == 1:
|
||||||
|
return 'common'
|
||||||
|
return arr[1]
|
||||||
|
|
||||||
|
def GetModuleType(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
if len(arr) < 3:
|
||||||
|
return 'common'
|
||||||
|
return arr[2]
|
||||||
|
|
||||||
|
class DSCSectionObject(ini.BaseINISectionObject):
|
||||||
|
def GetArch(self):
|
||||||
|
return self.GetParent().GetArch()
|
||||||
|
|
||||||
|
class DSCPcdObject(DSCSectionObject):
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
ini.BaseINISectionObject.__init__(self, parent)
|
||||||
|
self._name = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
self._name = line.split('|')[0]
|
||||||
|
self._value = line.split('|')[1]
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetPcdName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def GetPcdType(self):
|
||||||
|
return self.GetParent().GetType()
|
||||||
|
|
||||||
|
def GetPcdValue(self):
|
||||||
|
return self._value
|
||||||
|
|
||||||
|
class DSCLibraryClassObject(DSCSectionObject):
|
||||||
|
def __init__(self, parent):
|
||||||
|
ini.BaseINISectionObject.__init__(self, parent)
|
||||||
|
|
||||||
|
def GetClass(self):
|
||||||
|
line = self.GetLineByOffset(self._start)
|
||||||
|
return line.split('#')[0].split('|')[0].strip()
|
||||||
|
|
||||||
|
def GetInstance(self):
|
||||||
|
line = self.GetLineByOffset(self._start)
|
||||||
|
return line.split('#')[0].split('|')[1].strip()
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
return self.GetParent().GetArch()
|
||||||
|
|
||||||
|
def GetModuleType(self):
|
||||||
|
return self.GetParent().GetModuleType()
|
||||||
|
|
||||||
|
class DSCComponentObject(DSCSectionObject):
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
ini.BaseINISectionObject.__init__(self, parent)
|
||||||
|
self._OveridePcds = {}
|
||||||
|
self._OverideLibraries = {}
|
||||||
|
self._Filename = ''
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self._OverideLibraries.clear()
|
||||||
|
self._OverideLibraries.clear()
|
||||||
|
ini.BaseINISectionObject.__del__(self)
|
||||||
|
|
||||||
|
def AddOverideLib(self, libclass, libinstPath):
|
||||||
|
if libclass not in self._OverideLibraries.keys():
|
||||||
|
self._OverideLibraries[libclass] = libinstPath
|
||||||
|
|
||||||
|
def AddOveridePcd(self, name, type, value=None):
|
||||||
|
if type not in self._OveridePcds.keys():
|
||||||
|
self._OveridePcds[type] = []
|
||||||
|
self._OveridePcds[type].append((name, value))
|
||||||
|
|
||||||
|
def GetOverideLibs(self):
|
||||||
|
return self._OverideLibraries
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
return self.GetParent().GetArch()
|
||||||
|
|
||||||
|
def GetOveridePcds(self):
|
||||||
|
return self._OveridePcds
|
||||||
|
|
||||||
|
def GetFilename(self):
|
||||||
|
return self.GetLineByOffset(self._start).split('#')[0].split('{')[0].strip()
|
||||||
|
|
||||||
|
def SetFilename(self, fName):
|
||||||
|
self._Filename = fName
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
if (self._start < self._end):
|
||||||
|
#
|
||||||
|
# The first line is inf path and could be ignored
|
||||||
|
# The end line is '}' and could be ignored
|
||||||
|
#
|
||||||
|
curr = self._start + 1
|
||||||
|
end = self._end - 1
|
||||||
|
OverideName = ''
|
||||||
|
while (curr <= end):
|
||||||
|
line = self.GetLineByOffset(curr).strip()
|
||||||
|
if len(line) > 0 and line[0] != '#':
|
||||||
|
line = line.split('#')[0].strip()
|
||||||
|
if line[0] == '<':
|
||||||
|
OverideName = line[1:len(line)-1]
|
||||||
|
elif OverideName.lower() == 'libraryclasses':
|
||||||
|
arr = line.split('|')
|
||||||
|
self._OverideLibraries[arr[0].strip()] = arr[1].strip()
|
||||||
|
elif OverideName.lower() == 'pcds':
|
||||||
|
ErrorMsg('EDES does not support PCD overide',
|
||||||
|
self.GetFileName(),
|
||||||
|
self.GetParent().GetLinenumberByOffset(curr))
|
||||||
|
curr = curr + 1
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GenerateLines(self):
|
||||||
|
lines = []
|
||||||
|
hasLib = False
|
||||||
|
hasPcd = False
|
||||||
|
if len(self._OverideLibraries) != 0:
|
||||||
|
hasLib = True
|
||||||
|
if len(self._OveridePcds) != 0:
|
||||||
|
hasPcd = True
|
||||||
|
|
||||||
|
if hasLib or hasPcd:
|
||||||
|
lines.append((' %s {\n' % self._Filename))
|
||||||
|
else:
|
||||||
|
lines.append((' %s \n' % self._Filename))
|
||||||
|
return lines
|
||||||
|
|
||||||
|
if hasLib:
|
||||||
|
lines.append(' <LibraryClasses>\n')
|
||||||
|
for libKey in self._OverideLibraries.keys():
|
||||||
|
lines.append(' %s|%s\n' % (libKey, self._OverideLibraries[libKey]))
|
||||||
|
|
||||||
|
if hasPcd:
|
||||||
|
for key in self._OveridePcds.keys():
|
||||||
|
lines.append(' <%s>\n' % key)
|
||||||
|
|
||||||
|
for name, value in self._OveridePcds[key]:
|
||||||
|
if value != None:
|
||||||
|
lines.append(' %s|%s\n' % (name, value))
|
||||||
|
else:
|
||||||
|
lines.append(' %s\n' % name)
|
||||||
|
|
||||||
|
if hasLib or hasPcd:
|
||||||
|
lines.append(' }\n')
|
||||||
|
|
||||||
|
return lines
|
||||||
|
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
|
||||||
|
import plugins.EdkPlugins.basemodel.ini as ini
|
||||||
|
import re, os
|
||||||
|
from plugins.EdkPlugins.basemodel.message import *
|
||||||
|
|
||||||
|
class INFFile(ini.BaseINIFile):
|
||||||
|
_libobjs = {}
|
||||||
|
|
||||||
|
def GetSectionInstance(self, parent, name, isCombined=False):
|
||||||
|
return INFSection(parent, name, isCombined)
|
||||||
|
|
||||||
|
def GetProduceLibraryClass(self):
|
||||||
|
obj = self.GetDefine("LIBRARY_CLASS")
|
||||||
|
if obj == None: return None
|
||||||
|
|
||||||
|
return obj.split('|')[0].strip()
|
||||||
|
|
||||||
|
def GetSectionObjectsByName(self, name, arch=None):
|
||||||
|
arr = []
|
||||||
|
sects = self.GetSectionByName(name)
|
||||||
|
for sect in sects:
|
||||||
|
# skip unmatched archtecture content
|
||||||
|
if not sect.IsArchMatch(arch):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for obj in sect.GetObjects():
|
||||||
|
arr.append(obj)
|
||||||
|
|
||||||
|
return arr
|
||||||
|
|
||||||
|
def GetSourceObjects(self, arch=None, tool=None):
|
||||||
|
arr = []
|
||||||
|
sects = self.GetSectionByName('sources')
|
||||||
|
for sect in sects:
|
||||||
|
# skip unmatched archtecture content
|
||||||
|
if not sect.IsArchMatch(arch):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for obj in sect.GetObjects():
|
||||||
|
if not obj.IsMatchFamily(tool):
|
||||||
|
continue
|
||||||
|
arr.append(obj)
|
||||||
|
|
||||||
|
return arr
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
if not ini.BaseINIFile.Parse(self):
|
||||||
|
return False
|
||||||
|
classname = self.GetProduceLibraryClass()
|
||||||
|
if classname != None:
|
||||||
|
libobjdict = INFFile._libobjs
|
||||||
|
if libobjdict.has_key(classname):
|
||||||
|
if self not in libobjdict[classname]:
|
||||||
|
libobjdict[classname].append(self)
|
||||||
|
else:
|
||||||
|
libobjdict[classname] = [self]
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetBaseName(self):
|
||||||
|
return self.GetDefine("BASE_NAME").strip()
|
||||||
|
|
||||||
|
def GetModuleRootPath(self):
|
||||||
|
return os.path.dirname(self.GetFilename())
|
||||||
|
|
||||||
|
def Clear(self):
|
||||||
|
classname = self.GetProduceLibraryClass()
|
||||||
|
if classname != None:
|
||||||
|
libobjdict = INFFile._libobjs
|
||||||
|
libobjdict[classname].remove(self)
|
||||||
|
if len(libobjdict[classname]) == 0:
|
||||||
|
del libobjdict[classname]
|
||||||
|
ini.BaseINIFile.Clear(self)
|
||||||
|
|
||||||
|
|
||||||
|
class INFSection(ini.BaseINISection):
|
||||||
|
def GetSectionINIObject(self, parent):
|
||||||
|
type = self.GetType()
|
||||||
|
|
||||||
|
if type.lower() == 'libraryclasses':
|
||||||
|
return INFLibraryClassObject(self)
|
||||||
|
if type.lower() == 'sources':
|
||||||
|
return INFSourceObject(self)
|
||||||
|
if type.lower().find('pcd') != -1:
|
||||||
|
return INFPcdObject(self)
|
||||||
|
if type.lower() == 'packages':
|
||||||
|
return INFDependentPackageObject(self)
|
||||||
|
if type.lower() in ['guids', 'protocols', 'ppis']:
|
||||||
|
return INFGuidObject(self)
|
||||||
|
if type.lower() == 'defines':
|
||||||
|
return INFDefineSectionObject(self)
|
||||||
|
return INFSectionObject(self)
|
||||||
|
|
||||||
|
def GetType(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
return arr[0].strip()
|
||||||
|
|
||||||
|
def GetArch(self):
|
||||||
|
arr = self._name.split('.')
|
||||||
|
if len(arr) == 1:
|
||||||
|
return 'common'
|
||||||
|
return arr[1]
|
||||||
|
|
||||||
|
def IsArchMatch(self, arch):
|
||||||
|
if arch == None or self.GetArch() == 'common':
|
||||||
|
return True
|
||||||
|
|
||||||
|
if self.GetArch().lower() != arch.lower():
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
class INFSectionObject(ini.BaseINISectionObject):
|
||||||
|
def GetArch(self):
|
||||||
|
return self.GetParent().GetArch()
|
||||||
|
|
||||||
|
class INFDefineSectionObject(INFSectionObject):
|
||||||
|
def __init__(self, parent):
|
||||||
|
INFSectionObject.__init__(self, parent)
|
||||||
|
self._key = None
|
||||||
|
self._value = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
assert (self._start == self._end), 'The object in define section must be in single line'
|
||||||
|
|
||||||
|
line = self.GetLineByOffset(self._start).strip()
|
||||||
|
|
||||||
|
line = line.split('#')[0]
|
||||||
|
arr = line.split('=')
|
||||||
|
if len(arr) != 2:
|
||||||
|
ErrorMsg('Invalid define section object',
|
||||||
|
self.GetFilename(),
|
||||||
|
self._start
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._key = arr[0].strip()
|
||||||
|
self._value = arr[1].strip()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetKey(self):
|
||||||
|
return self._key
|
||||||
|
|
||||||
|
def GetValue(self):
|
||||||
|
return self._value
|
||||||
|
|
||||||
|
class INFLibraryClassObject(INFSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
def __init__(self, parent):
|
||||||
|
INFSectionObject.__init__(self, parent)
|
||||||
|
self._classname = None
|
||||||
|
|
||||||
|
def GetClass(self):
|
||||||
|
return self._classname
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
self._classname = self.GetLineByOffset(self._start).split('#')[0].strip()
|
||||||
|
objdict = INFLibraryClassObject._objs
|
||||||
|
if objdict.has_key(self._classname):
|
||||||
|
objdict[self._classname].append(self)
|
||||||
|
else:
|
||||||
|
objdict[self._classname] = [self]
|
||||||
|
return True
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = INFLibraryClassObject._objs
|
||||||
|
objdict[self._classname].remove(self)
|
||||||
|
if len(objdict[self._classname]) == 0:
|
||||||
|
del objdict[self._classname]
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._classname
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return INFLibraryClassObject._objs
|
||||||
|
|
||||||
|
class INFDependentPackageObject(INFSectionObject):
|
||||||
|
def GetPath(self):
|
||||||
|
return self.GetLineByOffset(self._start).split('#')[0].strip()
|
||||||
|
|
||||||
|
class INFSourceObject(INFSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
def __init__(self, parent):
|
||||||
|
INFSectionObject.__init__(self, parent)
|
||||||
|
|
||||||
|
self.mSourcename = None
|
||||||
|
self.mToolCode = None
|
||||||
|
self.mFamily = None
|
||||||
|
self.mTagName = None
|
||||||
|
self.mFeaturePcd = None
|
||||||
|
self.mFilename = None
|
||||||
|
|
||||||
|
def GetSourcePath(self):
|
||||||
|
return self.mSourcename
|
||||||
|
|
||||||
|
def GetSourceFullPath(self):
|
||||||
|
path = os.path.dirname(self.GetFilename())
|
||||||
|
path = os.path.join(path, self.GetSourcePath())
|
||||||
|
return os.path.normpath(path)
|
||||||
|
|
||||||
|
def GetToolCode(self):
|
||||||
|
return self.mToolCode
|
||||||
|
|
||||||
|
def GetFamily(self):
|
||||||
|
return self.mFamily
|
||||||
|
|
||||||
|
def GetTagName(self):
|
||||||
|
return self.mTagName
|
||||||
|
|
||||||
|
def GetFeaturePcd(self):
|
||||||
|
return self.mFeaturePcd
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
|
||||||
|
arr = line.split('|')
|
||||||
|
|
||||||
|
self.mSourcename = arr[0].strip()
|
||||||
|
if len(arr) >= 2:
|
||||||
|
self.mFamily = arr[1].strip()
|
||||||
|
if len(arr) >= 3:
|
||||||
|
self.mTagName = arr[2].strip()
|
||||||
|
if len(arr) >= 4:
|
||||||
|
self.mToolCode = arr[3].strip()
|
||||||
|
if len(arr) >= 5:
|
||||||
|
self.mFeaturePcd = arr[4].strip()
|
||||||
|
|
||||||
|
self.mFilename = os.path.basename(self.GetSourceFullPath())
|
||||||
|
objdict = INFSourceObject._objs
|
||||||
|
if not objdict.has_key(self.mFilename):
|
||||||
|
objdict[self.mFilename] = [self]
|
||||||
|
else:
|
||||||
|
objdict[self.mFilename].append(self)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.mFilename
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = INFSourceObject._objs
|
||||||
|
objdict[self.mFilename].remove(self)
|
||||||
|
if len(objdict[self.mFilename]) == 0:
|
||||||
|
del objdict[self.mFilename]
|
||||||
|
|
||||||
|
def IsMatchFamily(self, family):
|
||||||
|
if family == None:
|
||||||
|
return True
|
||||||
|
if self.mFamily != None:
|
||||||
|
if family.strip().lower() == self.mFamily.lower():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
fname = self.GetSourcePath()
|
||||||
|
if fname.endswith('.S') and family.lower() != 'gcc':
|
||||||
|
return False
|
||||||
|
if fname.endswith('.s') and (self.GetArch().lower() != 'ipf' and self.GetArch().lower() != 'common'):
|
||||||
|
return False
|
||||||
|
if fname.lower().endswith('.asm') and (family.lower() != 'msft' and family.lower() != 'intel'):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return INFSourceObject._objs
|
||||||
|
|
||||||
|
class INFPcdObject(INFSectionObject):
|
||||||
|
_objs = {}
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
INFSectionObject.__init__(self, parent)
|
||||||
|
|
||||||
|
self.mPcdType = None
|
||||||
|
self.mDefaultValue = None
|
||||||
|
self.mPcdName = None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetObjectDict():
|
||||||
|
return INFPcdObject._objs
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0]
|
||||||
|
|
||||||
|
arr = line.split('|')
|
||||||
|
self.mPcdName = arr[0].strip()
|
||||||
|
|
||||||
|
if len(arr) >= 2:
|
||||||
|
self.mDefaultValue = arr[1].strip()
|
||||||
|
|
||||||
|
objdict = INFPcdObject._objs
|
||||||
|
if objdict.has_key(self.GetName()):
|
||||||
|
if self not in objdict[self.GetName()]:
|
||||||
|
objdict[self.GetName()].append(self)
|
||||||
|
else:
|
||||||
|
objdict[self.GetName()] = [self]
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetPcdName(self):
|
||||||
|
return self.mPcdName
|
||||||
|
|
||||||
|
def GetPcdType(self):
|
||||||
|
return self.GetParent().GetType()
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.mPcdName.split('.')[1]
|
||||||
|
|
||||||
|
def Destroy(self):
|
||||||
|
objdict = INFPcdObject._objs
|
||||||
|
objdict[self.GetName()].remove(self)
|
||||||
|
if len(objdict[self.GetName()]) == 0:
|
||||||
|
del objdict[self.GetName()]
|
||||||
|
|
||||||
|
class INFGuidObject(INFSectionObject):
|
||||||
|
def __init__(self, parent):
|
||||||
|
INFSectionObject.__init__(self, parent)
|
||||||
|
self._name = None
|
||||||
|
|
||||||
|
def Parse(self):
|
||||||
|
line = self.GetLineByOffset(self._start).strip().split('#')[0].split("|")[0]
|
||||||
|
self._name = line.strip()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
|
||||||
12
BaseTools/Scripts/PackageDocumentTools/plugins/__init__.py
Normal file
12
BaseTools/Scripts/PackageDocumentTools/plugins/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
## @file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are licensed and made available
|
||||||
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
# distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
# must ensure that files that are required by the cx_freeze frozen binaries are
|
# must ensure that files that are required by the cx_freeze frozen binaries are
|
||||||
# present in the Bin\Win32 directory.
|
# present in the Bin\Win32 directory.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available under
|
# This program and the accompanying materials are licensed and made available under
|
||||||
# the terms and conditions of the BSD License which accompanies this distribution.
|
# the terms and conditions of the BSD License which accompanies this distribution.
|
||||||
@@ -59,6 +59,7 @@ UPT.exe
|
|||||||
VfrCompile.exe
|
VfrCompile.exe
|
||||||
VolInfo.exe
|
VolInfo.exe
|
||||||
Pkcs7Sign.exe
|
Pkcs7Sign.exe
|
||||||
|
DevicePath.exe
|
||||||
|
|
||||||
[ExtraFiles.Win32]
|
[ExtraFiles.Win32]
|
||||||
TestSigningPrivateKey.pem
|
TestSigningPrivateKey.pem
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'BootSectImage' module build.
|
# GNU/Linux makefile for 'BootSectImage' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = BootSectImage
|
APPNAME = BootSectImage
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'Brotli' module build.
|
# GNU/Linux makefile for 'Brotli' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = Brotli
|
APPNAME = Brotli
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Common library assistance routines.
|
Common library assistance routines.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -17,10 +17,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#include <Common/UefiBaseTypes.h>
|
#include <Common/UefiBaseTypes.h>
|
||||||
#include <Common/BuildVersion.h>
|
#include <Common/BuildVersion.h>
|
||||||
|
#include <assert.h>
|
||||||
#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
|
#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
|
||||||
|
|
||||||
#define MAX_LONG_FILE_PATH 500
|
#define MAX_LONG_FILE_PATH 500
|
||||||
|
|
||||||
|
#define MAX_UINTN MAX_ADDRESS
|
||||||
|
#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
|
||||||
|
#define MAX_UINT16 ((UINT16)0xFFFF)
|
||||||
|
#define MAX_UINT8 ((UINT8)0xFF)
|
||||||
|
#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))
|
||||||
|
#define ASCII_RSIZE_MAX 1000000
|
||||||
|
#undef RSIZE_MAX
|
||||||
|
#define RSIZE_MAX 1000000
|
||||||
|
|
||||||
|
#define IS_COMMA(a) ((a) == L',')
|
||||||
|
#define IS_HYPHEN(a) ((a) == L'-')
|
||||||
|
#define IS_DOT(a) ((a) == L'.')
|
||||||
|
#define IS_LEFT_PARENTH(a) ((a) == L'(')
|
||||||
|
#define IS_RIGHT_PARENTH(a) ((a) == L')')
|
||||||
|
#define IS_SLASH(a) ((a) == L'/')
|
||||||
|
#define IS_NULL(a) ((a) == L'\0')
|
||||||
|
|
||||||
|
#define ASSERT(x) assert(x)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -149,6 +169,285 @@ CHAR8 *
|
|||||||
LongFilePath (
|
LongFilePath (
|
||||||
IN CHAR8 *FileName
|
IN CHAR8 *FileName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
StrLen (
|
||||||
|
CONST CHAR16 *String
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
AllocateCopyPool (
|
||||||
|
UINTN AllocationSize,
|
||||||
|
CONST VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
INTN
|
||||||
|
StrnCmp (
|
||||||
|
CONST CHAR16 *FirstString,
|
||||||
|
CONST CHAR16 *SecondString,
|
||||||
|
UINTN Length
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrToGuid (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
EFI_GUID *Guid
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrHexToBytes (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
UINTN Length,
|
||||||
|
UINT8 *Buffer,
|
||||||
|
UINTN MaxBufferSize
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
InternalHexCharToUintn (
|
||||||
|
CHAR16 Char
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
InternalAllocateCopyPool (
|
||||||
|
UINTN AllocationSize,
|
||||||
|
CONST VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
InternalIsDecimalDigitCharacter (
|
||||||
|
CHAR16 Char
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT32
|
||||||
|
SwapBytes32 (
|
||||||
|
UINT32 Value
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT16
|
||||||
|
SwapBytes16 (
|
||||||
|
UINT16 Value
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_GUID *
|
||||||
|
CopyGuid (
|
||||||
|
EFI_GUID *DestinationGuid,
|
||||||
|
CONST EFI_GUID *SourceGuid
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
WriteUnaligned64 (
|
||||||
|
UINT64 *Buffer,
|
||||||
|
UINT64 Value
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
ReadUnaligned64 (
|
||||||
|
CONST UINT64 *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
StrSize (
|
||||||
|
CONST CHAR16 *String
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
StrHexToUintn (
|
||||||
|
CONST CHAR16 *String
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
StrDecimalToUintn (
|
||||||
|
CONST CHAR16 *String
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
StrHexToUint64 (
|
||||||
|
CONST CHAR16 *String
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
StrDecimalToUint64 (
|
||||||
|
CONST CHAR16 *String
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrHexToUint64S (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
CHAR16 **EndPointer,
|
||||||
|
UINT64 *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrHexToUintnS (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
CHAR16 **EndPointer, OPTIONAL
|
||||||
|
UINTN *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrDecimalToUint64S (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
CHAR16 **EndPointer, OPTIONAL
|
||||||
|
UINT64 *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrDecimalToUintnS (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
CHAR16 **EndPointer, OPTIONAL
|
||||||
|
UINTN *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
ReallocatePool (
|
||||||
|
UINTN OldSize,
|
||||||
|
UINTN NewSize,
|
||||||
|
VOID *OldBuffer OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
InternalReallocatePool (
|
||||||
|
UINTN OldSize,
|
||||||
|
UINTN NewSize,
|
||||||
|
VOID *OldBuffer OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
InternalAllocateZeroPool (
|
||||||
|
UINTN AllocationSize
|
||||||
|
) ;
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
InternalAllocatePool (
|
||||||
|
UINTN AllocationSize
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
StrnLenS (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
UINTN MaxSize
|
||||||
|
);
|
||||||
|
|
||||||
|
CHAR16
|
||||||
|
InternalCharToUpper (
|
||||||
|
CHAR16 Char
|
||||||
|
);
|
||||||
|
|
||||||
|
INTN
|
||||||
|
StrCmp (
|
||||||
|
CONST CHAR16 *FirstString,
|
||||||
|
CONST CHAR16 *SecondString
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
SwapBytes64 (
|
||||||
|
UINT64 Value
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
InternalMathSwapBytes64 (
|
||||||
|
UINT64 Operand
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrToIpv4Address (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
CHAR16 **EndPointer,
|
||||||
|
EFI_IPv4_ADDRESS *Address,
|
||||||
|
UINT8 *PrefixLength
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrToIpv6Address (
|
||||||
|
CONST CHAR16 *String,
|
||||||
|
CHAR16 **EndPointer,
|
||||||
|
EFI_IPv6_ADDRESS *Address,
|
||||||
|
UINT8 *PrefixLength
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
StrCpyS (
|
||||||
|
CHAR16 *Destination,
|
||||||
|
UINTN DestMax,
|
||||||
|
CONST CHAR16 *Source
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
UnicodeStrToAsciiStrS (
|
||||||
|
CONST CHAR16 *Source,
|
||||||
|
CHAR8 *Destination,
|
||||||
|
UINTN DestMax
|
||||||
|
);
|
||||||
|
VOID *
|
||||||
|
AllocatePool (
|
||||||
|
UINTN AllocationSize
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT16
|
||||||
|
WriteUnaligned16 (
|
||||||
|
UINT16 *Buffer,
|
||||||
|
UINT16 Value
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT16
|
||||||
|
ReadUnaligned16 (
|
||||||
|
CONST UINT16 *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID *
|
||||||
|
AllocateZeroPool (
|
||||||
|
UINTN AllocationSize
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
InternalIsHexaDecimalDigitCharacter (
|
||||||
|
CHAR16 Char
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
InternalSafeStringIsOverlap (
|
||||||
|
IN VOID *Base1,
|
||||||
|
IN UINTN Size1,
|
||||||
|
IN VOID *Base2,
|
||||||
|
IN UINTN Size2
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
InternalSafeStringNoStrOverlap (
|
||||||
|
IN CHAR16 *Str1,
|
||||||
|
IN UINTN Size1,
|
||||||
|
IN CHAR16 *Str2,
|
||||||
|
IN UINTN Size2
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsHexStr (
|
||||||
|
CHAR16 *Str
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
Strtoi (
|
||||||
|
CHAR16 *Str
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Strtoi64 (
|
||||||
|
CHAR16 *Str,
|
||||||
|
UINT64 *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
StrToAscii (
|
||||||
|
CHAR16 *Str,
|
||||||
|
CHAR8 **AsciiStr
|
||||||
|
);
|
||||||
|
|
||||||
|
CHAR16 *
|
||||||
|
SplitStr (
|
||||||
|
CHAR16 **List,
|
||||||
|
CHAR16 Separator
|
||||||
|
);
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@@ -166,8 +465,6 @@ Returns:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ASSERT(x) assert(x)
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'Common' module build.
|
# GNU/Linux makefile for 'Common' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
# VPATH = ..
|
# VPATH = ..
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains the PcdValue structure definition.
|
This file contains the PcdValue structure definition.
|
||||||
|
|
||||||
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -72,6 +72,9 @@ Returns:
|
|||||||
CHAR8 *Token;
|
CHAR8 *Token;
|
||||||
|
|
||||||
Token = malloc (TokenEnd - TokenStart + 1);
|
Token = malloc (TokenEnd - TokenStart + 1);
|
||||||
|
if (Token == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
memcpy (Token, &FileBuffer[TokenStart], TokenEnd - TokenStart);
|
memcpy (Token, &FileBuffer[TokenStart], TokenEnd - TokenStart);
|
||||||
Token[TokenEnd - TokenStart] = 0;
|
Token[TokenEnd - TokenStart] = 0;
|
||||||
switch (TokenIndex) {
|
switch (TokenIndex) {
|
||||||
@@ -106,6 +109,9 @@ Returns:
|
|||||||
case 5:
|
case 5:
|
||||||
PcdList[PcdIndex].Value = Token;
|
PcdList[PcdIndex].Value = Token;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
free (Token);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,11 +272,7 @@ Returns:
|
|||||||
sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
|
sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
|
||||||
break;
|
break;
|
||||||
case PcdDataTypeUint64:
|
case PcdDataTypeUint64:
|
||||||
#ifdef __GNUC__
|
sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long long)Value);
|
||||||
sprintf(PcdList[Index].Value, "0x%016lx", Value);
|
|
||||||
#else
|
|
||||||
sprintf(PcdList[Index].Value, "0x%016llx", Value);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case PcdDataTypePointer:
|
case PcdDataTypePointer:
|
||||||
fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
|
fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
|
||||||
@@ -310,7 +312,6 @@ Returns:
|
|||||||
CHAR8 *Value;
|
CHAR8 *Value;
|
||||||
UINT8 *Buffer;
|
UINT8 *Buffer;
|
||||||
CHAR8 *End;
|
CHAR8 *End;
|
||||||
UINT8 Byte;
|
|
||||||
|
|
||||||
Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
|
Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
|
||||||
if (Index < 0) {
|
if (Index < 0) {
|
||||||
@@ -328,12 +329,14 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
case PcdDataTypePointer:
|
case PcdDataTypePointer:
|
||||||
Value = &PcdList[Index].Value[1];
|
Value = &PcdList[Index].Value[1];
|
||||||
printf ("Value = %s\n", PcdList[Index].Value);
|
for (*Size = 0, strtoul(Value, &End, 16); Value != End; strtoul(Value, &End, 16), *Size = *Size + 1) {
|
||||||
for (*Size = 0, Byte = (UINT8) strtoul(Value, &End, 16); Value != End; Byte = (UINT8) strtoul(Value, &End, 16), *Size = *Size + 1) {
|
|
||||||
printf("%x\n", Byte);
|
|
||||||
Value = End + 1;
|
Value = End + 1;
|
||||||
}
|
}
|
||||||
Buffer = malloc(*Size);
|
Buffer = malloc(*Size + 1);
|
||||||
|
if (Buffer == NULL) {
|
||||||
|
*Size = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
Value = &PcdList[Index].Value[1];
|
Value = &PcdList[Index].Value[1];
|
||||||
for (*Size = 0, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16); Value != End; *Size = *Size + 1, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16)) {
|
for (*Size = 0, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16); Value != End; *Size = *Size + 1, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16)) {
|
||||||
Value = End + 1;
|
Value = End + 1;
|
||||||
@@ -395,7 +398,6 @@ Returns:
|
|||||||
PcdList[Index].Value = malloc(Size * 5 + 3);
|
PcdList[Index].Value = malloc(Size * 5 + 3);
|
||||||
PcdList[Index].Value[0] = '{';
|
PcdList[Index].Value[0] = '{';
|
||||||
for (ValueIndex = 0; ValueIndex < Size; ValueIndex++) {
|
for (ValueIndex = 0; ValueIndex < Size; ValueIndex++) {
|
||||||
printf("Value[%d] = %02x\n", ValueIndex, Value[ValueIndex]);
|
|
||||||
sprintf(&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[ValueIndex]);
|
sprintf(&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[ValueIndex]);
|
||||||
}
|
}
|
||||||
PcdList[Index].Value[1 + Size * 5 - 1] = '}';
|
PcdList[Index].Value[1 + Size * 5 - 1] = '}';
|
||||||
@@ -718,15 +720,11 @@ Returns:
|
|||||||
if (*InputFileName == NULL) {
|
if (*InputFileName == NULL) {
|
||||||
fprintf (stderr, "Missing option. Input files is not specified\n");
|
fprintf (stderr, "Missing option. Input files is not specified\n");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
} else {
|
|
||||||
printf ("Input file name is %s\n", *InputFileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*OutputFileName == NULL) {
|
if (*OutputFileName == NULL) {
|
||||||
fprintf (stderr, "Missing option. Output file is not specified\n");
|
fprintf (stderr, "Missing option. Output file is not specified\n");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
} else {
|
|
||||||
printf ("Output file name is %s\n", *OutputFileName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,7 +753,6 @@ Returns:
|
|||||||
UINT8 *FileBuffer;
|
UINT8 *FileBuffer;
|
||||||
UINT32 FileSize;
|
UINT32 FileSize;
|
||||||
|
|
||||||
printf ("PCD tool start.\n");
|
|
||||||
InputFileName = NULL;
|
InputFileName = NULL;
|
||||||
OutputFileName = NULL;
|
OutputFileName = NULL;
|
||||||
|
|
||||||
@@ -784,7 +781,5 @@ Returns:
|
|||||||
//
|
//
|
||||||
WriteOutputFile (OutputFileName);
|
WriteOutputFile (OutputFileName);
|
||||||
|
|
||||||
printf ("PCD tool done.\n");
|
|
||||||
|
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
200
BaseTools/Source/C/DevicePath/DevicePath.c
Normal file
200
BaseTools/Source/C/DevicePath/DevicePath.c
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
/** @file
|
||||||
|
Definition for Device Path Tool.
|
||||||
|
|
||||||
|
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "UefiDevicePathLib.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Utility Name
|
||||||
|
//
|
||||||
|
#define UTILITY_NAME "DevicePath"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Utility version information
|
||||||
|
//
|
||||||
|
#define UTILITY_MAJOR_VERSION 0
|
||||||
|
#define UTILITY_MINOR_VERSION 1
|
||||||
|
|
||||||
|
EFI_GUID gEfiDebugPortDevicePathGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
|
||||||
|
EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;
|
||||||
|
EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID;
|
||||||
|
EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;
|
||||||
|
EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;
|
||||||
|
EFI_GUID gEfiUartDevicePathGuid = EFI_UART_DEVICE_PATH_GUID;
|
||||||
|
EFI_GUID gEfiSasDevicePathGuid = EFI_SAS_DEVICE_PATH_GUID;
|
||||||
|
EFI_GUID gEfiVirtualDiskGuid = EFI_VIRTUAL_DISK_GUID;
|
||||||
|
EFI_GUID gEfiVirtualCdGuid = EFI_VIRTUAL_CD_GUID;
|
||||||
|
EFI_GUID gEfiPersistentVirtualDiskGuid = EFI_PERSISTENT_VIRTUAL_DISK_GUID;
|
||||||
|
EFI_GUID gEfiPersistentVirtualCdGuid = EFI_PERSISTENT_VIRTUAL_CD_GUID;
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
Version (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Displays the standard utility information to SDTOUT
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
Usage (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Displays the utility usage syntax to STDOUT
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Summary usage
|
||||||
|
//
|
||||||
|
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copyright declaration
|
||||||
|
//
|
||||||
|
fprintf (stdout, "Copyright (c) 2017, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
//
|
||||||
|
// Details Option
|
||||||
|
//
|
||||||
|
fprintf (stdout, "Options:\n");
|
||||||
|
fprintf (stdout, " DevicePathString Device Path string is specified, no space character.\n"
|
||||||
|
" Example: \"PciRoot(0)/Pci(0,0)\"\n");
|
||||||
|
|
||||||
|
fprintf (stdout, " --version Show program's version number and exit.\n");
|
||||||
|
fprintf (stdout, " -h, --help Show this help message and exit.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
PrintMem (
|
||||||
|
CONST VOID *Buffer,
|
||||||
|
UINTN Count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CONST UINT8 *Bytes;
|
||||||
|
UINTN Idx;
|
||||||
|
|
||||||
|
Bytes = Buffer;
|
||||||
|
for (Idx = 0; Idx < Count; Idx++) {
|
||||||
|
printf("0x%02x ", Bytes[Idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ascii2UnicodeString (
|
||||||
|
CHAR8 *String,
|
||||||
|
CHAR16 *UniString
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Write ascii string as unicode string format to FILE
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
String - Pointer to string that is written to FILE.
|
||||||
|
UniString - Pointer to unicode string
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
NULL
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
while (*String != '\0') {
|
||||||
|
*(UniString++) = (CHAR16) *(String++);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// End the UniString with a NULL.
|
||||||
|
//
|
||||||
|
*UniString = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, CHAR8 *argv[])
|
||||||
|
{
|
||||||
|
CHAR8 * Str;
|
||||||
|
CHAR16* Str16;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
|
||||||
|
if (argc == 1) {
|
||||||
|
Error (NULL, 0, 1001, "Missing options", "No input options specified.");
|
||||||
|
Usage ();
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
if ((stricmp (argv[1], "-h") == 0) || (stricmp (argv[1], "--help") == 0)) {
|
||||||
|
Version ();
|
||||||
|
Usage ();
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stricmp (argv[1], "--version") == 0) {
|
||||||
|
Version ();
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
Str = argv[1];
|
||||||
|
if (Str == NULL) {
|
||||||
|
fprintf(stderr, "Invalid option value, Device Path can't be NULL");
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
Str16 = (CHAR16 *)malloc(1024);
|
||||||
|
if (Str16 == NULL) {
|
||||||
|
fprintf(stderr, "Resource, memory cannot be allcoated");
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
Ascii2UnicodeString(Str, Str16);
|
||||||
|
DevicePath = UefiDevicePathLibConvertTextToDevicePath(Str16);
|
||||||
|
if (DevicePath == NULL) {
|
||||||
|
fprintf(stderr, "Convert fail, Cannot convert text to a device path");
|
||||||
|
free(Str16);
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
while (!((DevicePath->Type == END_DEVICE_PATH_TYPE) && (DevicePath->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)) )
|
||||||
|
{
|
||||||
|
PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);
|
||||||
|
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePath + (DevicePath->Length[0] | DevicePath->Length[1] << 8));
|
||||||
|
}
|
||||||
|
PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);
|
||||||
|
putchar('\n');
|
||||||
|
free(Str16);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
3362
BaseTools/Source/C/DevicePath/DevicePathFromText.c
Normal file
3362
BaseTools/Source/C/DevicePath/DevicePathFromText.c
Normal file
File diff suppressed because it is too large
Load Diff
875
BaseTools/Source/C/DevicePath/DevicePathUtilities.c
Normal file
875
BaseTools/Source/C/DevicePath/DevicePathUtilities.c
Normal file
@@ -0,0 +1,875 @@
|
|||||||
|
/** @file
|
||||||
|
Device Path services. The thing to remember is device paths are built out of
|
||||||
|
nodes. The device path is terminated by an end node that is length
|
||||||
|
sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
|
||||||
|
all over this file.
|
||||||
|
|
||||||
|
The only place where multi-instance device paths are supported is in
|
||||||
|
environment varibles. Multi-instance device paths should never be placed
|
||||||
|
on a Handle.
|
||||||
|
|
||||||
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "UefiDevicePathLib.h"
|
||||||
|
#include <Protocol/DevicePathUtilities.h>
|
||||||
|
|
||||||
|
//
|
||||||
|
// Template for an end-of-device path node.
|
||||||
|
//
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLibEndDevicePath = {
|
||||||
|
END_DEVICE_PATH_TYPE,
|
||||||
|
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||||
|
{
|
||||||
|
END_DEVICE_PATH_LENGTH,
|
||||||
|
0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determine whether a given device path is valid.
|
||||||
|
If DevicePath is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param MaxSize The maximum size of the device path data structure.
|
||||||
|
|
||||||
|
@retval TRUE DevicePath is valid.
|
||||||
|
@retval FALSE The length of any node node in the DevicePath is less
|
||||||
|
than sizeof (EFI_DEVICE_PATH_PROTOCOL).
|
||||||
|
@retval FALSE If MaxSize is not zero, the size of the DevicePath
|
||||||
|
exceeds MaxSize.
|
||||||
|
@retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node
|
||||||
|
count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathValid (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
UINTN MaxSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Count;
|
||||||
|
UINTN Size;
|
||||||
|
UINTN NodeLength;
|
||||||
|
|
||||||
|
ASSERT (DevicePath != NULL);
|
||||||
|
|
||||||
|
if (MaxSize == 0) {
|
||||||
|
MaxSize = MAX_UINTN;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate the input size big enough to touch the first node.
|
||||||
|
//
|
||||||
|
if (MaxSize < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
|
||||||
|
NodeLength = DevicePathNodeLength (DevicePath);
|
||||||
|
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NodeLength > MAX_UINTN - Size) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Size += NodeLength;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate next node before touch it.
|
||||||
|
//
|
||||||
|
if (Size > MaxSize - END_DEVICE_PATH_LENGTH ) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Count++;
|
||||||
|
if (Count >= MAX_DEVICE_PATH_NODE_COUNT) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Only return TRUE when the End Device Path node is valid.
|
||||||
|
//
|
||||||
|
return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the Type field of a device path node.
|
||||||
|
|
||||||
|
Returns the Type field of the device path node specified by Node.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@return The Type field of the device path node specified by Node.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT8
|
||||||
|
DevicePathType (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the SubType field of a device path node.
|
||||||
|
|
||||||
|
Returns the SubType field of the device path node specified by Node.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@return The SubType field of the device path node specified by Node.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT8
|
||||||
|
DevicePathSubType (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the 16-bit Length field of a device path node.
|
||||||
|
|
||||||
|
Returns the 16-bit Length field of the device path node specified by Node.
|
||||||
|
Node is not required to be aligned on a 16-bit boundary, so it is recommended
|
||||||
|
that a function such as ReadUnaligned16() be used to extract the contents of
|
||||||
|
the Length field.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@return The 16-bit Length field of the device path node specified by Node.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
DevicePathNodeLength (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the next node in a device path.
|
||||||
|
|
||||||
|
Returns a pointer to the device path node that follows the device path node
|
||||||
|
specified by Node.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@return a pointer to the device path node that follows the device path node
|
||||||
|
specified by Node.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
NextDevicePathNode (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines if a device path node is an end node of a device path.
|
||||||
|
This includes nodes that are the end of a device path instance and nodes that
|
||||||
|
are the end of an entire device path.
|
||||||
|
|
||||||
|
Determines if the device path node specified by Node is an end node of a device path.
|
||||||
|
This includes nodes that are the end of a device path instance and nodes that are the
|
||||||
|
end of an entire device path. If Node represents an end node of a device path,
|
||||||
|
then TRUE is returned. Otherwise, FALSE is returned.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@retval TRUE The device path node specified by Node is an end node of a
|
||||||
|
device path.
|
||||||
|
@retval FALSE The device path node specified by Node is not an end node of
|
||||||
|
a device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathEndType (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines if a device path node is an end node of an entire device path.
|
||||||
|
|
||||||
|
Determines if a device path node specified by Node is an end node of an entire
|
||||||
|
device path. If Node represents the end of an entire device path, then TRUE is
|
||||||
|
returned. Otherwise, FALSE is returned.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@retval TRUE The device path node specified by Node is the end of an entire
|
||||||
|
device path.
|
||||||
|
@retval FALSE The device path node specified by Node is not the end of an
|
||||||
|
entire device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathEnd (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines if a device path node is an end node of a device path instance.
|
||||||
|
|
||||||
|
Determines if a device path node specified by Node is an end node of a device
|
||||||
|
path instance. If Node represents the end of a device path instance, then TRUE
|
||||||
|
is returned. Otherwise, FALSE is returned.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
@retval TRUE The device path node specified by Node is the end of a device
|
||||||
|
path instance.
|
||||||
|
@retval FALSE The device path node specified by Node is not the end of a
|
||||||
|
device path instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathEndInstance (
|
||||||
|
CONST VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the length, in bytes, of a device path node.
|
||||||
|
|
||||||
|
Sets the length of the device path node specified by Node to the value specified
|
||||||
|
by NodeLength. NodeLength is returned. Node is not required to be aligned on
|
||||||
|
a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16()
|
||||||
|
be used to set the contents of the Length field.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
If NodeLength >= SIZE_64KB, then ASSERT().
|
||||||
|
If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
@param Length The length, in bytes, of the device path node.
|
||||||
|
|
||||||
|
@return Length
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT16
|
||||||
|
SetDevicePathNodeLength (
|
||||||
|
VOID *Node,
|
||||||
|
UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB));
|
||||||
|
return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fills in all the fields of a device path node that is the end of an entire device path.
|
||||||
|
|
||||||
|
Fills in all the fields of a device path node specified by Node so Node represents
|
||||||
|
the end of an entire device path. The Type field of Node is set to
|
||||||
|
END_DEVICE_PATH_TYPE, the SubType field of Node is set to
|
||||||
|
END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to
|
||||||
|
END_DEVICE_PATH_LENGTH. Node is not required to be aligned on a 16-bit boundary,
|
||||||
|
so it is recommended that a function such as WriteUnaligned16() be used to set
|
||||||
|
the contents of the Length field.
|
||||||
|
|
||||||
|
If Node is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param Node A pointer to a device path node data structure.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
SetDevicePathEndNode (
|
||||||
|
VOID *Node
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (Node != NULL);
|
||||||
|
memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of a device path in bytes.
|
||||||
|
|
||||||
|
This function returns the size, in bytes, of the device path data structure
|
||||||
|
specified by DevicePath including the end of device path node.
|
||||||
|
If DevicePath is NULL or invalid, then 0 is returned.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval 0 If DevicePath is NULL or invalid.
|
||||||
|
@retval Others The size of a device path in bytes.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
UefiDevicePathLibGetDevicePathSize (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *Start;
|
||||||
|
|
||||||
|
if (DevicePath == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsDevicePathValid (DevicePath, 0)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Search for the end of the device path structure
|
||||||
|
//
|
||||||
|
Start = DevicePath;
|
||||||
|
while (!IsDevicePathEnd (DevicePath)) {
|
||||||
|
DevicePath = NextDevicePathNode (DevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compute the size and add back in the size of the end device path structure
|
||||||
|
//
|
||||||
|
return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new copy of an existing device path.
|
||||||
|
|
||||||
|
This function allocates space for a new copy of the device path specified by DevicePath.
|
||||||
|
If DevicePath is NULL, then NULL is returned. If the memory is successfully
|
||||||
|
allocated, then the contents of DevicePath are copied to the newly allocated
|
||||||
|
buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory.
|
||||||
|
It is the responsibility of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval NULL DevicePath is NULL or invalid.
|
||||||
|
@retval Others A pointer to the duplicated device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibDuplicateDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Size;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compute the size
|
||||||
|
//
|
||||||
|
Size = GetDevicePathSize (DevicePath);
|
||||||
|
if (Size == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate space for duplicate device path
|
||||||
|
//
|
||||||
|
|
||||||
|
return AllocateCopyPool (Size, DevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new device path by appending a second device path to a first device path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of SecondDevicePath
|
||||||
|
to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path
|
||||||
|
device node from SecondDevicePath is retained. The newly created device path is
|
||||||
|
returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of
|
||||||
|
SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored,
|
||||||
|
and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and
|
||||||
|
SecondDevicePath are NULL, then a copy of an end-of-device-path is returned.
|
||||||
|
|
||||||
|
If there is not enough memory for the newly allocated buffer, then NULL is returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory.
|
||||||
|
It is the responsibility of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param FirstDevicePath A pointer to a device path data structure.
|
||||||
|
@param SecondDevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval NULL If there is not enough memory for the newly allocated buffer.
|
||||||
|
@retval NULL If FirstDevicePath or SecondDevicePath is invalid.
|
||||||
|
@retval Others A pointer to the new device path if success.
|
||||||
|
Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Size;
|
||||||
|
UINTN Size1;
|
||||||
|
UINTN Size2;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath2;
|
||||||
|
|
||||||
|
//
|
||||||
|
// If there's only 1 path, just duplicate it.
|
||||||
|
//
|
||||||
|
if (FirstDevicePath == NULL) {
|
||||||
|
return DuplicateDevicePath ((SecondDevicePath != NULL) ? SecondDevicePath : &mUefiDevicePathLibEndDevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SecondDevicePath == NULL) {
|
||||||
|
return DuplicateDevicePath (FirstDevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsDevicePathValid (FirstDevicePath, 0) || !IsDevicePathValid (SecondDevicePath, 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate space for the combined device path. It only has one end node of
|
||||||
|
// length EFI_DEVICE_PATH_PROTOCOL.
|
||||||
|
//
|
||||||
|
Size1 = GetDevicePathSize (FirstDevicePath);
|
||||||
|
Size2 = GetDevicePathSize (SecondDevicePath);
|
||||||
|
Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
|
||||||
|
|
||||||
|
NewDevicePath = AllocatePool (Size);
|
||||||
|
|
||||||
|
if (NewDevicePath != NULL) {
|
||||||
|
NewDevicePath = memcpy (NewDevicePath, FirstDevicePath, Size1);
|
||||||
|
//
|
||||||
|
// Over write FirstDevicePath EndNode and do the copy
|
||||||
|
//
|
||||||
|
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
|
||||||
|
(Size1 - END_DEVICE_PATH_LENGTH));
|
||||||
|
memcpy (DevicePath2, SecondDevicePath, Size2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewDevicePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new path by appending the device node to the device path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of the device node
|
||||||
|
specified by DevicePathNode to a copy of the device path specified by DevicePath
|
||||||
|
in an allocated buffer. The end-of-device-path device node is moved after the
|
||||||
|
end of the appended device node.
|
||||||
|
If DevicePathNode is NULL then a copy of DevicePath is returned.
|
||||||
|
If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device
|
||||||
|
path device node is returned.
|
||||||
|
If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path
|
||||||
|
device node is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param DevicePathNode A pointer to a single device path node.
|
||||||
|
|
||||||
|
@retval NULL If there is not enough memory for the new device path.
|
||||||
|
@retval Others A pointer to the new device path if success.
|
||||||
|
A copy of DevicePathNode followed by an end-of-device-path node
|
||||||
|
if both FirstDevicePath and SecondDevicePath are NULL.
|
||||||
|
A copy of an end-of-device-path node if both FirstDevicePath
|
||||||
|
and SecondDevicePath are NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePathNode (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *NextNode;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||||
|
UINTN NodeLength;
|
||||||
|
|
||||||
|
if (DevicePathNode == NULL) {
|
||||||
|
return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Build a Node that has a terminator on it
|
||||||
|
//
|
||||||
|
NodeLength = DevicePathNodeLength (DevicePathNode);
|
||||||
|
|
||||||
|
TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH);
|
||||||
|
if (TempDevicePath == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
TempDevicePath = memcpy (TempDevicePath, DevicePathNode, NodeLength);
|
||||||
|
//
|
||||||
|
// Add and end device path node to convert Node to device path
|
||||||
|
//
|
||||||
|
NextNode = NextDevicePathNode (TempDevicePath);
|
||||||
|
SetDevicePathEndNode (NextNode);
|
||||||
|
//
|
||||||
|
// Append device paths
|
||||||
|
//
|
||||||
|
NewDevicePath = AppendDevicePath (DevicePath, TempDevicePath);
|
||||||
|
|
||||||
|
free (TempDevicePath);
|
||||||
|
|
||||||
|
return NewDevicePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new device path by appending the specified device path instance to the specified device
|
||||||
|
path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of the device path
|
||||||
|
instance specified by DevicePathInstance to a copy of the device path specified
|
||||||
|
by DevicePath in a allocated buffer.
|
||||||
|
The end-of-device-path device node is moved after the end of the appended device
|
||||||
|
path instance and a new end-of-device-path-instance node is inserted between.
|
||||||
|
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
|
||||||
|
If DevicePathInstance is NULL, then NULL is returned.
|
||||||
|
If DevicePath or DevicePathInstance is invalid, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param DevicePathInstance A pointer to a device path instance.
|
||||||
|
|
||||||
|
@return A pointer to the new device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePathInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||||
|
UINTN SrcSize;
|
||||||
|
UINTN InstanceSize;
|
||||||
|
|
||||||
|
if (DevicePath == NULL) {
|
||||||
|
return DuplicateDevicePath (DevicePathInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DevicePathInstance == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsDevicePathValid (DevicePath, 0) || !IsDevicePathValid (DevicePathInstance, 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SrcSize = GetDevicePathSize (DevicePath);
|
||||||
|
InstanceSize = GetDevicePathSize (DevicePathInstance);
|
||||||
|
|
||||||
|
NewDevicePath = AllocatePool (SrcSize + InstanceSize);
|
||||||
|
if (NewDevicePath != NULL) {
|
||||||
|
|
||||||
|
TempDevicePath = memcpy (NewDevicePath, DevicePath, SrcSize);;
|
||||||
|
|
||||||
|
while (!IsDevicePathEnd (TempDevicePath)) {
|
||||||
|
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
|
||||||
|
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||||
|
memcpy (TempDevicePath, DevicePathInstance, InstanceSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewDevicePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||||
|
instance.
|
||||||
|
|
||||||
|
This function creates a copy of the current device path instance. It also updates
|
||||||
|
DevicePath to point to the next device path instance in the device path (or NULL
|
||||||
|
if no more) and updates Size to hold the size of the device path instance copy.
|
||||||
|
If DevicePath is NULL, then NULL is returned.
|
||||||
|
If DevicePath points to a invalid device path, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
If Size is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param DevicePath On input, this holds the pointer to the current
|
||||||
|
device path instance. On output, this holds
|
||||||
|
the pointer to the next device path instance
|
||||||
|
or NULL if there are no more device path
|
||||||
|
instances in the device path pointer to a
|
||||||
|
device path data structure.
|
||||||
|
@param Size On output, this holds the size of the device
|
||||||
|
path instance, in bytes or zero, if DevicePath
|
||||||
|
is NULL.
|
||||||
|
|
||||||
|
@return A pointer to the current device path instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibGetNextDevicePathInstance (
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
|
UINTN *Size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *ReturnValue;
|
||||||
|
UINT8 Temp;
|
||||||
|
|
||||||
|
ASSERT (Size != NULL);
|
||||||
|
|
||||||
|
if (DevicePath == NULL || *DevicePath == NULL) {
|
||||||
|
*Size = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsDevicePathValid (*DevicePath, 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find the end of the device path instance
|
||||||
|
//
|
||||||
|
DevPath = *DevicePath;
|
||||||
|
while (!IsDevicePathEndType (DevPath)) {
|
||||||
|
DevPath = NextDevicePathNode (DevPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compute the size of the device path instance
|
||||||
|
//
|
||||||
|
*Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make a copy and return the device path instance
|
||||||
|
//
|
||||||
|
Temp = DevPath->SubType;
|
||||||
|
DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||||
|
ReturnValue = DuplicateDevicePath (*DevicePath);
|
||||||
|
DevPath->SubType = Temp;
|
||||||
|
|
||||||
|
//
|
||||||
|
// If DevPath is the end of an entire device path, then another instance
|
||||||
|
// does not follow, so *DevicePath is set to NULL.
|
||||||
|
//
|
||||||
|
if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
|
||||||
|
*DevicePath = NULL;
|
||||||
|
} else {
|
||||||
|
*DevicePath = NextDevicePathNode (DevPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a device node.
|
||||||
|
|
||||||
|
This function creates a new device node in a newly allocated buffer of size
|
||||||
|
NodeLength and initializes the device path node header with NodeType and NodeSubType.
|
||||||
|
The new device path node is returned.
|
||||||
|
If NodeLength is smaller than a device path header, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param NodeType The device node type for the new device node.
|
||||||
|
@param NodeSubType The device node sub-type for the new device node.
|
||||||
|
@param NodeLength The length of the new device node.
|
||||||
|
|
||||||
|
@return The new device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibCreateDeviceNode (
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
|
||||||
|
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
|
||||||
|
//
|
||||||
|
// NodeLength is less than the size of the header.
|
||||||
|
//
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
DevicePath = AllocateZeroPool (NodeLength);
|
||||||
|
if (DevicePath != NULL) {
|
||||||
|
DevicePath->Type = NodeType;
|
||||||
|
DevicePath->SubType = NodeSubType;
|
||||||
|
SetDevicePathNodeLength (DevicePath, NodeLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DevicePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines if a device path is single or multi-instance.
|
||||||
|
|
||||||
|
This function returns TRUE if the device path specified by DevicePath is
|
||||||
|
multi-instance.
|
||||||
|
Otherwise, FALSE is returned.
|
||||||
|
If DevicePath is NULL or invalid, then FALSE is returned.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval TRUE DevicePath is multi-instance.
|
||||||
|
@retval FALSE DevicePath is not multi-instance, or DevicePath
|
||||||
|
is NULL or invalid.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
UefiDevicePathLibIsDevicePathMultiInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||||
|
|
||||||
|
if (DevicePath == NULL) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsDevicePathValid (DevicePath, 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node = DevicePath;
|
||||||
|
while (!IsDevicePathEnd (Node)) {
|
||||||
|
if (IsDevicePathEndInstance (Node)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node = NextDevicePathNode (Node);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the device path protocol from a handle.
|
||||||
|
|
||||||
|
This function returns the device path protocol from the handle specified by Handle.
|
||||||
|
If Handle is NULL or Handle does not contain a device path protocol, then NULL
|
||||||
|
is returned.
|
||||||
|
|
||||||
|
@param Handle The handle from which to retrieve the device
|
||||||
|
path protocol.
|
||||||
|
|
||||||
|
@return The device path protocol from the handle specified by Handle.
|
||||||
|
|
||||||
|
**/
|
||||||
|
/*
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
DevicePathFromHandle (
|
||||||
|
EFI_HANDLE Handle
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
Handle,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
(VOID *) &DevicePath
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DevicePath = NULL;
|
||||||
|
}
|
||||||
|
return DevicePath;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
Allocates a device path for a file and appends it to an existing device path.
|
||||||
|
|
||||||
|
If Device is a valid device handle that contains a device path protocol, then a device path for
|
||||||
|
the file specified by FileName is allocated and appended to the device path associated with the
|
||||||
|
handle Device. The allocated device path is returned. If Device is NULL or Device is a handle
|
||||||
|
that does not support the device path protocol, then a device path containing a single device
|
||||||
|
path node for the file specified by FileName is allocated and returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
If FileName is NULL, then ASSERT().
|
||||||
|
If FileName is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
|
|
||||||
|
@param Device A pointer to a device handle. This parameter
|
||||||
|
is optional and may be NULL.
|
||||||
|
@param FileName A pointer to a Null-terminated Unicode string.
|
||||||
|
|
||||||
|
@return The allocated device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
FileDevicePath (
|
||||||
|
EFI_HANDLE Device, OPTIONAL
|
||||||
|
CONST CHAR16 *FileName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Size;
|
||||||
|
FILEPATH_DEVICE_PATH *FilePath;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
|
||||||
|
|
||||||
|
DevicePath = NULL;
|
||||||
|
|
||||||
|
Size = StrSize (FileName);
|
||||||
|
FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
|
||||||
|
if (FileDevicePath != NULL) {
|
||||||
|
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
|
||||||
|
FilePath->Header.Type = MEDIA_DEVICE_PATH;
|
||||||
|
FilePath->Header.SubType = MEDIA_FILEPATH_DP;
|
||||||
|
memcpy (&FilePath->PathName, FileName, Size);
|
||||||
|
SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
|
||||||
|
SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
|
||||||
|
|
||||||
|
//if (Device != NULL) {
|
||||||
|
// DevicePath = DevicePathFromHandle (Device);
|
||||||
|
//}
|
||||||
|
|
||||||
|
DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
|
||||||
|
free (FileDevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DevicePath;
|
||||||
|
}
|
||||||
30
BaseTools/Source/C/DevicePath/GNUmakefile
Normal file
30
BaseTools/Source/C/DevicePath/GNUmakefile
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
## @file
|
||||||
|
# GNU/Linux makefile for 'DevicePath' module build.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
# This program and the accompanying materials
|
||||||
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
ARCH ?= IA32
|
||||||
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
|
APPNAME = DevicePath
|
||||||
|
|
||||||
|
OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o DevicePathUtilities.o
|
||||||
|
|
||||||
|
include $(MAKEROOT)/Makefiles/app.makefile
|
||||||
|
|
||||||
|
LIBS = -lCommon
|
||||||
|
ifeq ($(CYGWIN), CYGWIN)
|
||||||
|
LIBS += -L/lib/e2fsprogs -luuid
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LINUX), Linux)
|
||||||
|
LIBS += -luuid
|
||||||
|
endif
|
||||||
|
|
||||||
24
BaseTools/Source/C/DevicePath/Makefile
Normal file
24
BaseTools/Source/C/DevicePath/Makefile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
## @file
|
||||||
|
# Windows makefile for 'DevicePath' module build.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
# This program and the accompanying materials
|
||||||
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
!INCLUDE ..\Makefiles\ms.common
|
||||||
|
|
||||||
|
APPNAME = DevicePath
|
||||||
|
|
||||||
|
LIBS = $(LIB_PATH)\Common.lib
|
||||||
|
|
||||||
|
OBJECTS = DevicePath.obj UefiDevicePathLib.obj DevicePathFromText.obj DevicePathUtilities.obj
|
||||||
|
|
||||||
|
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||||
|
|
||||||
|
!INCLUDE ..\Makefiles\ms.app
|
||||||
|
|
||||||
298
BaseTools/Source/C/DevicePath/UefiDevicePathLib.c
Normal file
298
BaseTools/Source/C/DevicePath/UefiDevicePathLib.c
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
/** @file
|
||||||
|
Device Path services. The thing to remember is device paths are built out of
|
||||||
|
nodes. The device path is terminated by an end node that is length
|
||||||
|
sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
|
||||||
|
all over this file.
|
||||||
|
|
||||||
|
The only place where multi-instance device paths are supported is in
|
||||||
|
environment varibles. Multi-instance device paths should never be placed
|
||||||
|
on a Handle.
|
||||||
|
|
||||||
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
#include "UefiDevicePathLib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of a device path in bytes.
|
||||||
|
|
||||||
|
This function returns the size, in bytes, of the device path data structure
|
||||||
|
specified by DevicePath including the end of device path node.
|
||||||
|
If DevicePath is NULL or invalid, then 0 is returned.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval 0 If DevicePath is NULL or invalid.
|
||||||
|
@retval Others The size of a device path in bytes.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
GetDevicePathSize (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibGetDevicePathSize (DevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new copy of an existing device path.
|
||||||
|
|
||||||
|
This function allocates space for a new copy of the device path specified by DevicePath.
|
||||||
|
If DevicePath is NULL, then NULL is returned. If the memory is successfully
|
||||||
|
allocated, then the contents of DevicePath are copied to the newly allocated
|
||||||
|
buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory.
|
||||||
|
It is the responsibility of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval NULL DevicePath is NULL or invalid.
|
||||||
|
@retval Others A pointer to the duplicated device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
DuplicateDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibDuplicateDevicePath (DevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new device path by appending a second device path to a first device path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of SecondDevicePath
|
||||||
|
to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path
|
||||||
|
device node from SecondDevicePath is retained. The newly created device path is
|
||||||
|
returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of
|
||||||
|
SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored,
|
||||||
|
and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and
|
||||||
|
SecondDevicePath are NULL, then a copy of an end-of-device-path is returned.
|
||||||
|
|
||||||
|
If there is not enough memory for the newly allocated buffer, then NULL is returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory.
|
||||||
|
It is the responsibility of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param FirstDevicePath A pointer to a device path data structure.
|
||||||
|
@param SecondDevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval NULL If there is not enough memory for the newly allocated buffer.
|
||||||
|
@retval NULL If FirstDevicePath or SecondDevicePath is invalid.
|
||||||
|
@retval Others A pointer to the new device path if success.
|
||||||
|
Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
AppendDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibAppendDevicePath (FirstDevicePath, SecondDevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new path by appending the device node to the device path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of the device node
|
||||||
|
specified by DevicePathNode to a copy of the device path specified by DevicePath
|
||||||
|
in an allocated buffer. The end-of-device-path device node is moved after the
|
||||||
|
end of the appended device node.
|
||||||
|
If DevicePathNode is NULL then a copy of DevicePath is returned.
|
||||||
|
If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device
|
||||||
|
path device node is returned.
|
||||||
|
If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path
|
||||||
|
device node is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param DevicePathNode A pointer to a single device path node.
|
||||||
|
|
||||||
|
@retval NULL If there is not enough memory for the new device path.
|
||||||
|
@retval Others A pointer to the new device path if success.
|
||||||
|
A copy of DevicePathNode followed by an end-of-device-path node
|
||||||
|
if both FirstDevicePath and SecondDevicePath are NULL.
|
||||||
|
A copy of an end-of-device-path node if both FirstDevicePath
|
||||||
|
and SecondDevicePath are NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
AppendDevicePathNode (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibAppendDevicePathNode (DevicePath, DevicePathNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new device path by appending the specified device path instance to the specified device
|
||||||
|
path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of the device path
|
||||||
|
instance specified by DevicePathInstance to a copy of the device path specified
|
||||||
|
by DevicePath in a allocated buffer.
|
||||||
|
The end-of-device-path device node is moved after the end of the appended device
|
||||||
|
path instance and a new end-of-device-path-instance node is inserted between.
|
||||||
|
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
|
||||||
|
If DevicePathInstance is NULL, then NULL is returned.
|
||||||
|
If DevicePath or DevicePathInstance is invalid, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param DevicePathInstance A pointer to a device path instance.
|
||||||
|
|
||||||
|
@return A pointer to the new device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
AppendDevicePathInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibAppendDevicePathInstance (DevicePath, DevicePathInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||||
|
instance.
|
||||||
|
|
||||||
|
This function creates a copy of the current device path instance. It also updates
|
||||||
|
DevicePath to point to the next device path instance in the device path (or NULL
|
||||||
|
if no more) and updates Size to hold the size of the device path instance copy.
|
||||||
|
If DevicePath is NULL, then NULL is returned.
|
||||||
|
If DevicePath points to a invalid device path, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
If Size is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param DevicePath On input, this holds the pointer to the current
|
||||||
|
device path instance. On output, this holds
|
||||||
|
the pointer to the next device path instance
|
||||||
|
or NULL if there are no more device path
|
||||||
|
instances in the device path pointer to a
|
||||||
|
device path data structure.
|
||||||
|
@param Size On output, this holds the size of the device
|
||||||
|
path instance, in bytes or zero, if DevicePath
|
||||||
|
is NULL.
|
||||||
|
|
||||||
|
@return A pointer to the current device path instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
GetNextDevicePathInstance (
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
|
UINTN *Size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a device node.
|
||||||
|
|
||||||
|
This function creates a new device node in a newly allocated buffer of size
|
||||||
|
NodeLength and initializes the device path node header with NodeType and NodeSubType.
|
||||||
|
The new device path node is returned.
|
||||||
|
If NodeLength is smaller than a device path header, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param NodeType The device node type for the new device node.
|
||||||
|
@param NodeSubType The device node sub-type for the new device node.
|
||||||
|
@param NodeLength The length of the new device node.
|
||||||
|
|
||||||
|
@return The new device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
CreateDeviceNode (
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines if a device path is single or multi-instance.
|
||||||
|
|
||||||
|
This function returns TRUE if the device path specified by DevicePath is
|
||||||
|
multi-instance.
|
||||||
|
Otherwise, FALSE is returned.
|
||||||
|
If DevicePath is NULL or invalid, then FALSE is returned.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval TRUE DevicePath is multi-instance.
|
||||||
|
@retval FALSE DevicePath is not multi-instance, or DevicePath
|
||||||
|
is NULL or invalid.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathMultiInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert text to the binary representation of a device node.
|
||||||
|
|
||||||
|
@param TextDeviceNode TextDeviceNode points to the text representation of a device
|
||||||
|
node. Conversion starts with the first character and continues
|
||||||
|
until the first non-device node character.
|
||||||
|
|
||||||
|
@return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
|
||||||
|
insufficient memory or text unsupported.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
ConvertTextToDeviceNode (
|
||||||
|
CONST CHAR16 *TextDeviceNode
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert text to the binary representation of a device path.
|
||||||
|
|
||||||
|
|
||||||
|
@param TextDevicePath TextDevicePath points to the text representation of a device
|
||||||
|
path. Conversion starts with the first character and continues
|
||||||
|
until the first non-device node character.
|
||||||
|
|
||||||
|
@return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
|
||||||
|
there was insufficient memory.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
ConvertTextToDevicePath (
|
||||||
|
CONST CHAR16 *TextDevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath);
|
||||||
|
}
|
||||||
452
BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
Normal file
452
BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
Normal file
@@ -0,0 +1,452 @@
|
|||||||
|
/** @file
|
||||||
|
Definition for Device Path library.
|
||||||
|
|
||||||
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
#ifndef _UEFI_DEVICE_PATH_LIB_H_
|
||||||
|
#define _UEFI_DEVICE_PATH_LIB_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#include <direct.h>
|
||||||
|
#endif
|
||||||
|
#include <Common/UefiBaseTypes.h>
|
||||||
|
#include <Protocol/DevicePath.h>
|
||||||
|
#include <Protocol/DevicePathUtilities.h>
|
||||||
|
#include "CommonLib.h"
|
||||||
|
#include "EfiUtilityMsgs.h"
|
||||||
|
|
||||||
|
#define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
|
||||||
|
#define MAX_DEVICE_PATH_NODE_COUNT 1024
|
||||||
|
#define SIZE_64KB 0x00010000
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private Data structure
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
(*DEVICE_PATH_FROM_TEXT) (
|
||||||
|
IN CHAR16 *Str
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
CHAR16 *Str;
|
||||||
|
UINTN Count;
|
||||||
|
UINTN Capacity;
|
||||||
|
} POOL_PRINT;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
CHAR16 *DevicePathNodeText;
|
||||||
|
DEVICE_PATH_FROM_TEXT Function;
|
||||||
|
} DEVICE_PATH_FROM_TEXT_TABLE;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
BOOLEAN ClassExist;
|
||||||
|
UINT8 Class;
|
||||||
|
BOOLEAN SubClassExist;
|
||||||
|
UINT8 SubClass;
|
||||||
|
} USB_CLASS_TEXT;
|
||||||
|
|
||||||
|
#define USB_CLASS_AUDIO 1
|
||||||
|
#define USB_CLASS_CDCCONTROL 2
|
||||||
|
#define USB_CLASS_HID 3
|
||||||
|
#define USB_CLASS_IMAGE 6
|
||||||
|
#define USB_CLASS_PRINTER 7
|
||||||
|
#define USB_CLASS_MASS_STORAGE 8
|
||||||
|
#define USB_CLASS_HUB 9
|
||||||
|
#define USB_CLASS_CDCDATA 10
|
||||||
|
#define USB_CLASS_SMART_CARD 11
|
||||||
|
#define USB_CLASS_VIDEO 14
|
||||||
|
#define USB_CLASS_DIAGNOSTIC 220
|
||||||
|
#define USB_CLASS_WIRELESS 224
|
||||||
|
|
||||||
|
#define USB_CLASS_RESERVE 254
|
||||||
|
#define USB_SUBCLASS_FW_UPDATE 1
|
||||||
|
#define USB_SUBCLASS_IRDA_BRIDGE 2
|
||||||
|
#define USB_SUBCLASS_TEST 3
|
||||||
|
|
||||||
|
#define RFC_1700_UDP_PROTOCOL 17
|
||||||
|
#define RFC_1700_TCP_PROTOCOL 6
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 VendorDefinedData[1];
|
||||||
|
} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 VendorDefinedData[1];
|
||||||
|
} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 VendorDefinedData[1];
|
||||||
|
} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
|
UINT32 Hid;
|
||||||
|
UINT32 Uid;
|
||||||
|
UINT32 Cid;
|
||||||
|
CHAR8 HidUidCidStr[3];
|
||||||
|
} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
|
UINT16 NetworkProtocol;
|
||||||
|
UINT16 LoginOption;
|
||||||
|
UINT64 Lun;
|
||||||
|
UINT16 TargetPortalGroupTag;
|
||||||
|
CHAR8 TargetName[1];
|
||||||
|
} ISCSI_DEVICE_PATH_WITH_NAME;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 VendorDefinedData[1];
|
||||||
|
} VENDOR_DEVICE_PATH_WITH_DATA;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of a device path in bytes.
|
||||||
|
|
||||||
|
This function returns the size, in bytes, of the device path data structure
|
||||||
|
specified by DevicePath including the end of device path node.
|
||||||
|
If DevicePath is NULL or invalid, then 0 is returned.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval 0 If DevicePath is NULL or invalid.
|
||||||
|
@retval Others The size of a device path in bytes.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
UefiDevicePathLibGetDevicePathSize (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new copy of an existing device path.
|
||||||
|
|
||||||
|
This function allocates space for a new copy of the device path specified by DevicePath.
|
||||||
|
If DevicePath is NULL, then NULL is returned. If the memory is successfully
|
||||||
|
allocated, then the contents of DevicePath are copied to the newly allocated
|
||||||
|
buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory.
|
||||||
|
It is the responsibility of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval NULL DevicePath is NULL or invalid.
|
||||||
|
@retval Others A pointer to the duplicated device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibDuplicateDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new device path by appending a second device path to a first device path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of SecondDevicePath
|
||||||
|
to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path
|
||||||
|
device node from SecondDevicePath is retained. The newly created device path is
|
||||||
|
returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of
|
||||||
|
SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored,
|
||||||
|
and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and
|
||||||
|
SecondDevicePath are NULL, then a copy of an end-of-device-path is returned.
|
||||||
|
|
||||||
|
If there is not enough memory for the newly allocated buffer, then NULL is returned.
|
||||||
|
The memory for the new device path is allocated from EFI boot services memory.
|
||||||
|
It is the responsibility of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param FirstDevicePath A pointer to a device path data structure.
|
||||||
|
@param SecondDevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval NULL If there is not enough memory for the newly allocated buffer.
|
||||||
|
@retval NULL If FirstDevicePath or SecondDevicePath is invalid.
|
||||||
|
@retval Others A pointer to the new device path if success.
|
||||||
|
Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new path by appending the device node to the device path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of the device node
|
||||||
|
specified by DevicePathNode to a copy of the device path specified by DevicePath
|
||||||
|
in an allocated buffer. The end-of-device-path device node is moved after the
|
||||||
|
end of the appended device node.
|
||||||
|
If DevicePathNode is NULL then a copy of DevicePath is returned.
|
||||||
|
If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device
|
||||||
|
path device node is returned.
|
||||||
|
If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path
|
||||||
|
device node is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param DevicePathNode A pointer to a single device path node.
|
||||||
|
|
||||||
|
@retval NULL If there is not enough memory for the new device path.
|
||||||
|
@retval Others A pointer to the new device path if success.
|
||||||
|
A copy of DevicePathNode followed by an end-of-device-path node
|
||||||
|
if both FirstDevicePath and SecondDevicePath are NULL.
|
||||||
|
A copy of an end-of-device-path node if both FirstDevicePath
|
||||||
|
and SecondDevicePath are NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePathNode (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new device path by appending the specified device path instance to the specified device
|
||||||
|
path.
|
||||||
|
|
||||||
|
This function creates a new device path by appending a copy of the device path
|
||||||
|
instance specified by DevicePathInstance to a copy of the device path specified
|
||||||
|
by DevicePath in a allocated buffer.
|
||||||
|
The end-of-device-path device node is moved after the end of the appended device
|
||||||
|
path instance and a new end-of-device-path-instance node is inserted between.
|
||||||
|
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
|
||||||
|
If DevicePathInstance is NULL, then NULL is returned.
|
||||||
|
If DevicePath or DevicePathInstance is invalid, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
@param DevicePathInstance A pointer to a device path instance.
|
||||||
|
|
||||||
|
@return A pointer to the new device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePathInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||||
|
instance.
|
||||||
|
|
||||||
|
This function creates a copy of the current device path instance. It also updates
|
||||||
|
DevicePath to point to the next device path instance in the device path (or NULL
|
||||||
|
if no more) and updates Size to hold the size of the device path instance copy.
|
||||||
|
If DevicePath is NULL, then NULL is returned.
|
||||||
|
If DevicePath points to a invalid device path, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
If Size is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param DevicePath On input, this holds the pointer to the current
|
||||||
|
device path instance. On output, this holds
|
||||||
|
the pointer to the next device path instance
|
||||||
|
or NULL if there are no more device path
|
||||||
|
instances in the device path pointer to a
|
||||||
|
device path data structure.
|
||||||
|
@param Size On output, this holds the size of the device
|
||||||
|
path instance, in bytes or zero, if DevicePath
|
||||||
|
is NULL.
|
||||||
|
|
||||||
|
@return A pointer to the current device path instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibGetNextDevicePathInstance (
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
|
UINTN *Size
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a device node.
|
||||||
|
|
||||||
|
This function creates a new device node in a newly allocated buffer of size
|
||||||
|
NodeLength and initializes the device path node header with NodeType and NodeSubType.
|
||||||
|
The new device path node is returned.
|
||||||
|
If NodeLength is smaller than a device path header, then NULL is returned.
|
||||||
|
If there is not enough memory to allocate space for the new device path, then
|
||||||
|
NULL is returned.
|
||||||
|
The memory is allocated from EFI boot services memory. It is the responsibility
|
||||||
|
of the caller to free the memory allocated.
|
||||||
|
|
||||||
|
@param NodeType The device node type for the new device node.
|
||||||
|
@param NodeSubType The device node sub-type for the new device node.
|
||||||
|
@param NodeLength The length of the new device node.
|
||||||
|
|
||||||
|
@return The new device path.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibCreateDeviceNode (
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines if a device path is single or multi-instance.
|
||||||
|
|
||||||
|
This function returns TRUE if the device path specified by DevicePath is
|
||||||
|
multi-instance.
|
||||||
|
Otherwise, FALSE is returned.
|
||||||
|
If DevicePath is NULL or invalid, then FALSE is returned.
|
||||||
|
|
||||||
|
@param DevicePath A pointer to a device path data structure.
|
||||||
|
|
||||||
|
@retval TRUE DevicePath is multi-instance.
|
||||||
|
@retval FALSE DevicePath is not multi-instance, or DevicePath
|
||||||
|
is NULL or invalid.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
UefiDevicePathLibIsDevicePathMultiInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert text to the binary representation of a device node.
|
||||||
|
|
||||||
|
@param TextDeviceNode TextDeviceNode points to the text representation of a device
|
||||||
|
node. Conversion starts with the first character and continues
|
||||||
|
until the first non-device node character.
|
||||||
|
|
||||||
|
@return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
|
||||||
|
insufficient memory or text unsupported.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibConvertTextToDeviceNode (
|
||||||
|
CONST CHAR16 *TextDeviceNode
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert text to the binary representation of a device path.
|
||||||
|
|
||||||
|
|
||||||
|
@param TextDevicePath TextDevicePath points to the text representation of a device
|
||||||
|
path. Conversion starts with the first character and continues
|
||||||
|
until the first non-device node character.
|
||||||
|
|
||||||
|
@return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
|
||||||
|
there was insufficient memory.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibConvertTextToDevicePath (
|
||||||
|
CONST CHAR16 *TextDevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
CreateDeviceNode (
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
CreateDeviceNode (
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathMultiInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
GetNextDevicePathInstance (
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
|
UINTN *Size
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
AppendDevicePathInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
AppendDevicePathNode (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
|
||||||
|
);
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
AppendDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
DuplicateDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
GetDevicePathSize (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
CHAR16 *
|
||||||
|
ConvertDeviceNodeToText (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
|
||||||
|
BOOLEAN DisplayOnly,
|
||||||
|
BOOLEAN AllowShortcuts
|
||||||
|
);
|
||||||
|
|
||||||
|
CHAR16 *
|
||||||
|
ConvertDevicePathToText (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
BOOLEAN DisplayOnly,
|
||||||
|
BOOLEAN AllowShortcuts
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
ConvertTextToDeviceNode (
|
||||||
|
CONST CHAR16 *TextDeviceNode
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
ConvertTextToDevicePath (
|
||||||
|
CONST CHAR16 *TextDevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'EfiLdrImage' module build.
|
# GNU/Linux makefile for 'EfiLdrImage' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = EfiLdrImage
|
APPNAME = EfiLdrImage
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'EfiRom' module build.
|
# GNU/Linux makefile for 'EfiRom' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = EfiRom
|
APPNAME = EfiRom
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ APPLICATIONS = \
|
|||||||
LzmaCompress \
|
LzmaCompress \
|
||||||
Split \
|
Split \
|
||||||
TianoCompress \
|
TianoCompress \
|
||||||
VolInfo
|
VolInfo \
|
||||||
|
DevicePath
|
||||||
|
|
||||||
SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
|
SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenCrc32' module build.
|
# GNU/Linux makefile for 'GenCrc32' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenCrc32
|
APPNAME = GenCrc32
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenFfs' module build.
|
# GNU/Linux makefile for 'GenFfs' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenFfs
|
APPNAME = GenFfs
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenFv' module build.
|
# GNU/Linux makefile for 'GenFv' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenFv
|
APPNAME = GenFv
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains the internal functions required to generate a Firmware Volume.
|
This file contains the internal functions required to generate a Firmware Volume.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
||||||
Portions Copyright (c) 2016 HP Development Company, L.P.<BR>
|
Portions Copyright (c) 2016 HP Development Company, L.P.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
@@ -34,10 +34,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#include <Guid/FfsSectionAlignmentPadding.h>
|
#include <Guid/FfsSectionAlignmentPadding.h>
|
||||||
|
|
||||||
|
#include "WinNtInclude.h"
|
||||||
#include "GenFvInternalLib.h"
|
#include "GenFvInternalLib.h"
|
||||||
#include "FvLib.h"
|
#include "FvLib.h"
|
||||||
#include "PeCoffLib.h"
|
#include "PeCoffLib.h"
|
||||||
#include "WinNtInclude.h"
|
|
||||||
|
|
||||||
#define ARMT_UNCONDITIONAL_JUMP_INSTRUCTION 0xEB000000
|
#define ARMT_UNCONDITIONAL_JUMP_INSTRUCTION 0xEB000000
|
||||||
#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000
|
#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000
|
||||||
@@ -3532,7 +3532,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Xip module has the same section alignment and file alignment.
|
// Xip module has the same section alignment and file alignment.
|
||||||
//
|
//
|
||||||
Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment do not match : %s.", FileName);
|
Error (NULL, 0, 3000, "Invalid", "PE image Section-Alignment and File-Alignment do not match : %s.", FileName);
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -3610,7 +3610,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Xip module has the same section alignment and file alignment.
|
// Xip module has the same section alignment and file alignment.
|
||||||
//
|
//
|
||||||
Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment do not match : %s.", FileName);
|
Error (NULL, 0, 3000, "Invalid", "PE image Section-Alignment and File-Alignment do not match : %s.", FileName);
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + CurSecHdrSize - (UINTN)FfsFile;
|
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + CurSecHdrSize - (UINTN)FfsFile;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenFw' module build.
|
# GNU/Linux makefile for 'GenFw' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenFw
|
APPNAME = GenFw
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ CHAR8 *mInImageName;
|
|||||||
UINT32 mImageTimeStamp = 0;
|
UINT32 mImageTimeStamp = 0;
|
||||||
UINT32 mImageSize = 0;
|
UINT32 mImageSize = 0;
|
||||||
UINT32 mOutImageType = FW_DUMMY_IMAGE;
|
UINT32 mOutImageType = FW_DUMMY_IMAGE;
|
||||||
|
BOOLEAN mIsConvertXip = FALSE;
|
||||||
|
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
@@ -665,6 +666,8 @@ PeCoffConvertImageToXip (
|
|||||||
free (*FileBuffer);
|
free (*FileBuffer);
|
||||||
*FileLength = XipLength;
|
*FileLength = XipLength;
|
||||||
*FileBuffer = XipFile;
|
*FileBuffer = XipFile;
|
||||||
|
|
||||||
|
mIsConvertXip = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 *
|
UINT8 *
|
||||||
@@ -2897,6 +2900,9 @@ Returns:
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
for (Index=0; Index < DebugDirectoryEntrySize / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); Index ++, DebugEntry ++) {
|
for (Index=0; Index < DebugDirectoryEntrySize / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); Index ++, DebugEntry ++) {
|
||||||
DebugEntry->TimeDateStamp = 0;
|
DebugEntry->TimeDateStamp = 0;
|
||||||
|
if (mIsConvertXip) {
|
||||||
|
DebugEntry->FileOffset = DebugEntry->RVA;
|
||||||
|
}
|
||||||
if (ZeroDebugFlag || DebugEntry->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
|
if (ZeroDebugFlag || DebugEntry->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
|
||||||
memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData);
|
memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData);
|
||||||
memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
|
memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenPage' module build.
|
# GNU/Linux makefile for 'GenPage' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenPage
|
APPNAME = GenPage
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenSec' module build.
|
# GNU/Linux makefile for 'GenSec' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenSec
|
APPNAME = GenSec
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GenVtf' module build.
|
# GNU/Linux makefile for 'GenVtf' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GenVtf
|
APPNAME = GenVtf
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'GnuGenBootSector' module build.
|
# GNU/Linux makefile for 'GnuGenBootSector' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = GnuGenBootSector
|
APPNAME = GnuGenBootSector
|
||||||
|
|||||||
@@ -122,6 +122,34 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GUID_DEFINED
|
||||||
|
#define GUID_DEFINED
|
||||||
|
///
|
||||||
|
/// 128 bit buffer containing a unique identifier value.
|
||||||
|
/// Unless otherwise specified, aligned on a 64 bit boundary.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
UINT32 Data1;
|
||||||
|
UINT16 Data2;
|
||||||
|
UINT16 Data3;
|
||||||
|
UINT8 Data4[8];
|
||||||
|
} GUID;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 4-byte buffer. An IPv4 internet protocol address.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Addr[4];
|
||||||
|
} IPv4_ADDRESS;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 16-byte buffer. An IPv6 internet protocol address.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Addr[16];
|
||||||
|
} IPv6_ADDRESS;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Macro that returns the byte offset of a field in a data structure.
|
// Macro that returns the byte offset of a field in a data structure.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
and DXE phases.
|
and DXE phases.
|
||||||
|
|
||||||
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -153,7 +153,7 @@ typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
|
|||||||
typedef struct _WIN_CERTIFICATE_UEFI_GUID {
|
typedef struct _WIN_CERTIFICATE_UEFI_GUID {
|
||||||
WIN_CERTIFICATE Hdr;
|
WIN_CERTIFICATE Hdr;
|
||||||
EFI_GUID CertType;
|
EFI_GUID CertType;
|
||||||
// UINT8 CertData[ANYSIZE_ARRAY];
|
UINT8 CertData[1];
|
||||||
} WIN_CERTIFICATE_UEFI_GUID;
|
} WIN_CERTIFICATE_UEFI_GUID;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
62
BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
Normal file
62
BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/** @file
|
||||||
|
This file contains the Bluetooth definitions that are consumed by drivers.
|
||||||
|
These definitions are from Bluetooth Core Specification Version 4.0 June, 2010
|
||||||
|
|
||||||
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _BLUETOOTH_H_
|
||||||
|
#define _BLUETOOTH_H_
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BLUETOOTH_ADDRESS
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
///
|
||||||
|
/// 48bit Bluetooth device address.
|
||||||
|
///
|
||||||
|
UINT8 Address[6];
|
||||||
|
} BLUETOOTH_ADDRESS;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BLUETOOTH_CLASS_OF_DEVICE. See Bluetooth specification for detail.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
UINT8 FormatType:2;
|
||||||
|
UINT8 MinorDeviceClass: 6;
|
||||||
|
UINT16 MajorDeviceClass: 5;
|
||||||
|
UINT16 MajorServiceClass:11;
|
||||||
|
} BLUETOOTH_CLASS_OF_DEVICE;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BLUETOOTH_LE_ADDRESS
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
///
|
||||||
|
/// 48-bit Bluetooth device address
|
||||||
|
///
|
||||||
|
UINT8 Address[6];
|
||||||
|
///
|
||||||
|
/// 0x00 - Public Device Address
|
||||||
|
/// 0x01 - Random Device Address
|
||||||
|
///
|
||||||
|
UINT8 Type;
|
||||||
|
} BLUETOOTH_LE_ADDRESS;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
#define BLUETOOTH_HCI_COMMAND_LOCAL_READABLE_NAME_MAX_SIZE 248
|
||||||
|
|
||||||
|
#define BLUETOOTH_HCI_LINK_KEY_SIZE 16
|
||||||
|
|
||||||
|
#endif
|
||||||
1398
BaseTools/Source/C/Include/Protocol/DevicePath.h
Normal file
1398
BaseTools/Source/C/Include/Protocol/DevicePath.h
Normal file
File diff suppressed because it is too large
Load Diff
294
BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h
Normal file
294
BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
/** @file
|
||||||
|
EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.
|
||||||
|
Use to create and manipulate device paths and device nodes.
|
||||||
|
|
||||||
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef __DEVICE_PATH_UTILITIES_H__
|
||||||
|
#define __DEVICE_PATH_UTILITIES_H__
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Device Path Utilities protocol
|
||||||
|
///
|
||||||
|
#define EFI_DEVICE_PATH_UTILITIES_GUID \
|
||||||
|
{ \
|
||||||
|
0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of the device path, in bytes.
|
||||||
|
|
||||||
|
@param DevicePath Points to the start of the EFI device path.
|
||||||
|
|
||||||
|
@return Size Size of the specified device path, in bytes, including the end-of-path tag.
|
||||||
|
@retval 0 DevicePath is NULL
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
UINTN
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a duplicate of the specified path.
|
||||||
|
|
||||||
|
@param DevicePath Points to the source EFI device path.
|
||||||
|
|
||||||
|
@retval Pointer A pointer to the duplicate device path.
|
||||||
|
@retval NULL insufficient memory or DevicePath is NULL
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL*
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a new path by appending the second device path to the first.
|
||||||
|
If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.
|
||||||
|
If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.
|
||||||
|
If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.
|
||||||
|
|
||||||
|
@param Src1 Points to the first device path.
|
||||||
|
@param Src2 Points to the second device path.
|
||||||
|
|
||||||
|
@retval Pointer A pointer to the newly created device path.
|
||||||
|
@retval NULL Memory could not be allocated
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL*
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *Src2
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new path by appending the device node to the device path.
|
||||||
|
If DeviceNode is NULL then a copy of DevicePath is returned.
|
||||||
|
If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.
|
||||||
|
If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.
|
||||||
|
|
||||||
|
@param DevicePath Points to the device path.
|
||||||
|
@param DeviceNode Points to the device node.
|
||||||
|
|
||||||
|
@retval Pointer A pointer to the allocated device node.
|
||||||
|
@retval NULL There was insufficient memory.
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL*
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new path by appending the specified device path instance to the specified device path.
|
||||||
|
|
||||||
|
@param DevicePath Points to the device path. If NULL, then ignored.
|
||||||
|
@param DevicePathInstance Points to the device path instance.
|
||||||
|
|
||||||
|
@retval Pointer A pointer to the newly created device path
|
||||||
|
@retval NULL Memory could not be allocated or DevicePathInstance is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL*
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||||
|
instance.
|
||||||
|
|
||||||
|
@param DevicePathInstance On input, this holds the pointer to the current device path
|
||||||
|
instance. On output, this holds the pointer to the next
|
||||||
|
device path instance or NULL if there are no more device
|
||||||
|
path instances in the device path.
|
||||||
|
@param DevicePathInstanceSize On output, this holds the size of the device path instance,
|
||||||
|
in bytes or zero, if DevicePathInstance is NULL.
|
||||||
|
If NULL, then the instance size is not output.
|
||||||
|
|
||||||
|
@retval Pointer A pointer to the copy of the current device path instance.
|
||||||
|
@retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL*
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
|
||||||
|
UINTN *DevicePathInstanceSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a device node
|
||||||
|
|
||||||
|
@param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for
|
||||||
|
the new device node.
|
||||||
|
@param NodeSubType NodeSubType is the device node sub-type
|
||||||
|
EFI_DEVICE_PATH.SubType) for the new device node.
|
||||||
|
@param NodeLength NodeLength is the length of the device node
|
||||||
|
(EFI_DEVICE_PATH.Length) for the new device node.
|
||||||
|
|
||||||
|
@retval Pointer A pointer to the newly created device node.
|
||||||
|
@retval NULL NodeLength is less than
|
||||||
|
the size of the header or there was insufficient memory.
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL*
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns whether a device path is multi-instance.
|
||||||
|
|
||||||
|
@param DevicePath Points to the device path. If NULL, then ignored.
|
||||||
|
|
||||||
|
@retval TRUE The device path has more than one instance
|
||||||
|
@retval FALSE The device path is empty or contains only a single instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
( *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// This protocol is used to creates and manipulates device paths and device nodes.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
|
||||||
|
EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
|
||||||
|
EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
|
||||||
|
EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
|
||||||
|
EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
|
||||||
|
EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
|
||||||
|
EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
|
||||||
|
EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;
|
||||||
|
} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
|
||||||
|
|
||||||
|
extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetDevicePathEndNode (
|
||||||
|
VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathValid (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
UINTN MaxSize
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT8
|
||||||
|
DevicePathType (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT8
|
||||||
|
DevicePathSubType (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
DevicePathNodeLength (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
NextDevicePathNode (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathEndType (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathEnd (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
BOOLEAN
|
||||||
|
IsDevicePathEndInstance (
|
||||||
|
CONST VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
UINT16
|
||||||
|
SetDevicePathNodeLength (
|
||||||
|
VOID *Node,
|
||||||
|
UINTN Length
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetDevicePathEndNode (
|
||||||
|
VOID *Node
|
||||||
|
);
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
UefiDevicePathLibGetDevicePathSize (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibDuplicateDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePath (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePathNode (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibAppendDevicePathInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibGetNextDevicePathInstance (
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
|
UINTN *Size
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UefiDevicePathLibCreateDeviceNode (
|
||||||
|
UINT8 NodeType,
|
||||||
|
UINT8 NodeSubType,
|
||||||
|
UINT16 NodeLength
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
UefiDevicePathLibIsDevicePathMultiInstance (
|
||||||
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'LzmaCompress' module build.
|
# GNU/Linux makefile for 'LzmaCompress' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = LzmaCompress
|
APPNAME = LzmaCompress
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Windows makefile for C tools build.
|
# Windows makefile for C tools build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -32,7 +32,8 @@ APPLICATIONS = \
|
|||||||
Split \
|
Split \
|
||||||
TianoCompress \
|
TianoCompress \
|
||||||
VolInfo \
|
VolInfo \
|
||||||
VfrCompile
|
VfrCompile \
|
||||||
|
DevicePath
|
||||||
|
|
||||||
all: libs apps install
|
all: libs apps install
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
# HOST_ARCH = ia64 or IA64 for IA64 build
|
# HOST_ARCH = ia64 or IA64 for IA64 build
|
||||||
# HOST_ARCH = Arm or ARM for ARM build
|
# HOST_ARCH = Arm or ARM for ARM build
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -15,7 +15,31 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
HOST_ARCH ?= IA32
|
ifndef HOST_ARCH
|
||||||
|
#
|
||||||
|
# If HOST_ARCH is not defined, then we use 'uname -m' to attempt
|
||||||
|
# try to figure out the appropriate HOST_ARCH.
|
||||||
|
#
|
||||||
|
uname_m = $(shell uname -m)
|
||||||
|
$(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
|
||||||
|
ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
|
||||||
|
HOST_ARCH=X64
|
||||||
|
endif
|
||||||
|
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
|
||||||
|
HOST_ARCH=IA32
|
||||||
|
endif
|
||||||
|
ifneq (,$(findstring aarch64,$(uname_m)))
|
||||||
|
HOST_ARCH=AARCH64
|
||||||
|
endif
|
||||||
|
ifneq (,$(findstring arm,$(uname_m)))
|
||||||
|
HOST_ARCH=ARM
|
||||||
|
endif
|
||||||
|
ifndef HOST_ARCH
|
||||||
|
$(info Could not detected HOST_ARCH from uname results)
|
||||||
|
$(error HOST_ARCH is not defined!)
|
||||||
|
endif
|
||||||
|
$(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
|
||||||
|
endif
|
||||||
|
|
||||||
CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
|
CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
|
||||||
LINUX:=$(findstring Linux, $(shell uname -s))
|
LINUX:=$(findstring Linux, $(shell uname -s))
|
||||||
@@ -29,18 +53,18 @@ BUILD_LD ?= ld
|
|||||||
LINKER ?= $(BUILD_CC)
|
LINKER ?= $(BUILD_CC)
|
||||||
ifeq ($(HOST_ARCH), IA32)
|
ifeq ($(HOST_ARCH), IA32)
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
|
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HOST_ARCH), X64)
|
else ifeq ($(HOST_ARCH), X64)
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
|
ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HOST_ARCH), ARM)
|
else ifeq ($(HOST_ARCH), ARM)
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
|
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HOST_ARCH), AARCH64)
|
else ifeq ($(HOST_ARCH), AARCH64)
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
|
ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
|
||||||
|
|
||||||
|
else
|
||||||
|
$(error Bad HOST_ARCH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
|
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
|
||||||
|
|||||||
@@ -42,14 +42,16 @@ BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
|
|||||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
|
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
|
||||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
|
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
|
||||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
|
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
!IF "$(HOST_ARCH)"=="X64"
|
!ELSEIF "$(HOST_ARCH)"=="X64"
|
||||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
|
ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
|
||||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
|
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
|
||||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
|
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
|
||||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
|
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
|
||||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
|
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
|
||||||
|
|
||||||
|
!ELSE
|
||||||
|
!ERROR "Bad HOST_ARCH"
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
CC = cl.exe
|
CC = cl.exe
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'Split' module build.
|
# GNU/Linux makefile for 'Split' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = Split
|
APPNAME = Split
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'TianoCompress' module build.
|
# GNU/Linux makefile for 'TianoCompress' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = TianoCompress
|
APPNAME = TianoCompress
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'VfrCompile' module build.
|
# GNU/Linux makefile for 'VfrCompile' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = VfrCompile
|
APPNAME = VfrCompile
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ ANTLR_INFO
|
|||||||
#pragma warn -aus /* unused assignment of 'xxx' */
|
#pragma warn -aus /* unused assignment of 'xxx' */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||||
|
|
||||||
#ifdef __USE_PROTOS
|
#ifdef __USE_PROTOS
|
||||||
static void chkToken(char *, char *, char *, int);
|
static void chkToken(char *, char *, char *, int);
|
||||||
@@ -3252,7 +3253,7 @@ enum_def(fname)
|
|||||||
zzMake0;
|
zzMake0;
|
||||||
{
|
{
|
||||||
if ( (LA(1)==ID)&&(isDLGmaxToken(LATEXT(1))) ) {
|
if ( (LA(1)==ID)&&(isDLGmaxToken(LATEXT(1))) ) {
|
||||||
if (!(isDLGmaxToken(LATEXT(1))) ) {zzfailed_pred(" isDLGmaxToken(LATEXT(1))",0 /* report */, { 0; /* no user action */ } );}
|
if (!(isDLGmaxToken(LATEXT(1))) ) {zzfailed_pred(" isDLGmaxToken(LATEXT(1))",0 /* report */, { ; /* no user action */ } );}
|
||||||
zzmatch(ID); zzCONSUME;
|
zzmatch(ID); zzCONSUME;
|
||||||
{
|
{
|
||||||
zzBLOCK(zztasp4);
|
zzBLOCK(zztasp4);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#pragma warn -aus /* unused assignment of 'xxx' */
|
#pragma warn -aus /* unused assignment of 'xxx' */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||||
|
|
||||||
#ifdef __USE_PROTOS
|
#ifdef __USE_PROTOS
|
||||||
static void chkToken(char *, char *, char *, int);
|
static void chkToken(char *, char *, char *, int);
|
||||||
|
|||||||
@@ -1968,7 +1968,7 @@ ActionNode *p;
|
|||||||
(p->pred_fail == NULL ? /* MR23/MR27 */
|
(p->pred_fail == NULL ? /* MR23/MR27 */
|
||||||
"0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
|
"0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
|
||||||
(p->pred_fail == NULL ? /* MR23 */
|
(p->pred_fail == NULL ? /* MR23 */
|
||||||
"0; /* no user action */" : p->pred_fail)); /* MR23 */
|
"; /* no user action */" : p->pred_fail)); /* MR23 */
|
||||||
tabs--;
|
tabs--;
|
||||||
}
|
}
|
||||||
else /* not a predicate */
|
else /* not a predicate */
|
||||||
@@ -2618,7 +2618,7 @@ TokNode *p;
|
|||||||
(a->pred_fail == NULL ? /* MR23/MR27 */
|
(a->pred_fail == NULL ? /* MR23/MR27 */
|
||||||
"0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
|
"0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
|
||||||
(a->pred_fail == NULL ? /* MR23 */
|
(a->pred_fail == NULL ? /* MR23 */
|
||||||
"0; /* no user action */" : a->pred_fail)); /* MR23 */
|
"; /* no user action */" : a->pred_fail)); /* MR23 */
|
||||||
tabs--;
|
tabs--;
|
||||||
/* Disabled in MR30 ************************************************************
|
/* Disabled in MR30 ************************************************************
|
||||||
And moved into genAction
|
And moved into genAction
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ Fix for Borland C++ 4.x & 5.x compiling with ALL warnings enabled
|
|||||||
#pragma warn -aus /* unused assignment of 'xxx' */
|
#pragma warn -aus /* unused assignment of 'xxx' */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||||
|
|
||||||
int action_no = 0; /* keep track of actions outputted */
|
int action_no = 0; /* keep track of actions outputted */
|
||||||
int nfa_allocated = 0; /* keeps track of number of nfa nodes */
|
int nfa_allocated = 0; /* keeps track of number of nfa nodes */
|
||||||
nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
|
nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
|
||||||
|
|||||||
@@ -42,7 +42,9 @@
|
|||||||
#pragma warn -aus /* unused assignment of 'xxx' */
|
#pragma warn -aus /* unused assignment of 'xxx' */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int action_no = 0; /* keep track of actions outputed */
|
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||||
|
|
||||||
|
int action_no = 0; /* keep track of actions outputted */
|
||||||
int nfa_allocated = 0; /* keeps track of number of nfa nodes */
|
int nfa_allocated = 0; /* keeps track of number of nfa nodes */
|
||||||
nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
|
nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
|
||||||
nfa_node nfa_model_node; /* model to initialize new nodes */
|
nfa_node nfa_model_node; /* model to initialize new nodes */
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ CFormPkg::DeclarePendingQuestion (
|
|||||||
// DisableIf
|
// DisableIf
|
||||||
CIfrDisableIf DIObj;
|
CIfrDisableIf DIObj;
|
||||||
DIObj.SetLineNo (LineNo);
|
DIObj.SetLineNo (LineNo);
|
||||||
*InsertOpcodeAddr = DIObj.GetObjBinAddr ();
|
*InsertOpcodeAddr = DIObj.GetObjBinAddr<CHAR8>();
|
||||||
|
|
||||||
//TrueOpcode
|
//TrueOpcode
|
||||||
CIfrTrue TObj (LineNo);
|
CIfrTrue TObj (LineNo);
|
||||||
@@ -1925,7 +1925,7 @@ CIfrRecordInfoDB::IfrCreateDefaultForQuestion (
|
|||||||
Obj = new CIfrObj (pOpHead->OpCode, NULL, pSNode->mBinBufLen, FALSE);
|
Obj = new CIfrObj (pOpHead->OpCode, NULL, pSNode->mBinBufLen, FALSE);
|
||||||
assert (Obj != NULL);
|
assert (Obj != NULL);
|
||||||
Obj->SetLineNo (pSNode->mLineNo);
|
Obj->SetLineNo (pSNode->mLineNo);
|
||||||
ObjBinBuf = Obj->GetObjBinAddr();
|
ObjBinBuf = Obj->GetObjBinAddr<CHAR8>();
|
||||||
memcpy (ObjBinBuf, pSNode->mIfrBinBuf, (UINTN)pSNode->mBinBufLen);
|
memcpy (ObjBinBuf, pSNode->mIfrBinBuf, (UINTN)pSNode->mBinBufLen);
|
||||||
delete Obj;
|
delete Obj;
|
||||||
pSNode = pSNode->mNext;
|
pSNode = pSNode->mNext;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ class CVfrDLGLexer : public VfrLexer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};
|
CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};
|
||||||
INT32 errstd (char *Text)
|
void errstd (const char *Text)
|
||||||
{
|
{
|
||||||
printf ("unrecognized input '%s'\n", Text);
|
printf ("unrecognized input '%s'\n", Text);
|
||||||
}
|
}
|
||||||
@@ -986,7 +986,7 @@ vfrStatementDefaultStore :
|
|||||||
<<
|
<<
|
||||||
if (gCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {
|
if (gCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {
|
||||||
CIfrDefaultStore DSObj;
|
CIfrDefaultStore DSObj;
|
||||||
_PCATCH(gCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText(), S->getLine()), DefaultId)), D->getLine();
|
_PCATCH(gCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr<CHAR8>(), N->getText(), _STOSID(S->getText(), S->getLine()), DefaultId)), D->getLine();
|
||||||
DSObj.SetLineNo(D->getLine());
|
DSObj.SetLineNo(D->getLine());
|
||||||
DSObj.SetDefaultName (_STOSID(S->getText(), S->getLine()));
|
DSObj.SetDefaultName (_STOSID(S->getText(), S->getLine()));
|
||||||
DSObj.SetDefaultId (DefaultId);
|
DSObj.SetDefaultId (DefaultId);
|
||||||
@@ -1770,7 +1770,7 @@ vfrFormDefinition :
|
|||||||
LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
|
LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
|
||||||
}
|
}
|
||||||
|
|
||||||
{CIfrEnd EObj; EObj.SetLineNo (E->getLine()); mLastFormEndAddr = EObj.GetObjBinAddr (); gAdjustOpcodeOffset = EObj.GetObjBinOffset ();}
|
{CIfrEnd EObj; EObj.SetLineNo (E->getLine()); mLastFormEndAddr = EObj.GetObjBinAddr<CHAR8>(); gAdjustOpcodeOffset = EObj.GetObjBinOffset ();}
|
||||||
>>
|
>>
|
||||||
";"
|
";"
|
||||||
;
|
;
|
||||||
@@ -5675,7 +5675,7 @@ EfiVfrParser::_DeclareStandardDefaultStorage (
|
|||||||
//
|
//
|
||||||
CIfrDefaultStore DSObj;
|
CIfrDefaultStore DSObj;
|
||||||
|
|
||||||
gCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), (CHAR8 *) "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
|
gCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr<CHAR8>(), (CHAR8 *) "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||||
DSObj.SetLineNo (LineNo);
|
DSObj.SetLineNo (LineNo);
|
||||||
DSObj.SetDefaultName (EFI_STRING_ID_INVALID);
|
DSObj.SetDefaultName (EFI_STRING_ID_INVALID);
|
||||||
DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD);
|
DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||||
@@ -5685,7 +5685,7 @@ EfiVfrParser::_DeclareStandardDefaultStorage (
|
|||||||
//
|
//
|
||||||
CIfrDefaultStore DSObjMF;
|
CIfrDefaultStore DSObjMF;
|
||||||
|
|
||||||
gCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr(), (CHAR8 *) "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
gCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr<CHAR8>(), (CHAR8 *) "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
||||||
DSObjMF.SetLineNo (LineNo);
|
DSObjMF.SetLineNo (LineNo);
|
||||||
DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID);
|
DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID);
|
||||||
DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for 'VolInfo' module build.
|
# GNU/Linux makefile for 'VolInfo' module build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
HOST_ARCH ?= IA32
|
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = VolInfo
|
APPNAME = VolInfo
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Generate AutoGen.h, AutoGen.c and *.depex files
|
# Generate AutoGen.h, AutoGen.c and *.depex files
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -318,8 +318,8 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
|
|
||||||
EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
|
EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
|
||||||
|
|
||||||
# if Progress:
|
if Progress:
|
||||||
# Progress.Start("\nProcessing meta-data")
|
Progress.Start("\nProcessing meta-data")
|
||||||
|
|
||||||
if self.FdfFile:
|
if self.FdfFile:
|
||||||
#
|
#
|
||||||
@@ -398,89 +398,10 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
for Arch in self.ArchList:
|
for Arch in self.ArchList:
|
||||||
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
|
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
|
||||||
|
|
||||||
DecPcds = {}
|
|
||||||
DecPcdsKey = set()
|
|
||||||
PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
|
|
||||||
if GlobalData.BuildOptionPcd:
|
|
||||||
for i, pcd in enumerate(GlobalData.BuildOptionPcd):
|
|
||||||
if type(pcd) is tuple:
|
|
||||||
continue
|
|
||||||
(pcdname, pcdvalue) = pcd.split('=')
|
|
||||||
if not pcdvalue:
|
|
||||||
EdkLogger.error('build', AUTOGEN_ERROR, "No Value specified for the PCD %s." % (pcdname))
|
|
||||||
if '.' in pcdname:
|
|
||||||
(TokenSpaceGuidCName, TokenCName) = pcdname.split('.')
|
|
||||||
HasTokenSpace = True
|
|
||||||
else:
|
|
||||||
TokenCName = pcdname
|
|
||||||
TokenSpaceGuidCName = ''
|
|
||||||
HasTokenSpace = False
|
|
||||||
TokenSpaceGuidCNameList = []
|
|
||||||
FoundFlag = False
|
|
||||||
PcdDatumType = ''
|
|
||||||
NewValue = ''
|
|
||||||
for package in PGen.PackageList:
|
|
||||||
Guids = package.Guids
|
|
||||||
self._GuidDict.update(Guids)
|
|
||||||
for package in PGen.PackageList:
|
|
||||||
for key in package.Pcds:
|
|
||||||
PcdItem = package.Pcds[key]
|
|
||||||
if HasTokenSpace:
|
|
||||||
if (PcdItem.TokenCName, PcdItem.TokenSpaceGuidCName) == (TokenCName, TokenSpaceGuidCName):
|
|
||||||
PcdDatumType = PcdItem.DatumType
|
|
||||||
if pcdvalue.startswith('H'):
|
|
||||||
try:
|
|
||||||
pcdvalue = ValueExpressionEx(pcdvalue[1:], PcdDatumType, self._GuidDict)(True)
|
|
||||||
except BadExpression, Value:
|
|
||||||
if Value.result > 1:
|
|
||||||
EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %
|
|
||||||
(TokenSpaceGuidCName, TokenCName, pcdvalue, Value))
|
|
||||||
pcdvalue = 'H' + pcdvalue
|
|
||||||
NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
|
||||||
FoundFlag = True
|
|
||||||
else:
|
|
||||||
if PcdItem.TokenCName == TokenCName:
|
|
||||||
if not PcdItem.TokenSpaceGuidCName in TokenSpaceGuidCNameList:
|
|
||||||
if len (TokenSpaceGuidCNameList) < 1:
|
|
||||||
TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName)
|
|
||||||
PcdDatumType = PcdItem.DatumType
|
|
||||||
TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName
|
|
||||||
if pcdvalue.startswith('H'):
|
|
||||||
try:
|
|
||||||
pcdvalue = ValueExpressionEx(pcdvalue[1:], PcdDatumType, self._GuidDict)(True)
|
|
||||||
except BadExpression, Value:
|
|
||||||
EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %
|
|
||||||
(TokenSpaceGuidCName, TokenCName, pcdvalue, Value))
|
|
||||||
pcdvalue = 'H' + pcdvalue
|
|
||||||
NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
|
||||||
FoundFlag = True
|
|
||||||
else:
|
|
||||||
EdkLogger.error(
|
|
||||||
'build',
|
|
||||||
AUTOGEN_ERROR,
|
|
||||||
"The Pcd %s is found under multiple different TokenSpaceGuid: %s and %s." % (TokenCName, PcdItem.TokenSpaceGuidCName, TokenSpaceGuidCNameList[0])
|
|
||||||
)
|
|
||||||
|
|
||||||
GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, NewValue)
|
|
||||||
|
|
||||||
if not FoundFlag:
|
|
||||||
if HasTokenSpace:
|
|
||||||
EdkLogger.error('build', AUTOGEN_ERROR, "The Pcd %s.%s is not found in the DEC file." % (TokenSpaceGuidCName, TokenCName))
|
|
||||||
else:
|
|
||||||
EdkLogger.error('build', AUTOGEN_ERROR, "The Pcd %s is not found in the DEC file." % (TokenCName))
|
|
||||||
|
|
||||||
for BuildData in PGen.BuildDatabase._CACHE_.values():
|
|
||||||
if BuildData.Arch != Arch:
|
|
||||||
continue
|
|
||||||
if BuildData.MetaFile.Ext == '.dec':
|
|
||||||
continue
|
|
||||||
for key in BuildData.Pcds:
|
|
||||||
PcdItem = BuildData.Pcds[key]
|
|
||||||
if (TokenSpaceGuidCName, TokenCName) == (PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName):
|
|
||||||
PcdItem.DefaultValue = NewValue
|
|
||||||
|
|
||||||
if (TokenCName, TokenSpaceGuidCName) in PcdSet:
|
|
||||||
PcdSet[(TokenCName, TokenSpaceGuidCName)] = NewValue
|
|
||||||
|
|
||||||
SourcePcdDict = {'DynamicEx':[], 'PatchableInModule':[],'Dynamic':[],'FixedAtBuild':[]}
|
SourcePcdDict = {'DynamicEx':[], 'PatchableInModule':[],'Dynamic':[],'FixedAtBuild':[]}
|
||||||
BinaryPcdDict = {'DynamicEx':[], 'PatchableInModule':[]}
|
BinaryPcdDict = {'DynamicEx':[], 'PatchableInModule':[]}
|
||||||
@@ -488,6 +409,7 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
BinaryPcdDict_Keys = BinaryPcdDict.keys()
|
BinaryPcdDict_Keys = BinaryPcdDict.keys()
|
||||||
|
|
||||||
# generate the SourcePcdDict and BinaryPcdDict
|
# generate the SourcePcdDict and BinaryPcdDict
|
||||||
|
PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
|
||||||
for BuildData in PGen.BuildDatabase._CACHE_.values():
|
for BuildData in PGen.BuildDatabase._CACHE_.values():
|
||||||
if BuildData.Arch != Arch:
|
if BuildData.Arch != Arch:
|
||||||
continue
|
continue
|
||||||
@@ -630,6 +552,8 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
ModuleData = self.BuildDatabase[ModuleFile, Arch, Target, Toolchain]
|
ModuleData = self.BuildDatabase[ModuleFile, Arch, Target, Toolchain]
|
||||||
PkgSet.update(ModuleData.Packages)
|
PkgSet.update(ModuleData.Packages)
|
||||||
Pkgs = list(PkgSet) + list(PGen.PackageList)
|
Pkgs = list(PkgSet) + list(PGen.PackageList)
|
||||||
|
DecPcds = {}
|
||||||
|
DecPcdsKey = set()
|
||||||
for Pkg in Pkgs:
|
for Pkg in Pkgs:
|
||||||
for Pcd in Pkg.Pcds:
|
for Pcd in Pkg.Pcds:
|
||||||
DecPcds[Pcd[0], Pcd[1]] = Pkg.Pcds[Pcd]
|
DecPcds[Pcd[0], Pcd[1]] = Pkg.Pcds[Pcd]
|
||||||
@@ -1245,6 +1169,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
# get the original module/package/platform objects
|
# get the original module/package/platform objects
|
||||||
self.BuildDatabase = Workspace.BuildDatabase
|
self.BuildDatabase = Workspace.BuildDatabase
|
||||||
self.DscBuildDataObj = Workspace.Platform
|
self.DscBuildDataObj = Workspace.Platform
|
||||||
|
self._GuidDict = Workspace._GuidDict
|
||||||
|
|
||||||
# flag indicating if the makefile/C-code file has been created or not
|
# flag indicating if the makefile/C-code file has been created or not
|
||||||
self.IsMakeFileCreated = False
|
self.IsMakeFileCreated = False
|
||||||
@@ -1405,9 +1330,8 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if len(Sku.VariableName) > 0:
|
if len(Sku.VariableName) > 0:
|
||||||
VariableGuidStructure = Sku.VariableGuidValue
|
VariableGuidStructure = Sku.VariableGuidValue
|
||||||
VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure)
|
VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure)
|
||||||
if Pcd.Phase == "DXE":
|
|
||||||
for StorageName in Sku.DefaultStoreDict:
|
for StorageName in Sku.DefaultStoreDict:
|
||||||
VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableAttribute , Sku.HiiDefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType))
|
VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset, Sku.VariableAttribute , Sku.HiiDefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType))
|
||||||
Index += 1
|
Index += 1
|
||||||
return VariableInfo
|
return VariableInfo
|
||||||
|
|
||||||
@@ -1444,17 +1368,6 @@ class PlatformAutoGen(AutoGen):
|
|||||||
# This interface should be invoked explicitly when platform action is created.
|
# This interface should be invoked explicitly when platform action is created.
|
||||||
#
|
#
|
||||||
def CollectPlatformDynamicPcds(self):
|
def CollectPlatformDynamicPcds(self):
|
||||||
# Override the platform Pcd's value by build option
|
|
||||||
if GlobalData.BuildOptionPcd:
|
|
||||||
for key in self.Platform.Pcds:
|
|
||||||
PlatformPcd = self.Platform.Pcds[key]
|
|
||||||
for PcdItem in GlobalData.BuildOptionPcd:
|
|
||||||
if (PlatformPcd.TokenSpaceGuidCName, PlatformPcd.TokenCName) == (PcdItem[0], PcdItem[1]):
|
|
||||||
PlatformPcd.DefaultValue = PcdItem[2]
|
|
||||||
if PlatformPcd.SkuInfoList:
|
|
||||||
Sku = PlatformPcd.SkuInfoList[PlatformPcd.SkuInfoList.keys()[0]]
|
|
||||||
Sku.DefaultValue = PcdItem[2]
|
|
||||||
break
|
|
||||||
|
|
||||||
for key in self.Platform.Pcds:
|
for key in self.Platform.Pcds:
|
||||||
for SinglePcd in GlobalData.MixedPcd:
|
for SinglePcd in GlobalData.MixedPcd:
|
||||||
@@ -1747,14 +1660,12 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if not FoundFlag :
|
if not FoundFlag :
|
||||||
# just pick the a value to determine whether is unicode string type
|
# just pick the a value to determine whether is unicode string type
|
||||||
SkuValueMap = {}
|
SkuValueMap = {}
|
||||||
|
SkuObjList = DscPcdEntry.SkuInfoList.items()
|
||||||
DefaultSku = DscPcdEntry.SkuInfoList.get('DEFAULT')
|
DefaultSku = DscPcdEntry.SkuInfoList.get('DEFAULT')
|
||||||
if DefaultSku:
|
if DefaultSku:
|
||||||
PcdValue = DefaultSku.DefaultValue
|
defaultindex = SkuObjList.index(('DEFAULT',DefaultSku))
|
||||||
if PcdValue not in SkuValueMap:
|
SkuObjList[0],SkuObjList[defaultindex] = SkuObjList[defaultindex],SkuObjList[0]
|
||||||
SkuValueMap[PcdValue] = []
|
for (SkuName,Sku) in SkuObjList:
|
||||||
VpdFile.Add(DscPcdEntry, 'DEFAULT',Sku.VpdOffset)
|
|
||||||
SkuValueMap[PcdValue].append(Sku)
|
|
||||||
for (SkuName,Sku) in DscPcdEntry.SkuInfoList.items():
|
|
||||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||||
|
|
||||||
# Need to iterate DEC pcd information to get the value & datumtype
|
# Need to iterate DEC pcd information to get the value & datumtype
|
||||||
@@ -1975,6 +1886,13 @@ class PlatformAutoGen(AutoGen):
|
|||||||
NewOption = self.ToolDefinition["MAKE"]["FLAGS"].strip()
|
NewOption = self.ToolDefinition["MAKE"]["FLAGS"].strip()
|
||||||
if NewOption != '':
|
if NewOption != '':
|
||||||
self._BuildCommand += SplitOption(NewOption)
|
self._BuildCommand += SplitOption(NewOption)
|
||||||
|
if "MAKE" in self.EdkIIBuildOption:
|
||||||
|
if "FLAGS" in self.EdkIIBuildOption["MAKE"]:
|
||||||
|
Flags = self.EdkIIBuildOption["MAKE"]["FLAGS"]
|
||||||
|
if Flags.startswith('='):
|
||||||
|
self._BuildCommand = [self._BuildCommand[0]] + [Flags[1:]]
|
||||||
|
else:
|
||||||
|
self._BuildCommand += [Flags]
|
||||||
return self._BuildCommand
|
return self._BuildCommand
|
||||||
|
|
||||||
## Get tool chain definition
|
## Get tool chain definition
|
||||||
@@ -2434,11 +2352,6 @@ class PlatformAutoGen(AutoGen):
|
|||||||
TokenCName = PcdItem[0]
|
TokenCName = PcdItem[0]
|
||||||
break
|
break
|
||||||
if FromPcd != None:
|
if FromPcd != None:
|
||||||
if GlobalData.BuildOptionPcd:
|
|
||||||
for pcd in GlobalData.BuildOptionPcd:
|
|
||||||
if (FromPcd.TokenSpaceGuidCName, FromPcd.TokenCName) == (pcd[0], pcd[1]):
|
|
||||||
FromPcd.DefaultValue = pcd[2]
|
|
||||||
break
|
|
||||||
if ToPcd.Pending and FromPcd.Type not in [None, '']:
|
if ToPcd.Pending and FromPcd.Type not in [None, '']:
|
||||||
ToPcd.Type = FromPcd.Type
|
ToPcd.Type = FromPcd.Type
|
||||||
elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [None, ''])\
|
elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [None, ''])\
|
||||||
@@ -2466,22 +2379,9 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if FromPcd.SkuInfoList not in [None, '', []]:
|
if FromPcd.SkuInfoList not in [None, '', []]:
|
||||||
ToPcd.SkuInfoList = FromPcd.SkuInfoList
|
ToPcd.SkuInfoList = FromPcd.SkuInfoList
|
||||||
# Add Flexible PCD format parse
|
# Add Flexible PCD format parse
|
||||||
PcdValue = ToPcd.DefaultValue
|
|
||||||
if PcdValue:
|
|
||||||
try:
|
|
||||||
ToPcd.DefaultValue = ValueExpression(PcdValue)(True)
|
|
||||||
except WrnExpression, Value:
|
|
||||||
ToPcd.DefaultValue = Value.result
|
|
||||||
except BadExpression, Value:
|
|
||||||
EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName, ToPcd.DefaultValue, Value),
|
|
||||||
File=self.MetaFile)
|
|
||||||
if ToPcd.DefaultValue:
|
if ToPcd.DefaultValue:
|
||||||
_GuidDict = {}
|
|
||||||
for Pkg in self.PackageList:
|
|
||||||
Guids = Pkg.Guids
|
|
||||||
_GuidDict.update(Guids)
|
|
||||||
try:
|
try:
|
||||||
ToPcd.DefaultValue = ValueExpressionEx(ToPcd.DefaultValue, ToPcd.DatumType, _GuidDict)(True)
|
ToPcd.DefaultValue = ValueExpressionEx(ToPcd.DefaultValue, ToPcd.DatumType, self._GuidDict)(True)
|
||||||
except BadExpression, Value:
|
except BadExpression, Value:
|
||||||
EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName, ToPcd.DefaultValue, Value),
|
EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName, ToPcd.DefaultValue, Value),
|
||||||
File=self.MetaFile)
|
File=self.MetaFile)
|
||||||
@@ -2495,7 +2395,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
ToPcd.validlists = FromPcd.validlists
|
ToPcd.validlists = FromPcd.validlists
|
||||||
ToPcd.expressions = FromPcd.expressions
|
ToPcd.expressions = FromPcd.expressions
|
||||||
|
|
||||||
if ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:
|
if FromPcd != None and ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
|
EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
|
||||||
% (ToPcd.TokenSpaceGuidCName, TokenCName))
|
% (ToPcd.TokenSpaceGuidCName, TokenCName))
|
||||||
Value = ToPcd.DefaultValue
|
Value = ToPcd.DefaultValue
|
||||||
@@ -2568,6 +2468,19 @@ class PlatformAutoGen(AutoGen):
|
|||||||
break
|
break
|
||||||
if Flag:
|
if Flag:
|
||||||
self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module)
|
self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module)
|
||||||
|
# use PCD value to calculate the MaxDatumSize when it is not specified
|
||||||
|
for Name, Guid in Pcds:
|
||||||
|
Pcd = Pcds[Name, Guid]
|
||||||
|
if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:
|
||||||
|
Value = Pcd.DefaultValue
|
||||||
|
if Value in [None, '']:
|
||||||
|
Pcd.MaxDatumSize = '1'
|
||||||
|
elif Value[0] == 'L':
|
||||||
|
Pcd.MaxDatumSize = str((len(Value) - 2) * 2)
|
||||||
|
elif Value[0] == '{':
|
||||||
|
Pcd.MaxDatumSize = str(len(Value.split(',')))
|
||||||
|
else:
|
||||||
|
Pcd.MaxDatumSize = str(len(Value) - 1)
|
||||||
return Pcds.values()
|
return Pcds.values()
|
||||||
|
|
||||||
## Resolve library names to library modules
|
## Resolve library names to library modules
|
||||||
@@ -4149,10 +4062,13 @@ class ModuleAutoGen(AutoGen):
|
|||||||
AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']]
|
AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']]
|
||||||
|
|
||||||
OutputDir = self.OutputDir.replace('\\', '/').strip('/')
|
OutputDir = self.OutputDir.replace('\\', '/').strip('/')
|
||||||
|
DebugDir = self.DebugDir.replace('\\', '/').strip('/')
|
||||||
for Item in self.CodaTargetList:
|
for Item in self.CodaTargetList:
|
||||||
File = Item.Target.Path.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')
|
File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')
|
||||||
if File not in self.OutputFile:
|
if File not in self.OutputFile:
|
||||||
self.OutputFile.append(File)
|
self.OutputFile.append(File)
|
||||||
|
if os.path.isabs(File):
|
||||||
|
File = File.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')
|
||||||
if Item.Target.Ext.lower() == '.aml':
|
if Item.Target.Ext.lower() == '.aml':
|
||||||
AsBuiltInfDict['binary_item'] += ['ASL|' + File]
|
AsBuiltInfDict['binary_item'] += ['ASL|' + File]
|
||||||
elif Item.Target.Ext.lower() == '.acpi':
|
elif Item.Target.Ext.lower() == '.acpi':
|
||||||
|
|||||||
@@ -916,11 +916,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||||||
PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
|
PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
|
||||||
FixPcdSizeTokenName = '_PCD_SIZE_' + TokenCName
|
FixPcdSizeTokenName = '_PCD_SIZE_' + TokenCName
|
||||||
|
|
||||||
if GlobalData.BuildOptionPcd:
|
if Pcd.PcdValueFromComm:
|
||||||
for PcdItem in GlobalData.BuildOptionPcd:
|
Pcd.DefaultValue = Pcd.PcdValueFromComm
|
||||||
if (Pcd.TokenSpaceGuidCName, TokenCName) == (PcdItem[0], PcdItem[1]):
|
|
||||||
Pcd.DefaultValue = PcdItem[2]
|
|
||||||
break
|
|
||||||
|
|
||||||
if Pcd.Type in gDynamicExPcd:
|
if Pcd.Type in gDynamicExPcd:
|
||||||
TokenNumber = int(Pcd.TokenValue, 0)
|
TokenNumber = int(Pcd.TokenValue, 0)
|
||||||
@@ -1215,12 +1212,8 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||||||
PatchPcdSizeTokenName = '_PCD_PATCHABLE_' + TokenCName +'_SIZE'
|
PatchPcdSizeTokenName = '_PCD_PATCHABLE_' + TokenCName +'_SIZE'
|
||||||
PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
|
PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
|
||||||
|
|
||||||
if GlobalData.BuildOptionPcd:
|
if Pcd.PcdValueFromComm:
|
||||||
for PcdItem in GlobalData.BuildOptionPcd:
|
Pcd.DefaultValue = Pcd.PcdValueFromComm
|
||||||
if (Pcd.TokenSpaceGuidCName, TokenCName) == (PcdItem[0], PcdItem[1]):
|
|
||||||
Pcd.DefaultValue = PcdItem[2]
|
|
||||||
break
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Write PCDs
|
# Write PCDs
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Create makefile for MS nmake and GNU make
|
# Create makefile for MS nmake and GNU make
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -798,9 +798,13 @@ cleanlib:
|
|||||||
Tool = Flag
|
Tool = Flag
|
||||||
break
|
break
|
||||||
if Tool:
|
if Tool:
|
||||||
|
if 'PATH' not in self._AutoGenObject._BuildOption[Tool]:
|
||||||
|
EdkLogger.error("build", AUTOGEN_ERROR, "%s_PATH doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
|
||||||
SingleCommandLength += len(self._AutoGenObject._BuildOption[Tool]['PATH'])
|
SingleCommandLength += len(self._AutoGenObject._BuildOption[Tool]['PATH'])
|
||||||
for item in SingleCommandList[1:]:
|
for item in SingleCommandList[1:]:
|
||||||
if FlagDict[Tool]['Macro'] in item:
|
if FlagDict[Tool]['Macro'] in item:
|
||||||
|
if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:
|
||||||
|
EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
|
||||||
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
|
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
|
||||||
for Option in self._AutoGenObject.BuildOption.keys():
|
for Option in self._AutoGenObject.BuildOption.keys():
|
||||||
for Attr in self._AutoGenObject.BuildOption[Option]:
|
for Attr in self._AutoGenObject.BuildOption[Option]:
|
||||||
@@ -1547,18 +1551,15 @@ class TopLevelMakefile(BuildFile):
|
|||||||
if GlobalData.gIgnoreSource:
|
if GlobalData.gIgnoreSource:
|
||||||
ExtraOption += " --ignore-sources"
|
ExtraOption += " --ignore-sources"
|
||||||
|
|
||||||
if GlobalData.BuildOptionPcd:
|
for pcd in GlobalData.BuildOptionPcd:
|
||||||
for index, option in enumerate(GlobalData.gCommand):
|
if pcd[2]:
|
||||||
if "--pcd" == option and GlobalData.gCommand[index+1]:
|
pcdname = '.'.join(pcd[0:3])
|
||||||
pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')
|
|
||||||
if pcdValue.startswith('H'):
|
|
||||||
pcdValue = 'H' + '"' + pcdValue[1:] + '"'
|
|
||||||
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
|
|
||||||
elif pcdValue.startswith('L'):
|
|
||||||
pcdValue = 'L' + '"' + pcdValue[1:] + '"'
|
|
||||||
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
|
|
||||||
else:
|
else:
|
||||||
ExtraOption += " --pcd " + GlobalData.gCommand[index+1]
|
pcdname = '.'.join(pcd[0:2])
|
||||||
|
if pcd[3].startswith('{'):
|
||||||
|
ExtraOption += " --pcd " + pcdname + '=' + 'H' + '"' + pcd[3] + '"'
|
||||||
|
else:
|
||||||
|
ExtraOption += " --pcd " + pcdname + '=' + pcd[3]
|
||||||
|
|
||||||
MakefileName = self._FILE_NAME_[self._FileType]
|
MakefileName = self._FILE_NAME_[self._FileType]
|
||||||
SubBuildCommandList = []
|
SubBuildCommandList = []
|
||||||
|
|||||||
@@ -980,8 +980,6 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
|
|||||||
def CreatePcdDataBase(PcdDBData):
|
def CreatePcdDataBase(PcdDBData):
|
||||||
delta = {}
|
delta = {}
|
||||||
basedata = {}
|
basedata = {}
|
||||||
if not PcdDBData:
|
|
||||||
return ""
|
|
||||||
for skuname,skuid in PcdDBData:
|
for skuname,skuid in PcdDBData:
|
||||||
if len(PcdDBData[(skuname,skuid)][1]) != len(PcdDBData[("DEFAULT","0")][1]):
|
if len(PcdDBData[(skuname,skuid)][1]) != len(PcdDBData[("DEFAULT","0")][1]):
|
||||||
EdkLogger.ERROR("The size of each sku in one pcd are not same")
|
EdkLogger.ERROR("The size of each sku in one pcd are not same")
|
||||||
@@ -1024,6 +1022,19 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
|
|||||||
def prune_sku(pcd,skuname):
|
def prune_sku(pcd,skuname):
|
||||||
new_pcd = copy.deepcopy(pcd)
|
new_pcd = copy.deepcopy(pcd)
|
||||||
new_pcd.SkuInfoList = {skuname:pcd.SkuInfoList[skuname]}
|
new_pcd.SkuInfoList = {skuname:pcd.SkuInfoList[skuname]}
|
||||||
|
new_pcd.isinit = 'INIT'
|
||||||
|
if new_pcd.DatumType in ['UINT8','UINT16','UINT32','UINT64']:
|
||||||
|
for skuobj in pcd.SkuInfoList.values():
|
||||||
|
if skuobj.DefaultValue:
|
||||||
|
defaultvalue = int(skuobj.DefaultValue,16) if skuobj.DefaultValue.upper().startswith("0X") else int(skuobj.DefaultValue,10)
|
||||||
|
if defaultvalue != 0:
|
||||||
|
new_pcd.isinit = "INIT"
|
||||||
|
break
|
||||||
|
elif skuobj.VariableName:
|
||||||
|
new_pcd.isinit = "INIT"
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
new_pcd.isinit = "UNINIT"
|
||||||
return new_pcd
|
return new_pcd
|
||||||
DynamicPcds = Platform.DynamicPcdList
|
DynamicPcds = Platform.DynamicPcdList
|
||||||
DynamicPcdSet_Sku = {(SkuName,skuobj.SkuId):[] for pcd in DynamicPcds for (SkuName,skuobj) in pcd.SkuInfoList.items() }
|
DynamicPcdSet_Sku = {(SkuName,skuobj.SkuId):[] for pcd in DynamicPcds for (SkuName,skuobj) in pcd.SkuInfoList.items() }
|
||||||
@@ -1048,9 +1059,12 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
|
|||||||
AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData)
|
AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData)
|
||||||
else:
|
else:
|
||||||
AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer,VarCheckTab = CreatePcdDatabasePhaseSpecificAutoGen (Platform,{}, Phase)
|
AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer,VarCheckTab = CreatePcdDatabasePhaseSpecificAutoGen (Platform,{}, Phase)
|
||||||
|
final_data = ()
|
||||||
|
for item in PcdDbBuffer:
|
||||||
|
final_data += unpack("B",item)
|
||||||
|
PcdDBData[("DEFAULT","0")] = (PcdDbBuffer, final_data)
|
||||||
|
|
||||||
PcdDbBuffer = CreatePcdDataBase(PcdDBData)
|
return AdditionalAutoGenH, AdditionalAutoGenC, CreatePcdDataBase(PcdDBData)
|
||||||
return AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer
|
|
||||||
## Create PCD database in DXE or PEI phase
|
## Create PCD database in DXE or PEI phase
|
||||||
#
|
#
|
||||||
# @param Platform The platform object
|
# @param Platform The platform object
|
||||||
@@ -1171,12 +1185,6 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
|
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
|
||||||
CName = PcdItem[0]
|
CName = PcdItem[0]
|
||||||
|
|
||||||
if GlobalData.BuildOptionPcd:
|
|
||||||
for PcdItem in GlobalData.BuildOptionPcd:
|
|
||||||
if (Pcd.TokenSpaceGuidCName, CName) == (PcdItem[0], PcdItem[1]):
|
|
||||||
Pcd.DefaultValue = PcdItem[2]
|
|
||||||
break
|
|
||||||
|
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_3, "PCD: %s %s (%s : %s)" % (CName, TokenSpaceGuidCName, Pcd.Phase, Phase))
|
EdkLogger.debug(EdkLogger.DEBUG_3, "PCD: %s %s (%s : %s)" % (CName, TokenSpaceGuidCName, Pcd.Phase, Phase))
|
||||||
|
|
||||||
if Pcd.Phase == 'PEI':
|
if Pcd.Phase == 'PEI':
|
||||||
@@ -1401,8 +1409,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||||||
if Sku.DefaultValue == 'TRUE':
|
if Sku.DefaultValue == 'TRUE':
|
||||||
Pcd.InitString = 'INIT'
|
Pcd.InitString = 'INIT'
|
||||||
else:
|
else:
|
||||||
if int(Sku.DefaultValue, 0) != 0:
|
Pcd.InitString = Pcd.isinit
|
||||||
Pcd.InitString = 'INIT'
|
|
||||||
#
|
#
|
||||||
# For UNIT64 type PCD's value, ULL should be append to avoid
|
# For UNIT64 type PCD's value, ULL should be append to avoid
|
||||||
# warning under linux building environment.
|
# warning under linux building environment.
|
||||||
@@ -1493,12 +1500,6 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
|
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
|
||||||
CName = PcdItem[0]
|
CName = PcdItem[0]
|
||||||
|
|
||||||
if GlobalData.BuildOptionPcd:
|
|
||||||
for PcdItem in GlobalData.BuildOptionPcd:
|
|
||||||
if (Pcd.TokenSpaceGuidCName, CName) == (PcdItem[0], PcdItem[1]):
|
|
||||||
Pcd.DefaultValue = PcdItem[2]
|
|
||||||
break
|
|
||||||
|
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_1, "PCD = %s.%s" % (CName, TokenSpaceGuidCName))
|
EdkLogger.debug(EdkLogger.DEBUG_1, "PCD = %s.%s" % (CName, TokenSpaceGuidCName))
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_1, "phase = %s" % Phase)
|
EdkLogger.debug(EdkLogger.DEBUG_1, "phase = %s" % Phase)
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_1, "GeneratedTokenNumber = %s" % str(GeneratedTokenNumber))
|
EdkLogger.debug(EdkLogger.DEBUG_1, "GeneratedTokenNumber = %s" % str(GeneratedTokenNumber))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from Common.VariableAttributes import VariableAttributes
|
|||||||
from Common.Misc import *
|
from Common.Misc import *
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_attribute,pcd_default_value, default_value, data_type")
|
var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type")
|
||||||
NvStorageHeaderSize = 28
|
NvStorageHeaderSize = 28
|
||||||
VariableHeaderSize = 32
|
VariableHeaderSize = 32
|
||||||
|
|
||||||
@@ -76,7 +76,55 @@ class VariableMgr(object):
|
|||||||
value_str += ",".join(default_var_bin_strip)
|
value_str += ",".join(default_var_bin_strip)
|
||||||
value_str += "}"
|
value_str += "}"
|
||||||
return value_str
|
return value_str
|
||||||
|
def combine_variable(self):
|
||||||
|
indexedvarinfo = collections.OrderedDict()
|
||||||
|
for item in self.VarInfo:
|
||||||
|
if (item.skuname,item.defaultstoragename, item.var_name,item.var_guid) not in indexedvarinfo:
|
||||||
|
indexedvarinfo[(item.skuname,item.defaultstoragename, item.var_name,item.var_guid) ] = []
|
||||||
|
indexedvarinfo[(item.skuname,item.defaultstoragename, item.var_name,item.var_guid)].append(item)
|
||||||
|
for key in indexedvarinfo:
|
||||||
|
sku_var_info_offset_list = indexedvarinfo[key]
|
||||||
|
if len(sku_var_info_offset_list) == 1:
|
||||||
|
continue
|
||||||
|
newvalue = {}
|
||||||
|
for item in sku_var_info_offset_list:
|
||||||
|
data_type = item.data_type
|
||||||
|
value_list = item.default_value.strip("{").strip("}").split(",")
|
||||||
|
if data_type in ["BOOLEAN","UINT8","UINT16","UINT32","UINT64"]:
|
||||||
|
if data_type == ["BOOLEAN","UINT8"]:
|
||||||
|
data_flag = "=B"
|
||||||
|
elif data_type == "UINT16":
|
||||||
|
data_flag = "=H"
|
||||||
|
elif data_type == "UINT32":
|
||||||
|
data_flag = "=L"
|
||||||
|
elif data_type == "UINT64":
|
||||||
|
data_flag = "=Q"
|
||||||
|
data = value_list[0]
|
||||||
|
value_list = []
|
||||||
|
for data_byte in pack(data_flag,int(data,16) if data.upper().startswith('0X') else int(data)):
|
||||||
|
value_list += [hex(unpack("B",data_byte)[0])]
|
||||||
|
newvalue[int(item.var_offset,16) if item.var_offset.upper().startswith("0X") else int(item.var_offset)] = value_list
|
||||||
|
try:
|
||||||
|
newvaluestr = "{" + ",".join(self.assemble_variable(newvalue)) +"}"
|
||||||
|
except:
|
||||||
|
EdkLogger.error("build", AUTOGEN_ERROR, "Variable offset conflict in PCDs: %s \n" % (" and ".join([item.pcdname for item in sku_var_info_offset_list])))
|
||||||
|
n = sku_var_info_offset_list[0]
|
||||||
|
indexedvarinfo[key] = [var_info(n.pcdindex,n.pcdname,n.defaultstoragename,n.skuname,n.var_name, n.var_guid, "0x00",n.var_attribute,newvaluestr , newvaluestr , "VOID*")]
|
||||||
|
self.VarInfo = [item[0] for item in indexedvarinfo.values()]
|
||||||
|
|
||||||
|
def assemble_variable(self, valuelist):
|
||||||
|
ordered_value = [valuelist[k] for k in sorted(valuelist.keys())]
|
||||||
|
ordered_offset = sorted(valuelist.keys())
|
||||||
|
var_value = []
|
||||||
|
num = 0
|
||||||
|
for offset in ordered_offset:
|
||||||
|
if offset < len(var_value):
|
||||||
|
raise
|
||||||
|
for _ in xrange(offset - len(var_value)):
|
||||||
|
var_value.append('0x00')
|
||||||
|
var_value += ordered_value[num]
|
||||||
|
num +=1
|
||||||
|
return var_value
|
||||||
def process_variable_data(self):
|
def process_variable_data(self):
|
||||||
|
|
||||||
var_data = dict()
|
var_data = dict()
|
||||||
@@ -134,6 +182,7 @@ class VariableMgr(object):
|
|||||||
return var_data
|
return var_data
|
||||||
|
|
||||||
def new_process_varinfo(self):
|
def new_process_varinfo(self):
|
||||||
|
self.combine_variable()
|
||||||
|
|
||||||
var_data = self.process_variable_data()
|
var_data = self.process_variable_data()
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe
|
# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe
|
||||||
# and process each entry of vpd type PCD.
|
# and process each entry of vpd type PCD.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -35,7 +35,7 @@ _FORMAT_CHAR = {1: 'B',
|
|||||||
#
|
#
|
||||||
class PcdEntry:
|
class PcdEntry:
|
||||||
def __init__(self, PcdCName, SkuId,PcdOffset, PcdSize, PcdValue, Lineno=None, FileName=None, PcdUnpackValue=None,
|
def __init__(self, PcdCName, SkuId,PcdOffset, PcdSize, PcdValue, Lineno=None, FileName=None, PcdUnpackValue=None,
|
||||||
PcdBinOffset=None, PcdBinSize=None):
|
PcdBinOffset=None, PcdBinSize=None, Alignment=None):
|
||||||
self.PcdCName = PcdCName.strip()
|
self.PcdCName = PcdCName.strip()
|
||||||
self.SkuId = SkuId.strip()
|
self.SkuId = SkuId.strip()
|
||||||
self.PcdOffset = PcdOffset.strip()
|
self.PcdOffset = PcdOffset.strip()
|
||||||
@@ -46,6 +46,7 @@ class PcdEntry:
|
|||||||
self.PcdUnpackValue = PcdUnpackValue
|
self.PcdUnpackValue = PcdUnpackValue
|
||||||
self.PcdBinOffset = PcdBinOffset
|
self.PcdBinOffset = PcdBinOffset
|
||||||
self.PcdBinSize = PcdBinSize
|
self.PcdBinSize = PcdBinSize
|
||||||
|
self.Alignment = Alignment
|
||||||
|
|
||||||
if self.PcdValue == '' :
|
if self.PcdValue == '' :
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
|
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
|
||||||
@@ -61,7 +62,7 @@ class PcdEntry:
|
|||||||
|
|
||||||
self._GenOffsetValue ()
|
self._GenOffsetValue ()
|
||||||
|
|
||||||
## Analyze the string value to judge the PCD's datum type euqal to Boolean or not.
|
## Analyze the string value to judge the PCD's datum type equal to Boolean or not.
|
||||||
#
|
#
|
||||||
# @param ValueString PCD's value
|
# @param ValueString PCD's value
|
||||||
# @param Size PCD's size
|
# @param Size PCD's size
|
||||||
@@ -164,18 +165,18 @@ class PcdEntry:
|
|||||||
## Pack VOID* type VPD PCD's value form string to binary type.
|
## Pack VOID* type VPD PCD's value form string to binary type.
|
||||||
#
|
#
|
||||||
# The VOID* type of string divided into 3 sub-type:
|
# The VOID* type of string divided into 3 sub-type:
|
||||||
# 1: L"String", Unicode type string.
|
# 1: L"String"/L'String', Unicode type string.
|
||||||
# 2: "String", Ascii type string.
|
# 2: "String"/'String', Ascii type string.
|
||||||
# 3: {bytearray}, only support byte-array.
|
# 3: {bytearray}, only support byte-array.
|
||||||
#
|
#
|
||||||
# @param ValueString The Integer type string for pack.
|
# @param ValueString The Integer type string for pack.
|
||||||
#
|
#
|
||||||
def _PackPtrValue(self, ValueString, Size):
|
def _PackPtrValue(self, ValueString, Size):
|
||||||
if ValueString.startswith('L"'):
|
if ValueString.startswith('L"') or ValueString.startswith("L'"):
|
||||||
self._PackUnicode(ValueString, Size)
|
self._PackUnicode(ValueString, Size)
|
||||||
elif ValueString.startswith('{') and ValueString.endswith('}'):
|
elif ValueString.startswith('{') and ValueString.endswith('}'):
|
||||||
self._PackByteArray(ValueString, Size)
|
self._PackByteArray(ValueString, Size)
|
||||||
elif ValueString.startswith('"') and ValueString.endswith('"'):
|
elif (ValueString.startswith('"') and ValueString.endswith('"')) or (ValueString.startswith("'") and ValueString.endswith("'")):
|
||||||
self._PackString(ValueString, Size)
|
self._PackString(ValueString, Size)
|
||||||
else:
|
else:
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
|
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
|
||||||
@@ -183,7 +184,7 @@ class PcdEntry:
|
|||||||
|
|
||||||
## Pack an Ascii PCD value.
|
## Pack an Ascii PCD value.
|
||||||
#
|
#
|
||||||
# An Ascii string for a PCD should be in format as "".
|
# An Ascii string for a PCD should be in format as ""/''.
|
||||||
#
|
#
|
||||||
def _PackString(self, ValueString, Size):
|
def _PackString(self, ValueString, Size):
|
||||||
if (Size < 0):
|
if (Size < 0):
|
||||||
@@ -191,11 +192,14 @@ class PcdEntry:
|
|||||||
"Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % (self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
|
"Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % (self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
|
||||||
if (ValueString == ""):
|
if (ValueString == ""):
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter ValueString %s of PCD %s!(File: %s Line: %s)" % (self.PcdUnpackValue, self.PcdCName, self.FileName, self.Lineno))
|
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter ValueString %s of PCD %s!(File: %s Line: %s)" % (self.PcdUnpackValue, self.PcdCName, self.FileName, self.Lineno))
|
||||||
if (len(ValueString) < 2):
|
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "For PCD: %s ,ASCII string %s at least contains two!(File: %s Line: %s)" % (self.PcdCName, self.PcdUnpackValue, self.FileName, self.Lineno))
|
QuotedFlag = True
|
||||||
|
if ValueString.startswith("'"):
|
||||||
|
QuotedFlag = False
|
||||||
|
|
||||||
ValueString = ValueString[1:-1]
|
ValueString = ValueString[1:-1]
|
||||||
if len(ValueString) + 1 > Size:
|
# No null-terminator in 'string'
|
||||||
|
if (QuotedFlag and len(ValueString) + 1 > Size) or (not QuotedFlag and len(ValueString) > Size):
|
||||||
EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
|
EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
|
||||||
"PCD value string %s is exceed to size %d(File: %s Line: %s)" % (ValueString, Size, self.FileName, self.Lineno))
|
"PCD value string %s is exceed to size %d(File: %s Line: %s)" % (ValueString, Size, self.FileName, self.Lineno))
|
||||||
try:
|
try:
|
||||||
@@ -258,19 +262,20 @@ class PcdEntry:
|
|||||||
|
|
||||||
## Pack a unicode PCD value into byte array.
|
## Pack a unicode PCD value into byte array.
|
||||||
#
|
#
|
||||||
# A unicode string for a PCD should be in format as L"".
|
# A unicode string for a PCD should be in format as L""/L''.
|
||||||
#
|
#
|
||||||
def _PackUnicode(self, UnicodeString, Size):
|
def _PackUnicode(self, UnicodeString, Size):
|
||||||
if (Size < 0):
|
if (Size < 0):
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % \
|
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % \
|
||||||
(self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
|
(self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
|
||||||
if (len(UnicodeString) < 3):
|
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "For PCD: %s ,ASCII string %s at least contains two!(File: %s Line: %s)" % \
|
|
||||||
(self.PcdCName, self.PcdUnpackValue, self.FileName, self.Lineno))
|
|
||||||
|
|
||||||
|
QuotedFlag = True
|
||||||
|
if UnicodeString.startswith("L'"):
|
||||||
|
QuotedFlag = False
|
||||||
UnicodeString = UnicodeString[2:-1]
|
UnicodeString = UnicodeString[2:-1]
|
||||||
|
|
||||||
if (len(UnicodeString) + 1) * 2 > Size:
|
# No null-terminator in L'string'
|
||||||
|
if (QuotedFlag and (len(UnicodeString) + 1) * 2 > Size) or (not QuotedFlag and len(UnicodeString) * 2 > Size):
|
||||||
EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
|
EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
|
||||||
"The size of unicode string %s is too larger for size %s(File: %s Line: %s)" % \
|
"The size of unicode string %s is too larger for size %s(File: %s Line: %s)" % \
|
||||||
(UnicodeString, Size, self.FileName, self.Lineno))
|
(UnicodeString, Size, self.FileName, self.Lineno))
|
||||||
@@ -434,6 +439,7 @@ class GenVPD :
|
|||||||
else:
|
else:
|
||||||
Alignment = 1
|
Alignment = 1
|
||||||
|
|
||||||
|
PCD.Alignment = Alignment
|
||||||
if PCD.PcdOffset != '*':
|
if PCD.PcdOffset != '*':
|
||||||
if PCD.PcdOccupySize % Alignment != 0:
|
if PCD.PcdOccupySize % Alignment != 0:
|
||||||
if PCD.PcdUnpackValue.startswith("{"):
|
if PCD.PcdUnpackValue.startswith("{"):
|
||||||
@@ -444,6 +450,7 @@ class GenVPD :
|
|||||||
if PCD.PcdOccupySize % Alignment != 0:
|
if PCD.PcdOccupySize % Alignment != 0:
|
||||||
PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment
|
PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment
|
||||||
|
|
||||||
|
PackSize = PCD.PcdOccupySize
|
||||||
if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):
|
if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):
|
||||||
PCD._PackBooleanValue(PCD.PcdValue)
|
PCD._PackBooleanValue(PCD.PcdValue)
|
||||||
self.FileLinesList[count] = PCD
|
self.FileLinesList[count] = PCD
|
||||||
@@ -518,6 +525,8 @@ class GenVPD :
|
|||||||
# The offset start from 0
|
# The offset start from 0
|
||||||
NowOffset = 0
|
NowOffset = 0
|
||||||
for Pcd in self.PcdUnknownOffsetList :
|
for Pcd in self.PcdUnknownOffsetList :
|
||||||
|
if NowOffset % Pcd.Alignment != 0:
|
||||||
|
NowOffset = (NowOffset/ Pcd.Alignment + 1) * Pcd.Alignment
|
||||||
Pcd.PcdBinOffset = NowOffset
|
Pcd.PcdBinOffset = NowOffset
|
||||||
Pcd.PcdOffset = str(hex(Pcd.PcdBinOffset))
|
Pcd.PcdOffset = str(hex(Pcd.PcdBinOffset))
|
||||||
NowOffset += Pcd.PcdOccupySize
|
NowOffset += Pcd.PcdOccupySize
|
||||||
@@ -580,6 +589,8 @@ class GenVPD :
|
|||||||
needFixPcdSize = eachUnfixedPcd.PcdOccupySize
|
needFixPcdSize = eachUnfixedPcd.PcdOccupySize
|
||||||
# Not been fixed
|
# Not been fixed
|
||||||
if eachUnfixedPcd.PcdOffset == '*' :
|
if eachUnfixedPcd.PcdOffset == '*' :
|
||||||
|
if LastOffset % eachUnfixedPcd.Alignment != 0:
|
||||||
|
LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
|
||||||
# The offset un-fixed pcd can write into this free space
|
# The offset un-fixed pcd can write into this free space
|
||||||
if needFixPcdSize <= (NowOffset - LastOffset) :
|
if needFixPcdSize <= (NowOffset - LastOffset) :
|
||||||
# Change the offset value of un-fixed pcd
|
# Change the offset value of un-fixed pcd
|
||||||
@@ -632,6 +643,9 @@ class GenVPD :
|
|||||||
NeedFixPcd = self.PcdUnknownOffsetList[0]
|
NeedFixPcd = self.PcdUnknownOffsetList[0]
|
||||||
|
|
||||||
NeedFixPcd.PcdBinOffset = LastPcd.PcdBinOffset + LastPcd.PcdOccupySize
|
NeedFixPcd.PcdBinOffset = LastPcd.PcdBinOffset + LastPcd.PcdOccupySize
|
||||||
|
if NeedFixPcd.PcdBinOffset % NeedFixPcd.Alignment != 0:
|
||||||
|
NeedFixPcd.PcdBinOffset = (NeedFixPcd.PcdBinOffset / NeedFixPcd.Alignment + 1) * NeedFixPcd.Alignment
|
||||||
|
|
||||||
NeedFixPcd.PcdOffset = str(hex(NeedFixPcd.PcdBinOffset))
|
NeedFixPcd.PcdOffset = str(hex(NeedFixPcd.PcdBinOffset))
|
||||||
|
|
||||||
# Insert this pcd into fixed offset pcd list's tail.
|
# Insert this pcd into fixed offset pcd list's tail.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file is used to parse and evaluate expression in directive or PCD value.
|
# This file is used to parse and evaluate expression in directive or PCD value.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
from Common.GlobalData import *
|
from Common.GlobalData import *
|
||||||
from CommonDataClass.Exceptions import BadExpression
|
from CommonDataClass.Exceptions import BadExpression
|
||||||
from CommonDataClass.Exceptions import WrnExpression
|
from CommonDataClass.Exceptions import WrnExpression
|
||||||
from Misc import GuidStringToGuidStructureString, ParseFieldValue
|
from Misc import GuidStringToGuidStructureString, ParseFieldValue, IsFieldValueAnArray
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
@@ -45,15 +45,28 @@ ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARC
|
|||||||
# For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn']
|
# For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn']
|
||||||
#
|
#
|
||||||
def SplitString(String):
|
def SplitString(String):
|
||||||
# There might be escaped quote: "abc\"def\\\"ghi"
|
# There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi'
|
||||||
Str = String.replace('\\\\', '//').replace('\\\"', '\\\'')
|
Str = String
|
||||||
RetList = []
|
RetList = []
|
||||||
InQuote = False
|
InSingleQuote = False
|
||||||
|
InDoubleQuote = False
|
||||||
Item = ''
|
Item = ''
|
||||||
for i, ch in enumerate(Str):
|
for i, ch in enumerate(Str):
|
||||||
if ch == '"':
|
if ch == '"' and not InSingleQuote:
|
||||||
InQuote = not InQuote
|
if Str[i - 1] != '\\':
|
||||||
if not InQuote:
|
InDoubleQuote = not InDoubleQuote
|
||||||
|
if not InDoubleQuote:
|
||||||
|
Item += String[i]
|
||||||
|
RetList.append(Item)
|
||||||
|
Item = ''
|
||||||
|
continue
|
||||||
|
if Item:
|
||||||
|
RetList.append(Item)
|
||||||
|
Item = ''
|
||||||
|
elif ch == "'" and not InDoubleQuote:
|
||||||
|
if Str[i - 1] != '\\':
|
||||||
|
InSingleQuote = not InSingleQuote
|
||||||
|
if not InSingleQuote:
|
||||||
Item += String[i]
|
Item += String[i]
|
||||||
RetList.append(Item)
|
RetList.append(Item)
|
||||||
Item = ''
|
Item = ''
|
||||||
@@ -62,12 +75,75 @@ def SplitString(String):
|
|||||||
RetList.append(Item)
|
RetList.append(Item)
|
||||||
Item = ''
|
Item = ''
|
||||||
Item += String[i]
|
Item += String[i]
|
||||||
if InQuote:
|
if InSingleQuote or InDoubleQuote:
|
||||||
raise BadExpression(ERR_STRING_TOKEN % Item)
|
raise BadExpression(ERR_STRING_TOKEN % Item)
|
||||||
if Item:
|
if Item:
|
||||||
RetList.append(Item)
|
RetList.append(Item)
|
||||||
return RetList
|
return RetList
|
||||||
|
|
||||||
|
def SplitPcdValueString(String):
|
||||||
|
# There might be escaped comma in GUID() or DEVICE_PATH() or " "
|
||||||
|
# or ' ' or L' ' or L" "
|
||||||
|
Str = String
|
||||||
|
RetList = []
|
||||||
|
InParenthesis = 0
|
||||||
|
InSingleQuote = False
|
||||||
|
InDoubleQuote = False
|
||||||
|
Item = ''
|
||||||
|
for i, ch in enumerate(Str):
|
||||||
|
if ch == '(':
|
||||||
|
InParenthesis += 1
|
||||||
|
if ch == ')':
|
||||||
|
if InParenthesis:
|
||||||
|
InParenthesis -= 1
|
||||||
|
else:
|
||||||
|
raise BadExpression(ERR_STRING_TOKEN % Item)
|
||||||
|
if ch == '"' and not InSingleQuote:
|
||||||
|
if String[i-1] != '\\':
|
||||||
|
InDoubleQuote = not InDoubleQuote
|
||||||
|
if ch == "'" and not InDoubleQuote:
|
||||||
|
if String[i-1] != '\\':
|
||||||
|
InSingleQuote = not InSingleQuote
|
||||||
|
if ch == ',':
|
||||||
|
if InParenthesis or InSingleQuote or InDoubleQuote:
|
||||||
|
Item += String[i]
|
||||||
|
continue
|
||||||
|
elif Item:
|
||||||
|
RetList.append(Item)
|
||||||
|
Item = ''
|
||||||
|
continue
|
||||||
|
Item += String[i]
|
||||||
|
if InSingleQuote or InDoubleQuote or InParenthesis:
|
||||||
|
raise BadExpression(ERR_STRING_TOKEN % Item)
|
||||||
|
if Item:
|
||||||
|
RetList.append(Item)
|
||||||
|
return RetList
|
||||||
|
|
||||||
|
def IsValidCString(Str):
|
||||||
|
ValidString = re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$')
|
||||||
|
if not ValidString.match(Str):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def BuildOptionValue(PcdValue, GuidDict):
|
||||||
|
IsArray = False
|
||||||
|
if PcdValue.startswith('H'):
|
||||||
|
InputValue = PcdValue[1:]
|
||||||
|
elif PcdValue.startswith("L'") or PcdValue.startswith("'"):
|
||||||
|
InputValue = PcdValue
|
||||||
|
elif PcdValue.startswith('L'):
|
||||||
|
InputValue = 'L"' + PcdValue[1:] + '"'
|
||||||
|
else:
|
||||||
|
InputValue = PcdValue
|
||||||
|
if IsFieldValueAnArray(InputValue):
|
||||||
|
IsArray = True
|
||||||
|
if IsArray:
|
||||||
|
try:
|
||||||
|
PcdValue = ValueExpressionEx(InputValue, 'VOID*', GuidDict)(True)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return PcdValue
|
||||||
|
|
||||||
## ReplaceExprMacro
|
## ReplaceExprMacro
|
||||||
#
|
#
|
||||||
def ReplaceExprMacro(String, Macros, ExceptionList = None):
|
def ReplaceExprMacro(String, Macros, ExceptionList = None):
|
||||||
@@ -157,18 +233,8 @@ class ValueExpression(object):
|
|||||||
def Eval(Operator, Oprand1, Oprand2 = None):
|
def Eval(Operator, Oprand1, Oprand2 = None):
|
||||||
WrnExp = None
|
WrnExp = None
|
||||||
|
|
||||||
if Operator not in ["in", "not in"] and (type(Oprand1) == type('') or type(Oprand2) == type('')):
|
if Operator not in ["==", "!=", ">=", "<=", ">", "<", "in", "not in"] and \
|
||||||
if type(Oprand1) == type(''):
|
(type(Oprand1) == type('') or type(Oprand2) == type('')):
|
||||||
if Oprand1[0] in ['"', "'"] or Oprand1.startswith('L"') or Oprand1.startswith("L'")or Oprand1.startswith('UINT'):
|
|
||||||
Oprand1, Size = ParseFieldValue(Oprand1)
|
|
||||||
else:
|
|
||||||
Oprand1,Size = ParseFieldValue('"' + Oprand1 + '"')
|
|
||||||
if type(Oprand2) == type(''):
|
|
||||||
if Oprand2[0] in ['"', "'"] or Oprand2.startswith('L"') or Oprand2.startswith("L'") or Oprand2.startswith('UINT'):
|
|
||||||
Oprand2, Size = ParseFieldValue(Oprand2)
|
|
||||||
else:
|
|
||||||
Oprand2, Size = ParseFieldValue('"' + Oprand2 + '"')
|
|
||||||
if type(Oprand1) == type('') or type(Oprand2) == type(''):
|
|
||||||
raise BadExpression(ERR_STRING_EXPR % Operator)
|
raise BadExpression(ERR_STRING_EXPR % Operator)
|
||||||
if Operator in ['in', 'not in']:
|
if Operator in ['in', 'not in']:
|
||||||
if type(Oprand1) != type(''):
|
if type(Oprand1) != type(''):
|
||||||
@@ -251,9 +317,6 @@ class ValueExpression(object):
|
|||||||
self._Expr = Expression
|
self._Expr = Expression
|
||||||
self._NoProcess = True
|
self._NoProcess = True
|
||||||
return
|
return
|
||||||
if Expression.strip().startswith('{') and Expression.strip().endswith('}'):
|
|
||||||
self._Expr = Expression
|
|
||||||
self._NoProcess = True
|
|
||||||
|
|
||||||
self._Expr = ReplaceExprMacro(Expression.strip(),
|
self._Expr = ReplaceExprMacro(Expression.strip(),
|
||||||
SymbolTable,
|
SymbolTable,
|
||||||
@@ -293,13 +356,13 @@ class ValueExpression(object):
|
|||||||
self._Token = self._Expr
|
self._Token = self._Expr
|
||||||
if self.__IsNumberToken():
|
if self.__IsNumberToken():
|
||||||
return self._Expr
|
return self._Expr
|
||||||
|
Token = ''
|
||||||
try:
|
try:
|
||||||
Token = self._GetToken()
|
Token = self._GetToken()
|
||||||
if type(Token) == type('') and Token.startswith('{') and Token.endswith('}') and self._Idx >= self._Len:
|
|
||||||
return self._Expr
|
|
||||||
except BadExpression:
|
except BadExpression:
|
||||||
pass
|
pass
|
||||||
|
if type(Token) == type('') and Token.startswith('{') and Token.endswith('}') and self._Idx >= self._Len:
|
||||||
|
return self._Expr
|
||||||
|
|
||||||
self._Idx = 0
|
self._Idx = 0
|
||||||
self._Token = ''
|
self._Token = ''
|
||||||
@@ -454,14 +517,23 @@ class ValueExpression(object):
|
|||||||
Radix = 10
|
Radix = 10
|
||||||
if self._Token.lower()[0:2] == '0x' and len(self._Token) > 2:
|
if self._Token.lower()[0:2] == '0x' and len(self._Token) > 2:
|
||||||
Radix = 16
|
Radix = 16
|
||||||
if self._Token.startswith('"') or self._Token.startswith("'")\
|
if self._Token.startswith('"') or self._Token.startswith('L"'):
|
||||||
or self._Token.startswith("L'") or self._Token.startswith('L"'):
|
|
||||||
Flag = 0
|
Flag = 0
|
||||||
for Index in range(len(self._Token)):
|
for Index in range(len(self._Token)):
|
||||||
if self._Token[Index] in ['"', "'"]:
|
if self._Token[Index] in ['"']:
|
||||||
|
if self._Token[Index - 1] == '\\':
|
||||||
|
continue
|
||||||
Flag += 1
|
Flag += 1
|
||||||
if Flag == 2:
|
if Flag == 2 and self._Token.endswith('"'):
|
||||||
self._Token = ParseFieldValue(self._Token)[0]
|
return True
|
||||||
|
if self._Token.startswith("'") or self._Token.startswith("L'"):
|
||||||
|
Flag = 0
|
||||||
|
for Index in range(len(self._Token)):
|
||||||
|
if self._Token[Index] in ["'"]:
|
||||||
|
if self._Token[Index - 1] == '\\':
|
||||||
|
continue
|
||||||
|
Flag += 1
|
||||||
|
if Flag == 2 and self._Token.endswith("'"):
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
self._Token = int(self._Token, Radix)
|
self._Token = int(self._Token, Radix)
|
||||||
@@ -507,15 +579,24 @@ class ValueExpression(object):
|
|||||||
self._Idx += 1
|
self._Idx += 1
|
||||||
|
|
||||||
# Replace escape \\\", \"
|
# Replace escape \\\", \"
|
||||||
|
if self._Expr[Idx] == '"':
|
||||||
Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace('\\\"', '\\\'')
|
Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace('\\\"', '\\\'')
|
||||||
for Ch in Expr:
|
for Ch in Expr:
|
||||||
self._Idx += 1
|
self._Idx += 1
|
||||||
if Ch == '"' or Ch == "'":
|
if Ch == '"':
|
||||||
break
|
break
|
||||||
self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]
|
self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]
|
||||||
if self._Token.startswith('"') and not self._Token.endswith('"'):
|
if not self._Token.endswith('"'):
|
||||||
raise BadExpression(ERR_STRING_TOKEN % self._Token)
|
raise BadExpression(ERR_STRING_TOKEN % self._Token)
|
||||||
if self._Token.startswith("'") and not self._Token.endswith("'"):
|
#Replace escape \\\', \'
|
||||||
|
elif self._Expr[Idx] == "'":
|
||||||
|
Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace("\\\'", "\\\"")
|
||||||
|
for Ch in Expr:
|
||||||
|
self._Idx += 1
|
||||||
|
if Ch == "'":
|
||||||
|
break
|
||||||
|
self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]
|
||||||
|
if not self._Token.endswith("'"):
|
||||||
raise BadExpression(ERR_STRING_TOKEN % self._Token)
|
raise BadExpression(ERR_STRING_TOKEN % self._Token)
|
||||||
self._Token = self._Token[1:-1]
|
self._Token = self._Token[1:-1]
|
||||||
return self._Token
|
return self._Token
|
||||||
@@ -593,11 +674,10 @@ class ValueExpression(object):
|
|||||||
|
|
||||||
if self.HexPattern.match(self._LiteralToken):
|
if self.HexPattern.match(self._LiteralToken):
|
||||||
Token = self._LiteralToken[2:]
|
Token = self._LiteralToken[2:]
|
||||||
Token = Token.lstrip('0')
|
|
||||||
if not Token:
|
if not Token:
|
||||||
self._LiteralToken = '0x0'
|
self._LiteralToken = '0x0'
|
||||||
else:
|
else:
|
||||||
self._LiteralToken = '0x' + Token.lower()
|
self._LiteralToken = '0x' + Token
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -617,24 +697,16 @@ class ValueExpression(object):
|
|||||||
self._Idx += 1
|
self._Idx += 1
|
||||||
UStr = self.__GetString()
|
UStr = self.__GetString()
|
||||||
self._Token = 'L"' + UStr + '"'
|
self._Token = 'L"' + UStr + '"'
|
||||||
self._Token, Size = ParseFieldValue(self._Token)
|
|
||||||
return self._Token
|
return self._Token
|
||||||
elif Expr.startswith("L'"):
|
elif Expr.startswith("L'"):
|
||||||
# Skip L
|
# Skip L
|
||||||
self._Idx += 1
|
self._Idx += 1
|
||||||
UStr = self.__GetString()
|
UStr = self.__GetString()
|
||||||
self._Token = "L'" + UStr + "'"
|
self._Token = "L'" + UStr + "'"
|
||||||
self._Token, Size = ParseFieldValue(self._Token)
|
|
||||||
return self._Token
|
|
||||||
elif Expr.startswith('"'):
|
|
||||||
UStr = self.__GetString()
|
|
||||||
self._Token = '"' + UStr + '"'
|
|
||||||
self._Token, Size = ParseFieldValue(self._Token)
|
|
||||||
return self._Token
|
return self._Token
|
||||||
elif Expr.startswith("'"):
|
elif Expr.startswith("'"):
|
||||||
UStr = self.__GetString()
|
UStr = self.__GetString()
|
||||||
self._Token = "'" + UStr + "'"
|
self._Token = "'" + UStr + "'"
|
||||||
self._Token, Size = ParseFieldValue(self._Token)
|
|
||||||
return self._Token
|
return self._Token
|
||||||
elif Expr.startswith('UINT'):
|
elif Expr.startswith('UINT'):
|
||||||
Re = re.compile('(?:UINT8|UINT16|UINT32|UINT64)\((.+)\)')
|
Re = re.compile('(?:UINT8|UINT16|UINT32|UINT64)\((.+)\)')
|
||||||
@@ -734,32 +806,58 @@ class ValueExpressionEx(ValueExpression):
|
|||||||
PcdValue = self.PcdValue
|
PcdValue = self.PcdValue
|
||||||
try:
|
try:
|
||||||
PcdValue = ValueExpression.__call__(self, RealValue, Depth)
|
PcdValue = ValueExpression.__call__(self, RealValue, Depth)
|
||||||
|
if self.PcdType == 'VOID*' and (PcdValue.startswith("'") or PcdValue.startswith("L'")):
|
||||||
|
PcdValue, Size = ParseFieldValue(PcdValue)
|
||||||
|
PcdValueList = []
|
||||||
|
for I in range(Size):
|
||||||
|
PcdValueList.append('0x%02X'%(PcdValue & 0xff))
|
||||||
|
PcdValue = PcdValue >> 8
|
||||||
|
PcdValue = '{' + ','.join(PcdValueList) + '}'
|
||||||
|
elif self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN'] and (PcdValue.startswith("'") or \
|
||||||
|
PcdValue.startswith('"') or PcdValue.startswith("L'") or PcdValue.startswith('L"') or PcdValue.startswith('{')):
|
||||||
|
raise BadExpression
|
||||||
except WrnExpression, Value:
|
except WrnExpression, Value:
|
||||||
PcdValue = Value.result
|
PcdValue = Value.result
|
||||||
|
except BadExpression, Value:
|
||||||
if PcdValue == 'True':
|
|
||||||
PcdValue = '1'
|
|
||||||
if PcdValue == 'False':
|
|
||||||
PcdValue = '0'
|
|
||||||
if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
|
if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
|
||||||
PcdValue = PcdValue.strip()
|
PcdValue = PcdValue.strip()
|
||||||
if type(PcdValue) == type('') and PcdValue.startswith('{') and PcdValue.endswith('}'):
|
if type(PcdValue) == type('') and PcdValue.startswith('{') and PcdValue.endswith('}'):
|
||||||
PcdValue = PcdValue[1:-1].split(',')
|
PcdValue = SplitPcdValueString(PcdValue[1:-1])
|
||||||
if type(PcdValue) == type([]):
|
if type(PcdValue) == type([]):
|
||||||
TmpValue = 0
|
TmpValue = 0
|
||||||
Size = 0
|
Size = 0
|
||||||
|
ValueType = ''
|
||||||
for Item in PcdValue:
|
for Item in PcdValue:
|
||||||
if Item.startswith('UINT16'):
|
Item = Item.strip()
|
||||||
|
if Item.startswith('UINT8'):
|
||||||
|
ItemSize = 1
|
||||||
|
ValueType = 'UINT8'
|
||||||
|
elif Item.startswith('UINT16'):
|
||||||
ItemSize = 2
|
ItemSize = 2
|
||||||
|
ValueType = 'UINT16'
|
||||||
elif Item.startswith('UINT32'):
|
elif Item.startswith('UINT32'):
|
||||||
ItemSize = 4
|
ItemSize = 4
|
||||||
|
ValueType = 'UINT32'
|
||||||
elif Item.startswith('UINT64'):
|
elif Item.startswith('UINT64'):
|
||||||
ItemSize = 8
|
ItemSize = 8
|
||||||
|
ValueType = 'UINT64'
|
||||||
|
elif Item.startswith('"') or Item.startswith("'") or Item.startswith('L'):
|
||||||
|
ItemSize = 0
|
||||||
|
ValueType = 'VOID*'
|
||||||
else:
|
else:
|
||||||
ItemSize = 0
|
ItemSize = 0
|
||||||
Item = ValueExpressionEx(Item, self.PcdType, self._Symb)(True)
|
ValueType = 'UINT8'
|
||||||
|
Item = ValueExpressionEx(Item, ValueType, self._Symb)(True)
|
||||||
|
|
||||||
if ItemSize == 0:
|
if ItemSize == 0:
|
||||||
|
try:
|
||||||
|
tmpValue = int(Item, 16) if Item.upper().startswith('0X') else int(Item, 0)
|
||||||
|
if tmpValue > 255:
|
||||||
|
raise BadExpression("Byte array number %s should less than 0xFF." % Item)
|
||||||
|
except BadExpression, Value:
|
||||||
|
raise BadExpression(Value)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
ItemValue, ItemSize = ParseFieldValue(Item)
|
ItemValue, ItemSize = ParseFieldValue(Item)
|
||||||
else:
|
else:
|
||||||
ItemValue = ParseFieldValue(Item)[0]
|
ItemValue = ParseFieldValue(Item)[0]
|
||||||
@@ -770,9 +868,15 @@ class ValueExpressionEx(ValueExpression):
|
|||||||
TmpValue = (ItemValue << (Size * 8)) | TmpValue
|
TmpValue = (ItemValue << (Size * 8)) | TmpValue
|
||||||
Size = Size + ItemSize
|
Size = Size + ItemSize
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
TmpValue, Size = ParseFieldValue(PcdValue)
|
TmpValue, Size = ParseFieldValue(PcdValue)
|
||||||
|
except BadExpression, Value:
|
||||||
|
raise BadExpression("Type: %s, Value: %s, %s" % (self.PcdType, PcdValue, Value))
|
||||||
if type(TmpValue) == type(''):
|
if type(TmpValue) == type(''):
|
||||||
|
try:
|
||||||
TmpValue = int(TmpValue)
|
TmpValue = int(TmpValue)
|
||||||
|
except:
|
||||||
|
raise BadExpression(Value)
|
||||||
else:
|
else:
|
||||||
PcdValue = '0x%0{}X'.format(Size) % (TmpValue)
|
PcdValue = '0x%0{}X'.format(Size) % (TmpValue)
|
||||||
if TmpValue < 0:
|
if TmpValue < 0:
|
||||||
@@ -785,7 +889,7 @@ class ValueExpressionEx(ValueExpression):
|
|||||||
raise BadExpression('Type %s PCD Value Size is Larger than 4 byte' % self.PcdType)
|
raise BadExpression('Type %s PCD Value Size is Larger than 4 byte' % self.PcdType)
|
||||||
if self.PcdType == 'UINT64' and Size > 8:
|
if self.PcdType == 'UINT64' and Size > 8:
|
||||||
raise BadExpression('Type %s PCD Value Size is Larger than 8 byte' % self.PcdType)
|
raise BadExpression('Type %s PCD Value Size is Larger than 8 byte' % self.PcdType)
|
||||||
if self.PcdType in ['VOID*']:
|
else:
|
||||||
try:
|
try:
|
||||||
TmpValue = long(PcdValue)
|
TmpValue = long(PcdValue)
|
||||||
TmpList = []
|
TmpList = []
|
||||||
@@ -797,47 +901,42 @@ class ValueExpressionEx(ValueExpression):
|
|||||||
PcdValue = '{' + ', '.join(TmpList) + '}'
|
PcdValue = '{' + ', '.join(TmpList) + '}'
|
||||||
except:
|
except:
|
||||||
if PcdValue.strip().startswith('{'):
|
if PcdValue.strip().startswith('{'):
|
||||||
PcdValue = PcdValue.strip()[1:-1].strip()
|
PcdValueList = SplitPcdValueString(PcdValue.strip()[1:-1])
|
||||||
Size = 0
|
|
||||||
ValueStr = ''
|
|
||||||
TokenSpaceGuidName = ''
|
|
||||||
if PcdValue.startswith('GUID') and PcdValue.endswith(')'):
|
|
||||||
try:
|
|
||||||
TokenSpaceGuidName = re.search('GUID\((\w+)\)', PcdValue).group(1)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
if TokenSpaceGuidName and TokenSpaceGuidName in self._Symb:
|
|
||||||
PcdValue = 'GUID(' + self._Symb[TokenSpaceGuidName] + ')'
|
|
||||||
elif TokenSpaceGuidName:
|
|
||||||
raise BadExpression('%s not found in DEC file' % TokenSpaceGuidName)
|
|
||||||
|
|
||||||
ListItem, Size = ParseFieldValue(PcdValue)
|
|
||||||
elif PcdValue.startswith('DEVICE_PATH') and PcdValue.endswith(')'):
|
|
||||||
ListItem, Size = ParseFieldValue(PcdValue)
|
|
||||||
else:
|
|
||||||
ListItem = PcdValue.split(',')
|
|
||||||
|
|
||||||
if type(ListItem) == type(0) or type(ListItem) == type(0L):
|
|
||||||
for Index in range(0, Size):
|
|
||||||
ValueStr += '0x%02X' % (int(ListItem) & 255)
|
|
||||||
ListItem >>= 8
|
|
||||||
ValueStr += ', '
|
|
||||||
PcdValue = '{' + ValueStr[:-2] + '}'
|
|
||||||
elif type(ListItem) == type(''):
|
|
||||||
if ListItem.startswith('{') and ListItem.endswith('}'):
|
|
||||||
PcdValue = ListItem
|
|
||||||
else:
|
|
||||||
LabelDict = {}
|
LabelDict = {}
|
||||||
|
NewPcdValueList = []
|
||||||
ReLabel = re.compile('LABEL\((\w+)\)')
|
ReLabel = re.compile('LABEL\((\w+)\)')
|
||||||
ReOffset = re.compile('OFFSET_OF\((\w+)\)')
|
ReOffset = re.compile('OFFSET_OF\((\w+)\)')
|
||||||
for Index, Item in enumerate(ListItem):
|
LabelOffset = 0
|
||||||
|
for Index, Item in enumerate(PcdValueList):
|
||||||
|
# compute byte offset of every LABEL
|
||||||
|
LabelList = ReLabel.findall(Item)
|
||||||
|
Item = ReLabel.sub('', Item)
|
||||||
|
Item = Item.strip()
|
||||||
|
if LabelList:
|
||||||
|
for Label in LabelList:
|
||||||
|
if not IsValidCString(Label):
|
||||||
|
raise BadExpression('%s is not a valid c variable name' % Label)
|
||||||
|
if Label not in LabelDict.keys():
|
||||||
|
LabelDict[Label] = str(LabelOffset)
|
||||||
|
if Item.startswith('UINT8'):
|
||||||
|
LabelOffset = LabelOffset + 1
|
||||||
|
elif Item.startswith('UINT16'):
|
||||||
|
LabelOffset = LabelOffset + 2
|
||||||
|
elif Item.startswith('UINT32'):
|
||||||
|
LabelOffset = LabelOffset + 4
|
||||||
|
elif Item.startswith('UINT64'):
|
||||||
|
LabelOffset = LabelOffset + 8
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
ItemValue, ItemSize = ParseFieldValue(Item)
|
||||||
|
LabelOffset = LabelOffset + ItemSize
|
||||||
|
except:
|
||||||
|
LabelOffset = LabelOffset + 1
|
||||||
|
|
||||||
|
for Index, Item in enumerate(PcdValueList):
|
||||||
# for LABEL parse
|
# for LABEL parse
|
||||||
Item = Item.strip()
|
Item = Item.strip()
|
||||||
try:
|
try:
|
||||||
LabelList = ReLabel.findall(Item)
|
|
||||||
for Label in LabelList:
|
|
||||||
if Label not in LabelDict.keys():
|
|
||||||
LabelDict[Label] = str(Index)
|
|
||||||
Item = ReLabel.sub('', Item)
|
Item = ReLabel.sub('', Item)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@@ -850,29 +949,76 @@ class ValueExpressionEx(ValueExpression):
|
|||||||
Re = re.compile('OFFSET_OF\(%s\)' % Offset)
|
Re = re.compile('OFFSET_OF\(%s\)' % Offset)
|
||||||
Item = Re.sub(LabelDict[Offset], Item)
|
Item = Re.sub(LabelDict[Offset], Item)
|
||||||
else:
|
else:
|
||||||
raise BadExpression('%s not defined before use' % Offset)
|
raise BadExpression('%s not defined' % Offset)
|
||||||
if Item.startswith('UINT16'):
|
NewPcdValueList.append(Item)
|
||||||
|
|
||||||
|
AllPcdValueList = []
|
||||||
|
for Item in NewPcdValueList:
|
||||||
|
Size = 0
|
||||||
|
ValueStr = ''
|
||||||
|
TokenSpaceGuidName = ''
|
||||||
|
if Item.startswith('GUID') and Item.endswith(')'):
|
||||||
|
try:
|
||||||
|
TokenSpaceGuidName = re.search('GUID\((\w+)\)', Item).group(1)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if TokenSpaceGuidName and TokenSpaceGuidName in self._Symb:
|
||||||
|
Item = 'GUID(' + self._Symb[TokenSpaceGuidName] + ')'
|
||||||
|
elif TokenSpaceGuidName:
|
||||||
|
raise BadExpression('%s not found in DEC file' % TokenSpaceGuidName)
|
||||||
|
Item, Size = ParseFieldValue(Item)
|
||||||
|
for Index in range(0, Size):
|
||||||
|
ValueStr = '0x%02X' % (int(Item) & 255)
|
||||||
|
Item >>= 8
|
||||||
|
AllPcdValueList.append(ValueStr)
|
||||||
|
continue
|
||||||
|
elif Item.startswith('DEVICE_PATH') and Item.endswith(')'):
|
||||||
|
Item, Size = ParseFieldValue(Item)
|
||||||
|
AllPcdValueList.append(Item[1:-1])
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
ValueType = ""
|
||||||
|
if Item.startswith('UINT8'):
|
||||||
|
ItemSize = 1
|
||||||
|
ValueType = "UINT8"
|
||||||
|
elif Item.startswith('UINT16'):
|
||||||
ItemSize = 2
|
ItemSize = 2
|
||||||
|
ValueType = "UINT16"
|
||||||
elif Item.startswith('UINT32'):
|
elif Item.startswith('UINT32'):
|
||||||
ItemSize = 4
|
ItemSize = 4
|
||||||
|
ValueType = "UINT32"
|
||||||
elif Item.startswith('UINT64'):
|
elif Item.startswith('UINT64'):
|
||||||
ItemSize = 8
|
ItemSize = 8
|
||||||
|
ValueType = "UINT64"
|
||||||
else:
|
else:
|
||||||
ItemSize = 0
|
ItemSize = 0
|
||||||
|
if ValueType:
|
||||||
|
TmpValue = ValueExpressionEx(Item, ValueType, self._Symb)(True)
|
||||||
|
else:
|
||||||
TmpValue = ValueExpressionEx(Item, self.PcdType, self._Symb)(True)
|
TmpValue = ValueExpressionEx(Item, self.PcdType, self._Symb)(True)
|
||||||
Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue
|
Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue
|
||||||
if ItemSize == 0:
|
if ItemSize == 0:
|
||||||
ItemValue, ItemSize = ParseFieldValue(Item)
|
ItemValue, ItemSize = ParseFieldValue(Item)
|
||||||
|
if not (Item.startswith('"') or Item.startswith('L') or Item.startswith('{')) and ItemSize > 1:
|
||||||
|
raise BadExpression("Byte array number %s should less than 0xFF." % Item)
|
||||||
else:
|
else:
|
||||||
ItemValue = ParseFieldValue(Item)[0]
|
ItemValue = ParseFieldValue(Item)[0]
|
||||||
for I in range(0, ItemSize):
|
for I in range(0, ItemSize):
|
||||||
ValueStr += '0x%02X' % (int(ItemValue) & 255)
|
ValueStr = '0x%02X' % (int(ItemValue) & 255)
|
||||||
ItemValue >>= 8
|
ItemValue >>= 8
|
||||||
ValueStr += ', '
|
AllPcdValueList.append(ValueStr)
|
||||||
Size += ItemSize
|
Size += ItemSize
|
||||||
|
|
||||||
if Size > 0:
|
if Size > 0:
|
||||||
PcdValue = '{' + ValueStr[:-2] + '}'
|
PcdValue = '{' + ','.join(AllPcdValueList) + '}'
|
||||||
|
else:
|
||||||
|
raise BadExpression("Type: %s, Value: %s, %s"%(self.PcdType, PcdValue, Value))
|
||||||
|
|
||||||
|
if PcdValue == 'True':
|
||||||
|
PcdValue = '1'
|
||||||
|
if PcdValue == 'False':
|
||||||
|
PcdValue = '0'
|
||||||
|
|
||||||
if RealValue:
|
if RealValue:
|
||||||
return PcdValue
|
return PcdValue
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Common routines used by all tools
|
# Common routines used by all tools
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -38,7 +38,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
|
|||||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||||
import uuid
|
import uuid
|
||||||
from CommonDataClass.Exceptions import BadExpression
|
from CommonDataClass.Exceptions import BadExpression
|
||||||
|
import subprocess
|
||||||
## Regular expression used to find out place holders in string template
|
## Regular expression used to find out place holders in string template
|
||||||
gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UNICODE)
|
gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UNICODE)
|
||||||
|
|
||||||
@@ -1441,23 +1441,44 @@ def ParseConsoleLog(Filename):
|
|||||||
Opr.close()
|
Opr.close()
|
||||||
Opw.close()
|
Opw.close()
|
||||||
|
|
||||||
|
def IsFieldValueAnArray (Value):
|
||||||
|
Value = Value.strip()
|
||||||
|
if Value.startswith('GUID') and Value.endswith(')'):
|
||||||
|
return True
|
||||||
|
if Value.startswith('L"') and Value.endswith('"') and len(list(Value[2:-1])) > 1:
|
||||||
|
return True
|
||||||
|
if Value[0] == '"' and Value[-1] == '"' and len(list(Value[1:-1])) > 1:
|
||||||
|
return True
|
||||||
|
if Value[0] == '{' and Value[-1] == '}':
|
||||||
|
return True
|
||||||
|
if Value.startswith("L'") and Value.endswith("'") and len(list(Value[2:-1])) > 1:
|
||||||
|
return True
|
||||||
|
if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def AnalyzePcdExpression(Setting):
|
def AnalyzePcdExpression(Setting):
|
||||||
Setting = Setting.strip()
|
Setting = Setting.strip()
|
||||||
# There might be escaped quote in a string: \", \\\"
|
# There might be escaped quote in a string: \", \\\" , \', \\\'
|
||||||
Data = Setting.replace('\\\\', '//').replace('\\\"', '\\\'')
|
Data = Setting
|
||||||
# There might be '|' in string and in ( ... | ... ), replace it with '-'
|
# There might be '|' in string and in ( ... | ... ), replace it with '-'
|
||||||
NewStr = ''
|
NewStr = ''
|
||||||
InStr = False
|
InSingleQuoteStr = False
|
||||||
|
InDoubleQuoteStr = False
|
||||||
Pair = 0
|
Pair = 0
|
||||||
for ch in Data:
|
for Index, ch in enumerate(Data):
|
||||||
if ch == '"':
|
if ch == '"' and not InSingleQuoteStr:
|
||||||
InStr = not InStr
|
if Data[Index - 1] != '\\':
|
||||||
elif ch == '(' and not InStr:
|
InDoubleQuoteStr = not InDoubleQuoteStr
|
||||||
|
elif ch == "'" and not InDoubleQuoteStr:
|
||||||
|
if Data[Index - 1] != '\\':
|
||||||
|
InSingleQuoteStr = not InSingleQuoteStr
|
||||||
|
elif ch == '(' and not (InSingleQuoteStr or InDoubleQuoteStr):
|
||||||
Pair += 1
|
Pair += 1
|
||||||
elif ch == ')' and not InStr:
|
elif ch == ')' and not (InSingleQuoteStr or InDoubleQuoteStr):
|
||||||
Pair -= 1
|
Pair -= 1
|
||||||
|
|
||||||
if (Pair > 0 or InStr) and ch == TAB_VALUE_SPLIT:
|
if (Pair > 0 or InSingleQuoteStr or InDoubleQuoteStr) and ch == TAB_VALUE_SPLIT:
|
||||||
NewStr += '-'
|
NewStr += '-'
|
||||||
else:
|
else:
|
||||||
NewStr += ch
|
NewStr += ch
|
||||||
@@ -1474,8 +1495,38 @@ def AnalyzePcdExpression(Setting):
|
|||||||
return FieldList
|
return FieldList
|
||||||
|
|
||||||
def ParseDevPathValue (Value):
|
def ParseDevPathValue (Value):
|
||||||
|
DevPathList = [ "Path","HardwarePath","Pci","PcCard","MemoryMapped","VenHw","Ctrl","BMC","AcpiPath","Acpi","PciRoot",
|
||||||
|
"PcieRoot","Floppy","Keyboard","Serial","ParallelPort","AcpiEx","AcpiExp","AcpiAdr","Msg","Ata","Scsi",
|
||||||
|
"Fibre","FibreEx","I1394","USB","I2O","Infiniband","VenMsg","VenPcAnsi","VenVt100","VenVt100Plus",
|
||||||
|
"VenUtf8","UartFlowCtrl","SAS","SasEx","NVMe","UFS","SD","eMMC","DebugPort","MAC","IPv4","IPv6","Uart",
|
||||||
|
"UsbClass","UsbAudio","UsbCDCControl","UsbHID","UsbImage","UsbPrinter","UsbMassStorage","UsbHub",
|
||||||
|
"UsbCDCData","UsbSmartCard","UsbVideo","UsbDiagnostic","UsbWireless","UsbDeviceFirmwareUpdate",
|
||||||
|
"UsbIrdaBridge","UsbTestAndMeasurement","UsbWwid","Unit","iSCSI","Vlan","Uri","Bluetooth","Wi-Fi",
|
||||||
|
"MediaPath","HD","CDROM","VenMedia","Media","Fv","FvFile","Offset","RamDisk","VirtualDisk","VirtualCD",
|
||||||
|
"PersistentVirtualDisk","PersistentVirtualCD","BbsPath","BBS","Sata" ]
|
||||||
|
if '\\' in Value:
|
||||||
|
Value.replace('\\', '/').replace(' ', '')
|
||||||
|
for Item in Value.split('/'):
|
||||||
|
Key = Item.strip().split('(')[0]
|
||||||
|
if Key not in DevPathList:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Cmd = 'DevicePath ' + '"' + Value + '"'
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen(Cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
|
out, err = p.communicate()
|
||||||
|
except Exception, X:
|
||||||
|
raise BadExpression("DevicePath: %s" % (str(X)) )
|
||||||
|
finally:
|
||||||
|
subprocess._cleanup()
|
||||||
|
p.stdout.close()
|
||||||
|
p.stderr.close()
|
||||||
|
if err:
|
||||||
|
raise BadExpression("DevicePath: %s" % str(err))
|
||||||
|
Size = len(out.split())
|
||||||
|
out = ','.join(out.split())
|
||||||
|
return '{' + out + '}', Size
|
||||||
|
|
||||||
def ParseFieldValue (Value):
|
def ParseFieldValue (Value):
|
||||||
if type(Value) == type(0):
|
if type(Value) == type(0):
|
||||||
return Value, (Value.bit_length() + 7) / 8
|
return Value, (Value.bit_length() + 7) / 8
|
||||||
@@ -1505,16 +1556,10 @@ def ParseFieldValue (Value):
|
|||||||
if Value.startswith('GUID') and Value.endswith(')'):
|
if Value.startswith('GUID') and Value.endswith(')'):
|
||||||
Value = Value.split('(', 1)[1][:-1].strip()
|
Value = Value.split('(', 1)[1][:-1].strip()
|
||||||
if Value[0] == '{' and Value[-1] == '}':
|
if Value[0] == '{' and Value[-1] == '}':
|
||||||
Value = Value[1:-1].strip()
|
TmpValue = GuidStructureStringToGuidString(Value)
|
||||||
Value = Value.split('{', 1)
|
if len(TmpValue) == 0:
|
||||||
Value = ['%02x' % int(Item, 16) for Item in (Value[0] + Value[1][:-1]).split(',')]
|
raise BadExpression("Invalid GUID value string %s" % Value)
|
||||||
if len(Value[0]) != 8:
|
Value = TmpValue
|
||||||
Value[0] = '%08X' % int(Value[0], 16)
|
|
||||||
if len(Value[1]) != 4:
|
|
||||||
Value[1] = '%04X' % int(Value[1], 16)
|
|
||||||
if len(Value[2]) != 4:
|
|
||||||
Value[2] = '%04X' % int(Value[2], 16)
|
|
||||||
Value = '-'.join(Value[0:3]) + '-' + ''.join(Value[3:5]) + '-' + ''.join(Value[5:11])
|
|
||||||
if Value[0] == '"' and Value[-1] == '"':
|
if Value[0] == '"' and Value[-1] == '"':
|
||||||
Value = Value[1:-1]
|
Value = Value[1:-1]
|
||||||
try:
|
try:
|
||||||
@@ -1525,7 +1570,13 @@ def ParseFieldValue (Value):
|
|||||||
return Value, 16
|
return Value, 16
|
||||||
if Value.startswith('L"') and Value.endswith('"'):
|
if Value.startswith('L"') and Value.endswith('"'):
|
||||||
# Unicode String
|
# Unicode String
|
||||||
List = list(Value[2:-1])
|
# translate escape character
|
||||||
|
Value = Value[1:]
|
||||||
|
try:
|
||||||
|
Value = eval(Value)
|
||||||
|
except:
|
||||||
|
Value = Value[1:-1]
|
||||||
|
List = list(Value)
|
||||||
List.reverse()
|
List.reverse()
|
||||||
Value = 0
|
Value = 0
|
||||||
for Char in List:
|
for Char in List:
|
||||||
@@ -1533,7 +1584,12 @@ def ParseFieldValue (Value):
|
|||||||
return Value, (len(List) + 1) * 2
|
return Value, (len(List) + 1) * 2
|
||||||
if Value.startswith('"') and Value.endswith('"'):
|
if Value.startswith('"') and Value.endswith('"'):
|
||||||
# ASCII String
|
# ASCII String
|
||||||
List = list(Value[1:-1])
|
# translate escape character
|
||||||
|
try:
|
||||||
|
Value = eval(Value)
|
||||||
|
except:
|
||||||
|
Value = Value[1:-1]
|
||||||
|
List = list(Value)
|
||||||
List.reverse()
|
List.reverse()
|
||||||
Value = 0
|
Value = 0
|
||||||
for Char in List:
|
for Char in List:
|
||||||
@@ -1541,7 +1597,15 @@ def ParseFieldValue (Value):
|
|||||||
return Value, len(List) + 1
|
return Value, len(List) + 1
|
||||||
if Value.startswith("L'") and Value.endswith("'"):
|
if Value.startswith("L'") and Value.endswith("'"):
|
||||||
# Unicode Character Constant
|
# Unicode Character Constant
|
||||||
List = list(Value[2:-1])
|
# translate escape character
|
||||||
|
Value = Value[1:]
|
||||||
|
try:
|
||||||
|
Value = eval(Value)
|
||||||
|
except:
|
||||||
|
Value = Value[1:-1]
|
||||||
|
List = list(Value)
|
||||||
|
if len(List) == 0:
|
||||||
|
raise BadExpression('Length %s is %s' % (Value, len(List)))
|
||||||
List.reverse()
|
List.reverse()
|
||||||
Value = 0
|
Value = 0
|
||||||
for Char in List:
|
for Char in List:
|
||||||
@@ -1549,7 +1613,14 @@ def ParseFieldValue (Value):
|
|||||||
return Value, len(List) * 2
|
return Value, len(List) * 2
|
||||||
if Value.startswith("'") and Value.endswith("'"):
|
if Value.startswith("'") and Value.endswith("'"):
|
||||||
# Character constant
|
# Character constant
|
||||||
List = list(Value[1:-1])
|
# translate escape character
|
||||||
|
try:
|
||||||
|
Value = eval(Value)
|
||||||
|
except:
|
||||||
|
Value = Value[1:-1]
|
||||||
|
List = list(Value)
|
||||||
|
if len(List) == 0:
|
||||||
|
raise BadExpression('Length %s is %s' % (Value, len(List)))
|
||||||
List.reverse()
|
List.reverse()
|
||||||
Value = 0
|
Value = 0
|
||||||
for Char in List:
|
for Char in List:
|
||||||
@@ -1569,7 +1640,8 @@ def ParseFieldValue (Value):
|
|||||||
Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff)
|
Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff)
|
||||||
return Value, RetSize
|
return Value, RetSize
|
||||||
if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):
|
if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):
|
||||||
Value = Value.split('"')[1]
|
Value = Value.replace("DEVICE_PATH(", '').rstrip(')')
|
||||||
|
Value = Value.strip().strip('"')
|
||||||
return ParseDevPathValue(Value)
|
return ParseDevPathValue(Value)
|
||||||
if Value.lower().startswith('0x'):
|
if Value.lower().startswith('0x'):
|
||||||
Value = int(Value, 16)
|
Value = int(Value, 16)
|
||||||
@@ -1648,14 +1720,6 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
|
|||||||
Type = DataType
|
Type = DataType
|
||||||
if len(FieldList) > 2:
|
if len(FieldList) > 2:
|
||||||
Size = FieldList[2]
|
Size = FieldList[2]
|
||||||
else:
|
|
||||||
if Type == 'VOID*':
|
|
||||||
if Value.startswith("L"):
|
|
||||||
Size = str((len(Value)- 3 + 1) * 2)
|
|
||||||
elif Value.startswith("{"):
|
|
||||||
Size = str(len(Value.split(",")))
|
|
||||||
else:
|
|
||||||
Size = str(len(Value) -2 + 1 )
|
|
||||||
if DataType == "":
|
if DataType == "":
|
||||||
IsValid = (len(FieldList) <= 1)
|
IsValid = (len(FieldList) <= 1)
|
||||||
else:
|
else:
|
||||||
@@ -1788,10 +1852,10 @@ def CheckPcdDatum(Type, Value):
|
|||||||
if Type == "VOID*":
|
if Type == "VOID*":
|
||||||
ValueRe = re.compile(r'\s*L?\".*\"\s*$')
|
ValueRe = re.compile(r'\s*L?\".*\"\s*$')
|
||||||
if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"'))
|
if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"'))
|
||||||
or (Value.startswith('{') and Value.endswith('}'))
|
or (Value.startswith('{') and Value.endswith('}')) or (Value.startswith("L'") or Value.startswith("'") and Value.endswith("'"))
|
||||||
):
|
):
|
||||||
return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\
|
return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\
|
||||||
", or \"...\" for string, or L\"...\" for unicode string" % (Value, Type)
|
", \"...\" or \'...\' for string, L\"...\" or L\'...\' for unicode string" % (Value, Type)
|
||||||
elif ValueRe.match(Value):
|
elif ValueRe.match(Value):
|
||||||
# Check the chars in UnicodeString or CString is printable
|
# Check the chars in UnicodeString or CString is printable
|
||||||
if Value.startswith("L"):
|
if Value.startswith("L"):
|
||||||
@@ -2210,6 +2274,10 @@ class SkuClass():
|
|||||||
GlobalData.gSkuids = (self.SkuIdSet)
|
GlobalData.gSkuids = (self.SkuIdSet)
|
||||||
if 'COMMON' in GlobalData.gSkuids:
|
if 'COMMON' in GlobalData.gSkuids:
|
||||||
GlobalData.gSkuids.remove('COMMON')
|
GlobalData.gSkuids.remove('COMMON')
|
||||||
|
if self.SkuUsageType == self.SINGLE:
|
||||||
|
if len(GlobalData.gSkuids) != 1:
|
||||||
|
if 'DEFAULT' in GlobalData.gSkuids:
|
||||||
|
GlobalData.gSkuids.remove('DEFAULT')
|
||||||
if GlobalData.gSkuids:
|
if GlobalData.gSkuids:
|
||||||
GlobalData.gSkuids.sort()
|
GlobalData.gSkuids.sort()
|
||||||
|
|
||||||
@@ -2221,6 +2289,8 @@ class SkuClass():
|
|||||||
return self.__SkuInherit.get(skuname,"DEFAULT")
|
return self.__SkuInherit.get(skuname,"DEFAULT")
|
||||||
|
|
||||||
def GetSkuChain(self,sku):
|
def GetSkuChain(self,sku):
|
||||||
|
if sku == "DEFAULT":
|
||||||
|
return ["DEFAULT"]
|
||||||
skulist = [sku]
|
skulist = [sku]
|
||||||
nextsku = sku
|
nextsku = sku
|
||||||
while 1:
|
while 1:
|
||||||
@@ -2315,31 +2385,6 @@ def PackRegistryFormatGuid(Guid):
|
|||||||
int(Guid[4][-2:], 16)
|
int(Guid[4][-2:], 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
|
|
||||||
if PcdDatumType == 'VOID*':
|
|
||||||
if Value.startswith('L'):
|
|
||||||
if not Value[1]:
|
|
||||||
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
|
|
||||||
Value = Value[0] + '"' + Value[1:] + '"'
|
|
||||||
elif Value.startswith('H'):
|
|
||||||
if not Value[1]:
|
|
||||||
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
|
|
||||||
Value = Value[1:]
|
|
||||||
else:
|
|
||||||
if not Value[0]:
|
|
||||||
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
|
|
||||||
Value = '"' + Value + '"'
|
|
||||||
|
|
||||||
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
|
|
||||||
if not IsValid:
|
|
||||||
EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
|
|
||||||
if PcdDatumType == 'BOOLEAN':
|
|
||||||
Value = Value.upper()
|
|
||||||
if Value == 'TRUE' or Value == '1':
|
|
||||||
Value = '1'
|
|
||||||
elif Value == 'FALSE' or Value == '0':
|
|
||||||
Value = '0'
|
|
||||||
return Value
|
|
||||||
## Get the integer value from string like "14U" or integer like 2
|
## Get the integer value from string like "14U" or integer like 2
|
||||||
#
|
#
|
||||||
# @param Input The object that may be either a integer value or a string
|
# @param Input The object that may be either a integer value or a string
|
||||||
|
|||||||
@@ -45,26 +45,32 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
|
|||||||
ValueList = []
|
ValueList = []
|
||||||
Last = 0
|
Last = 0
|
||||||
Escaped = False
|
Escaped = False
|
||||||
InString = False
|
InSingleQuoteString = False
|
||||||
|
InDoubleQuoteString = False
|
||||||
InParenthesis = 0
|
InParenthesis = 0
|
||||||
for Index in range(0, len(String)):
|
for Index in range(0, len(String)):
|
||||||
Char = String[Index]
|
Char = String[Index]
|
||||||
|
|
||||||
if not Escaped:
|
if not Escaped:
|
||||||
# Found a splitter not in a string, split it
|
# Found a splitter not in a string, split it
|
||||||
if not InString and InParenthesis == 0 and Char == SplitTag:
|
if (not InSingleQuoteString or not InDoubleQuoteString) and InParenthesis == 0 and Char == SplitTag:
|
||||||
ValueList.append(String[Last:Index].strip())
|
ValueList.append(String[Last:Index].strip())
|
||||||
Last = Index + 1
|
Last = Index + 1
|
||||||
if MaxSplit > 0 and len(ValueList) >= MaxSplit:
|
if MaxSplit > 0 and len(ValueList) >= MaxSplit:
|
||||||
break
|
break
|
||||||
|
|
||||||
if Char == '\\' and InString:
|
if Char == '\\' and (InSingleQuoteString or InDoubleQuoteString):
|
||||||
Escaped = True
|
Escaped = True
|
||||||
elif Char == '"':
|
elif Char == '"' and not InSingleQuoteString:
|
||||||
if not InString:
|
if not InDoubleQuoteString:
|
||||||
InString = True
|
InDoubleQuoteString = True
|
||||||
else:
|
else:
|
||||||
InString = False
|
InDoubleQuoteString = False
|
||||||
|
elif Char == "'" and not InDoubleQuoteString:
|
||||||
|
if not InSingleQuoteString:
|
||||||
|
InSingleQuoteString = True
|
||||||
|
else:
|
||||||
|
InSingleQuoteString = False
|
||||||
elif Char == '(':
|
elif Char == '(':
|
||||||
InParenthesis = InParenthesis + 1
|
InParenthesis = InParenthesis + 1
|
||||||
elif Char == ')':
|
elif Char == ')':
|
||||||
@@ -345,14 +351,17 @@ def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyle
|
|||||||
#
|
#
|
||||||
# remove comments, but we should escape comment character in string
|
# remove comments, but we should escape comment character in string
|
||||||
#
|
#
|
||||||
InString = False
|
InDoubleQuoteString = False
|
||||||
|
InSingleQuoteString = False
|
||||||
CommentInString = False
|
CommentInString = False
|
||||||
for Index in range(0, len(Line)):
|
for Index in range(0, len(Line)):
|
||||||
if Line[Index] == '"':
|
if Line[Index] == '"' and not InSingleQuoteString:
|
||||||
InString = not InString
|
InDoubleQuoteString = not InDoubleQuoteString
|
||||||
elif Line[Index] == CommentCharacter and InString :
|
elif Line[Index] == "'" and not InDoubleQuoteString:
|
||||||
|
InSingleQuoteString = not InSingleQuoteString
|
||||||
|
elif Line[Index] == CommentCharacter and (InSingleQuoteString or InDoubleQuoteString):
|
||||||
CommentInString = True
|
CommentInString = True
|
||||||
elif Line[Index] == CommentCharacter and not InString :
|
elif Line[Index] == CommentCharacter and not (InSingleQuoteString or InDoubleQuoteString):
|
||||||
Line = Line[0: Index]
|
Line = Line[0: Index]
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -402,15 +411,18 @@ def CleanString2(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyl
|
|||||||
#
|
#
|
||||||
# separate comments and statements, but we should escape comment character in string
|
# separate comments and statements, but we should escape comment character in string
|
||||||
#
|
#
|
||||||
InString = False
|
InDoubleQuoteString = False
|
||||||
|
InSingleQuoteString = False
|
||||||
CommentInString = False
|
CommentInString = False
|
||||||
Comment = ''
|
Comment = ''
|
||||||
for Index in range(0, len(Line)):
|
for Index in range(0, len(Line)):
|
||||||
if Line[Index] == '"':
|
if Line[Index] == '"' and not InSingleQuoteString:
|
||||||
InString = not InString
|
InDoubleQuoteString = not InDoubleQuoteString
|
||||||
elif Line[Index] == CommentCharacter and InString:
|
elif Line[Index] == "'" and not InDoubleQuoteString:
|
||||||
|
InSingleQuoteString = not InSingleQuoteString
|
||||||
|
elif Line[Index] == CommentCharacter and (InDoubleQuoteString or InSingleQuoteString):
|
||||||
CommentInString = True
|
CommentInString = True
|
||||||
elif Line[Index] == CommentCharacter and not InString:
|
elif Line[Index] == CommentCharacter and not (InDoubleQuoteString or InSingleQuoteString):
|
||||||
Comment = Line[Index:].strip()
|
Comment = Line[Index:].strip()
|
||||||
Line = Line[0:Index].strip()
|
Line = Line[0:Index].strip()
|
||||||
break
|
break
|
||||||
@@ -824,9 +836,9 @@ def StringToArray(String):
|
|||||||
elif String.startswith('{'):
|
elif String.startswith('{'):
|
||||||
StringLen = len(String.split(","))
|
StringLen = len(String.split(","))
|
||||||
if StringLen % 2:
|
if StringLen % 2:
|
||||||
return "{%s, 0x00}" % ", ".join([ C for C in String[1:-1].split(',')])
|
return "{%s,0x00}" % ",".join([ C.strip() for C in String[1:-1].split(',')])
|
||||||
else:
|
else:
|
||||||
return "{%s}" % ", ".join([ C for C in String[1:-1].split(',')])
|
return "{%s}" % ",".join([ C.strip() for C in String[1:-1].split(',')])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if len(String.split()) % 2:
|
if len(String.split()) % 2:
|
||||||
|
|||||||
@@ -101,13 +101,6 @@ class CParser(Parser):
|
|||||||
self.function_definition_stack = []
|
self.function_definition_stack = []
|
||||||
self.postfix_expression_stack = []
|
self.postfix_expression_stack = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def printTokenInfo(self, line, offset, tokenText):
|
def printTokenInfo(self, line, offset, tokenText):
|
||||||
print str(line)+ ',' + str(offset) + ':' + str(tokenText)
|
print str(line)+ ',' + str(offset) + ':' + str(tokenText)
|
||||||
|
|
||||||
|
|||||||
@@ -101,13 +101,6 @@ class CParser(Parser):
|
|||||||
self.function_definition_stack = []
|
self.function_definition_stack = []
|
||||||
self.postfix_expression_stack = []
|
self.postfix_expression_stack = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def printTokenInfo(self, line, offset, tokenText):
|
def printTokenInfo(self, line, offset, tokenText):
|
||||||
print str(line)+ ',' + str(offset) + ':' + str(tokenText)
|
print str(line)+ ',' + str(offset) + ':' + str(tokenText)
|
||||||
|
|
||||||
|
|||||||
@@ -60,15 +60,24 @@ class CompressSection (CompressSectionClassObject) :
|
|||||||
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
|
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
|
||||||
|
|
||||||
SectFiles = tuple()
|
SectFiles = tuple()
|
||||||
|
SectAlign = []
|
||||||
Index = 0
|
Index = 0
|
||||||
|
MaxAlign = None
|
||||||
for Sect in self.SectionList:
|
for Sect in self.SectionList:
|
||||||
Index = Index + 1
|
Index = Index + 1
|
||||||
SecIndex = '%s.%d' %(SecNum, Index)
|
SecIndex = '%s.%d' %(SecNum, Index)
|
||||||
ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
|
ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
|
||||||
|
if AlignValue != None:
|
||||||
|
if MaxAlign == None:
|
||||||
|
MaxAlign = AlignValue
|
||||||
|
if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
|
||||||
|
MaxAlign = AlignValue
|
||||||
if ReturnSectList != []:
|
if ReturnSectList != []:
|
||||||
|
if AlignValue == None:
|
||||||
|
AlignValue = "1"
|
||||||
for FileData in ReturnSectList:
|
for FileData in ReturnSectList:
|
||||||
SectFiles += (FileData,)
|
SectFiles += (FileData,)
|
||||||
|
SectAlign.append(AlignValue)
|
||||||
|
|
||||||
OutputFile = OutputPath + \
|
OutputFile = OutputPath + \
|
||||||
os.sep + \
|
os.sep + \
|
||||||
@@ -77,8 +86,10 @@ class CompressSection (CompressSectionClassObject) :
|
|||||||
SecNum + \
|
SecNum + \
|
||||||
Ffs.SectionSuffix['COMPRESS']
|
Ffs.SectionSuffix['COMPRESS']
|
||||||
OutputFile = os.path.normpath(OutputFile)
|
OutputFile = os.path.normpath(OutputFile)
|
||||||
|
DummyFile = OutputFile + '.dummy'
|
||||||
|
GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAlign=SectAlign, IsMakefile=IsMakefile)
|
||||||
|
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], Section.Section.SectionType['COMPRESS'],
|
||||||
CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
|
CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# parse FDF file
|
# parse FDF file
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
|
# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
@@ -925,6 +925,13 @@ class FdfParser:
|
|||||||
|
|
||||||
MacroDict.update(GlobalData.gGlobalDefines)
|
MacroDict.update(GlobalData.gGlobalDefines)
|
||||||
MacroDict.update(GlobalData.gCommandLineDefines)
|
MacroDict.update(GlobalData.gCommandLineDefines)
|
||||||
|
if GlobalData.BuildOptionPcd:
|
||||||
|
for Item in GlobalData.BuildOptionPcd:
|
||||||
|
if type(Item) is tuple:
|
||||||
|
continue
|
||||||
|
PcdName, TmpValue = Item.split("=")
|
||||||
|
TmpValue = BuildOptionValue(TmpValue, {})
|
||||||
|
MacroDict[PcdName.strip()] = TmpValue
|
||||||
# Highest priority
|
# Highest priority
|
||||||
|
|
||||||
return MacroDict
|
return MacroDict
|
||||||
@@ -2486,6 +2493,8 @@ class FdfParser:
|
|||||||
if not self.__GetNextToken():
|
if not self.__GetNextToken():
|
||||||
raise Warning("expected INF file path", self.FileName, self.CurrentLineNumber)
|
raise Warning("expected INF file path", self.FileName, self.CurrentLineNumber)
|
||||||
ffsInf.InfFileName = self.__Token
|
ffsInf.InfFileName = self.__Token
|
||||||
|
if not ffsInf.InfFileName.endswith('.inf'):
|
||||||
|
raise Warning("expected .inf file path", self.FileName, self.CurrentLineNumber)
|
||||||
|
|
||||||
ffsInf.CurrentLineNum = self.CurrentLineNumber
|
ffsInf.CurrentLineNum = self.CurrentLineNumber
|
||||||
ffsInf.CurrentLineContent = self.__CurrentLine()
|
ffsInf.CurrentLineContent = self.__CurrentLine()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# process FFS generation from INF statement
|
# process FFS generation from INF statement
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.<BR>
|
# Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
@@ -46,6 +46,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
|
|||||||
import Common.GlobalData as GlobalData
|
import Common.GlobalData as GlobalData
|
||||||
from DepexSection import DepexSection
|
from DepexSection import DepexSection
|
||||||
from Common.Misc import SaveFileOnChange
|
from Common.Misc import SaveFileOnChange
|
||||||
|
from Common.Expression import *
|
||||||
|
|
||||||
## generate FFS from INF
|
## generate FFS from INF
|
||||||
#
|
#
|
||||||
@@ -237,6 +238,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
InfPcds = Inf.Pcds
|
InfPcds = Inf.Pcds
|
||||||
Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||||
FdfPcdDict = GenFdsGlobalVariable.FdfParser.Profile.PcdDict
|
FdfPcdDict = GenFdsGlobalVariable.FdfParser.Profile.PcdDict
|
||||||
|
PlatformPcds = Platform.Pcds
|
||||||
|
|
||||||
# Workaround here: both build and GenFds tool convert the workspace path to lower case
|
# Workaround here: both build and GenFds tool convert the workspace path to lower case
|
||||||
# But INF file path in FDF and DSC file may have real case characters.
|
# But INF file path in FDF and DSC file may have real case characters.
|
||||||
@@ -272,15 +274,31 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
if GlobalData.BuildOptionPcd:
|
if GlobalData.BuildOptionPcd:
|
||||||
for pcd in GlobalData.BuildOptionPcd:
|
for pcd in GlobalData.BuildOptionPcd:
|
||||||
if PcdKey == (pcd[1], pcd[0]):
|
if PcdKey == (pcd[1], pcd[0]):
|
||||||
DefaultValue = pcd[2]
|
if pcd[2]:
|
||||||
|
continue
|
||||||
|
DefaultValue = pcd[3]
|
||||||
BuildOptionOverride = True
|
BuildOptionOverride = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if not DscOverride and not FdfOverride and not BuildOptionOverride:
|
if not DscOverride and not FdfOverride and not BuildOptionOverride:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Support Flexible PCD format
|
||||||
|
if DefaultValue:
|
||||||
|
try:
|
||||||
|
DefaultValue = ValueExpressionEx(DefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
|
||||||
|
except BadExpression:
|
||||||
|
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValue), File=self.InfFileName)
|
||||||
|
|
||||||
|
if Pcd.InfDefaultValue:
|
||||||
|
try:
|
||||||
|
Pcd.InfDefaultValue = ValueExpressionEx(Pcd.InfDefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
|
||||||
|
except BadExpression:
|
||||||
|
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue),File=self.InfFileName)
|
||||||
|
|
||||||
# Check value, if value are equal, no need to patch
|
# Check value, if value are equal, no need to patch
|
||||||
if Pcd.DatumType == "VOID*":
|
if Pcd.DatumType == "VOID*":
|
||||||
if Pcd.DefaultValue == DefaultValue or DefaultValue in [None, '']:
|
if Pcd.InfDefaultValue == DefaultValue or DefaultValue in [None, '']:
|
||||||
continue
|
continue
|
||||||
# Get the string size from FDF or DSC
|
# Get the string size from FDF or DSC
|
||||||
if DefaultValue[0] == 'L':
|
if DefaultValue[0] == 'L':
|
||||||
@@ -294,15 +312,15 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
Pcd.MaxDatumSize = PatchPcd.MaxDatumSize
|
Pcd.MaxDatumSize = PatchPcd.MaxDatumSize
|
||||||
# If no defined the maximum size in DSC, try to get current size from INF
|
# If no defined the maximum size in DSC, try to get current size from INF
|
||||||
if Pcd.MaxDatumSize in ['', None]:
|
if Pcd.MaxDatumSize in ['', None]:
|
||||||
Pcd.MaxDatumSize = str(len(Pcd.DefaultValue.split(',')))
|
Pcd.MaxDatumSize = str(len(Pcd.InfDefaultValue.split(',')))
|
||||||
else:
|
else:
|
||||||
Base1 = Base2 = 10
|
Base1 = Base2 = 10
|
||||||
if Pcd.DefaultValue.upper().startswith('0X'):
|
if Pcd.InfDefaultValue.upper().startswith('0X'):
|
||||||
Base1 = 16
|
Base1 = 16
|
||||||
if DefaultValue.upper().startswith('0X'):
|
if DefaultValue.upper().startswith('0X'):
|
||||||
Base2 = 16
|
Base2 = 16
|
||||||
try:
|
try:
|
||||||
PcdValueInImg = int(Pcd.DefaultValue, Base1)
|
PcdValueInImg = int(Pcd.InfDefaultValue, Base1)
|
||||||
PcdValueInDscOrFdf = int(DefaultValue, Base2)
|
PcdValueInDscOrFdf = int(DefaultValue, Base2)
|
||||||
if PcdValueInImg == PcdValueInDscOrFdf:
|
if PcdValueInImg == PcdValueInDscOrFdf:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# process FV generation
|
# process FV generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -179,7 +179,7 @@ class FV (FvClassObject):
|
|||||||
if FvChildAddr != []:
|
if FvChildAddr != []:
|
||||||
# Update Ffs again
|
# Update Ffs again
|
||||||
for FfsFile in self.FfsList :
|
for FfsFile in self.FfsList :
|
||||||
FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress, IsMakefile=Flag)
|
FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)
|
||||||
|
|
||||||
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
||||||
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# generate flash image
|
# generate flash image
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -38,8 +38,6 @@ from Common.Misc import DirCache, PathClass
|
|||||||
from Common.Misc import SaveFileOnChange
|
from Common.Misc import SaveFileOnChange
|
||||||
from Common.Misc import ClearDuplicatedInf
|
from Common.Misc import ClearDuplicatedInf
|
||||||
from Common.Misc import GuidStructureStringToGuidString
|
from Common.Misc import GuidStructureStringToGuidString
|
||||||
from Common.Misc import CheckPcdDatum
|
|
||||||
from Common.Misc import BuildOptionPcdValueFormat
|
|
||||||
from Common.BuildVersion import gBUILD_VERSION
|
from Common.BuildVersion import gBUILD_VERSION
|
||||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||||
import FfsFileStatement
|
import FfsFileStatement
|
||||||
@@ -144,6 +142,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
|
EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
|
||||||
|
|
||||||
|
GlobalData.BuildOptionPcd = Options.OptionPcd if Options.OptionPcd else {}
|
||||||
GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform))
|
GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform))
|
||||||
|
|
||||||
if (Options.ConfDirectory):
|
if (Options.ConfDirectory):
|
||||||
@@ -164,6 +163,8 @@ def main():
|
|||||||
# Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
|
# Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
|
||||||
ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
|
ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
|
||||||
GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
|
GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
|
||||||
|
if not GlobalData.gConfDirectory:
|
||||||
|
GlobalData.gConfDirectory = GenFdsGlobalVariable.ConfDir
|
||||||
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
|
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
|
||||||
if os.path.isfile(BuildConfigurationFile) == True:
|
if os.path.isfile(BuildConfigurationFile) == True:
|
||||||
TargetTxt = TargetTxtClassObject.TargetTxtClassObject()
|
TargetTxt = TargetTxtClassObject.TargetTxtClassObject()
|
||||||
@@ -302,9 +303,7 @@ def main():
|
|||||||
if ArchList != None:
|
if ArchList != None:
|
||||||
GenFdsGlobalVariable.ArchList = ArchList
|
GenFdsGlobalVariable.ArchList = ArchList
|
||||||
|
|
||||||
if Options.OptionPcd:
|
# Dsc Build Data will handle Pcd Settings from CommandLine.
|
||||||
GlobalData.BuildOptionPcd = Options.OptionPcd
|
|
||||||
CheckBuildOptionPcd()
|
|
||||||
|
|
||||||
"""Modify images from build output if the feature of loading driver at fixed address is on."""
|
"""Modify images from build output if the feature of loading driver at fixed address is on."""
|
||||||
if GenFdsGlobalVariable.FixedLoadAddress:
|
if GenFdsGlobalVariable.FixedLoadAddress:
|
||||||
@@ -368,53 +367,6 @@ def SingleCheckCallback(option, opt_str, value, parser):
|
|||||||
else:
|
else:
|
||||||
parser.error("Option %s only allows one instance in command line!" % option)
|
parser.error("Option %s only allows one instance in command line!" % option)
|
||||||
|
|
||||||
def CheckBuildOptionPcd():
|
|
||||||
for Arch in GenFdsGlobalVariable.ArchList:
|
|
||||||
PkgList = GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag)
|
|
||||||
for i, pcd in enumerate(GlobalData.BuildOptionPcd):
|
|
||||||
if type(pcd) is tuple:
|
|
||||||
continue
|
|
||||||
(pcdname, pcdvalue) = pcd.split('=')
|
|
||||||
if not pcdvalue:
|
|
||||||
EdkLogger.error('GenFds', OPTION_MISSING, "No Value specified for the PCD %s." % (pcdname))
|
|
||||||
if '.' in pcdname:
|
|
||||||
(TokenSpaceGuidCName, TokenCName) = pcdname.split('.')
|
|
||||||
HasTokenSpace = True
|
|
||||||
else:
|
|
||||||
TokenCName = pcdname
|
|
||||||
TokenSpaceGuidCName = ''
|
|
||||||
HasTokenSpace = False
|
|
||||||
TokenSpaceGuidCNameList = []
|
|
||||||
FoundFlag = False
|
|
||||||
PcdDatumType = ''
|
|
||||||
NewValue = ''
|
|
||||||
for package in PkgList:
|
|
||||||
for key in package.Pcds:
|
|
||||||
PcdItem = package.Pcds[key]
|
|
||||||
if HasTokenSpace:
|
|
||||||
if (PcdItem.TokenCName, PcdItem.TokenSpaceGuidCName) == (TokenCName, TokenSpaceGuidCName):
|
|
||||||
PcdDatumType = PcdItem.DatumType
|
|
||||||
NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
|
||||||
FoundFlag = True
|
|
||||||
else:
|
|
||||||
if PcdItem.TokenCName == TokenCName:
|
|
||||||
if not PcdItem.TokenSpaceGuidCName in TokenSpaceGuidCNameList:
|
|
||||||
if len (TokenSpaceGuidCNameList) < 1:
|
|
||||||
TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName)
|
|
||||||
PcdDatumType = PcdItem.DatumType
|
|
||||||
TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName
|
|
||||||
NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
|
||||||
FoundFlag = True
|
|
||||||
else:
|
|
||||||
EdkLogger.error(
|
|
||||||
'GenFds',
|
|
||||||
PCD_VALIDATION_INFO_ERROR,
|
|
||||||
"The Pcd %s is found under multiple different TokenSpaceGuid: %s and %s." % (TokenCName, PcdItem.TokenSpaceGuidCName, TokenSpaceGuidCNameList[0])
|
|
||||||
)
|
|
||||||
|
|
||||||
GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, NewValue)
|
|
||||||
|
|
||||||
|
|
||||||
## FindExtendTool()
|
## FindExtendTool()
|
||||||
#
|
#
|
||||||
# Find location of tools to process data
|
# Find location of tools to process data
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Global variables for GenFds
|
# Global variables for GenFds
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -500,7 +500,7 @@ class GenFdsGlobalVariable:
|
|||||||
if IsMakefile:
|
if IsMakefile:
|
||||||
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
|
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
|
||||||
elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input)):
|
elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
||||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
||||||
if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and
|
if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and
|
||||||
@@ -552,7 +552,7 @@ class GenFdsGlobalVariable:
|
|||||||
GenFdsGlobalVariable.SecCmdList = []
|
GenFdsGlobalVariable.SecCmdList = []
|
||||||
GenFdsGlobalVariable.CopyList = []
|
GenFdsGlobalVariable.CopyList = []
|
||||||
else:
|
else:
|
||||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input)):
|
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
||||||
return
|
return
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
|||||||
Index = 0
|
Index = 0
|
||||||
try:
|
try:
|
||||||
for ByteString in ValueList:
|
for ByteString in ValueList:
|
||||||
|
ByteString = ByteString.strip()
|
||||||
if ByteString.upper().startswith('0X'):
|
if ByteString.upper().startswith('0X'):
|
||||||
ByteValue = int(ByteString, 16)
|
ByteValue = int(ByteString, 16)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf}}
|
# {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf}}
|
||||||
# This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
|
# This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -176,7 +176,7 @@ if __name__ == '__main__':
|
|||||||
#
|
#
|
||||||
# Sign the input file using the specified private key and capture signature from STDOUT
|
# Sign the input file using the specified private key and capture signature from STDOUT
|
||||||
#
|
#
|
||||||
Process = subprocess.Popen('%s sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s dgst -sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
Signature = Process.communicate(input=FullInputFileBuffer)[0]
|
Signature = Process.communicate(input=FullInputFileBuffer)[0]
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
@@ -225,7 +225,7 @@ if __name__ == '__main__':
|
|||||||
#
|
#
|
||||||
# Verify signature
|
# Verify signature
|
||||||
#
|
#
|
||||||
Process = subprocess.Popen('%s sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
Process.communicate(input=FullInputFileBuffer)
|
Process.communicate(input=FullInputFileBuffer)
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Verification failed'
|
print 'ERROR: Verification failed'
|
||||||
|
|||||||
@@ -65,8 +65,10 @@ class PcdClassObject(object):
|
|||||||
self.validlists = validlists
|
self.validlists = validlists
|
||||||
self.expressions = expressions
|
self.expressions = expressions
|
||||||
self.DscDefaultValue = None
|
self.DscDefaultValue = None
|
||||||
|
self.DscRawValue = None
|
||||||
if IsDsc:
|
if IsDsc:
|
||||||
self.DscDefaultValue = Value
|
self.DscDefaultValue = Value
|
||||||
|
self.PcdValueFromComm = ""
|
||||||
|
|
||||||
## Convert the class to a string
|
## Convert the class to a string
|
||||||
#
|
#
|
||||||
@@ -109,9 +111,14 @@ class PcdClassObject(object):
|
|||||||
return hash((self.TokenCName, self.TokenSpaceGuidCName))
|
return hash((self.TokenCName, self.TokenSpaceGuidCName))
|
||||||
|
|
||||||
class StructurePcd(PcdClassObject):
|
class StructurePcd(PcdClassObject):
|
||||||
def __init__(self, StructuredPcdIncludeFile="", Packages=None, Name=None, Guid=None, Type=None, DatumType=None, Value=None, Token=None, MaxDatumSize=None, SkuInfoList={}, IsOverrided=False, GuidValue=None, validateranges=[], validlists=[], expressions=[],default_store = TAB_DEFAULT_STORES_DEFAULT):
|
def __init__(self, StructuredPcdIncludeFile=None, Packages=None, Name=None, Guid=None, Type=None, DatumType=None, Value=None, Token=None, MaxDatumSize=None, SkuInfoList=None, IsOverrided=False, GuidValue=None, validateranges=None, validlists=None, expressions=None,default_store = TAB_DEFAULT_STORES_DEFAULT):
|
||||||
|
if SkuInfoList is None: SkuInfoList={}
|
||||||
|
if validateranges is None: validateranges=[]
|
||||||
|
if validlists is None: validlists=[]
|
||||||
|
if expressions is None : expressions=[]
|
||||||
|
if Packages is None : Packages = []
|
||||||
super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
|
super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
|
||||||
self.StructuredPcdIncludeFile = StructuredPcdIncludeFile
|
self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None else StructuredPcdIncludeFile
|
||||||
self.PackageDecs = Packages
|
self.PackageDecs = Packages
|
||||||
self.DefaultStoreName = [default_store]
|
self.DefaultStoreName = [default_store]
|
||||||
self.DefaultValues = collections.OrderedDict({})
|
self.DefaultValues = collections.OrderedDict({})
|
||||||
@@ -119,6 +126,11 @@ class StructurePcd(PcdClassObject):
|
|||||||
self.SkuOverrideValues = collections.OrderedDict({})
|
self.SkuOverrideValues = collections.OrderedDict({})
|
||||||
self.FlexibleFieldName = None
|
self.FlexibleFieldName = None
|
||||||
self.StructName = None
|
self.StructName = None
|
||||||
|
self.PcdDefineLineNo = 0
|
||||||
|
self.PkgPath = ""
|
||||||
|
self.DefaultValueFromDec = ""
|
||||||
|
self.ValueChain = dict()
|
||||||
|
self.PcdFieldValueFromComm = collections.OrderedDict({})
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.TypeName
|
return self.TypeName
|
||||||
|
|
||||||
@@ -128,6 +140,8 @@ class StructurePcd(PcdClassObject):
|
|||||||
self.DefaultValues[FieldName] = [Value.strip(), FileName, LineNo]
|
self.DefaultValues[FieldName] = [Value.strip(), FileName, LineNo]
|
||||||
return self.DefaultValues[FieldName]
|
return self.DefaultValues[FieldName]
|
||||||
|
|
||||||
|
def SetDecDefaultValue(self,DefaultValue):
|
||||||
|
self.DefaultValueFromDec = DefaultValue
|
||||||
def AddOverrideValue (self, FieldName, Value, SkuName, DefaultStoreName, FileName="", LineNo=0):
|
def AddOverrideValue (self, FieldName, Value, SkuName, DefaultStoreName, FileName="", LineNo=0):
|
||||||
if SkuName not in self.SkuOverrideValues:
|
if SkuName not in self.SkuOverrideValues:
|
||||||
self.SkuOverrideValues[SkuName] = collections.OrderedDict({})
|
self.SkuOverrideValues[SkuName] = collections.OrderedDict({})
|
||||||
@@ -162,15 +176,22 @@ class StructurePcd(PcdClassObject):
|
|||||||
self.validateranges = PcdObject.validateranges if PcdObject.validateranges else self.validateranges
|
self.validateranges = PcdObject.validateranges if PcdObject.validateranges else self.validateranges
|
||||||
self.validlists = PcdObject.validlists if PcdObject.validlists else self.validlists
|
self.validlists = PcdObject.validlists if PcdObject.validlists else self.validlists
|
||||||
self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions
|
self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions
|
||||||
|
self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else self.DscRawValue
|
||||||
|
self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm
|
||||||
if type(PcdObject) is StructurePcd:
|
if type(PcdObject) is StructurePcd:
|
||||||
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
|
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
|
||||||
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
|
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
|
||||||
self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues
|
self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues
|
||||||
self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
|
self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
|
||||||
self.DefaultFromDSC=None
|
self.DefaultFromDSC=None
|
||||||
|
self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if PcdObject.DefaultValueFromDec else self.DefaultValueFromDec
|
||||||
self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
|
self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
|
||||||
self.FlexibleFieldName = PcdObject.FlexibleFieldName if PcdObject.FlexibleFieldName else self.FlexibleFieldName
|
self.FlexibleFieldName = PcdObject.FlexibleFieldName if PcdObject.FlexibleFieldName else self.FlexibleFieldName
|
||||||
self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
|
self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
|
||||||
|
self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
|
||||||
|
self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else self.PkgPath
|
||||||
|
self.ValueChain = PcdObject.ValueChain if PcdObject.ValueChain else self.ValueChain
|
||||||
|
self.PcdFieldValueFromComm = PcdObject.PcdFieldValueFromComm if PcdObject.PcdFieldValueFromComm else self.PcdFieldValueFromComm
|
||||||
|
|
||||||
## LibraryClassObject
|
## LibraryClassObject
|
||||||
#
|
#
|
||||||
@@ -437,4 +458,3 @@ class PlatformBuildClassObject(object):
|
|||||||
#
|
#
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash(self.MetaFile)
|
return hash(self.MetaFile)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file is used to create a database used by build tool
|
# This file is used to create a database used by build tool
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@@ -15,6 +15,7 @@ from Common.String import *
|
|||||||
from Common.DataType import *
|
from Common.DataType import *
|
||||||
from Common.Misc import *
|
from Common.Misc import *
|
||||||
from types import *
|
from types import *
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject
|
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject
|
||||||
|
|
||||||
@@ -95,6 +96,7 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
self._Ppis = None
|
self._Ppis = None
|
||||||
self._Guids = None
|
self._Guids = None
|
||||||
self._Includes = None
|
self._Includes = None
|
||||||
|
self._CommonIncludes = None
|
||||||
self._LibraryClasses = None
|
self._LibraryClasses = None
|
||||||
self._Pcds = None
|
self._Pcds = None
|
||||||
self.__Macros = None
|
self.__Macros = None
|
||||||
@@ -296,7 +298,8 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
|
|
||||||
## Retrieve public include paths declared in this package
|
## Retrieve public include paths declared in this package
|
||||||
def _GetInclude(self):
|
def _GetInclude(self):
|
||||||
if self._Includes == None:
|
if self._Includes == None or self._CommonIncludes is None:
|
||||||
|
self._CommonIncludes = []
|
||||||
self._Includes = []
|
self._Includes = []
|
||||||
self._PrivateIncludes = []
|
self._PrivateIncludes = []
|
||||||
PublicInclues = []
|
PublicInclues = []
|
||||||
@@ -324,7 +327,8 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
PublicInclues.append(File)
|
PublicInclues.append(File)
|
||||||
if File in self._PrivateIncludes:
|
if File in self._PrivateIncludes:
|
||||||
EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)
|
EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)
|
||||||
|
if Record[3] == "COMMON":
|
||||||
|
self._CommonIncludes.append(File)
|
||||||
return self._Includes
|
return self._Includes
|
||||||
|
|
||||||
## Retrieve library class declarations (not used in build at present)
|
## Retrieve library class declarations (not used in build at present)
|
||||||
@@ -364,7 +368,7 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
|
|
||||||
|
|
||||||
def ProcessStructurePcd(self, StructurePcdRawDataSet):
|
def ProcessStructurePcd(self, StructurePcdRawDataSet):
|
||||||
s_pcd_set = dict()
|
s_pcd_set = OrderedDict()
|
||||||
for s_pcd,LineNo in StructurePcdRawDataSet:
|
for s_pcd,LineNo in StructurePcdRawDataSet:
|
||||||
if s_pcd.TokenSpaceGuidCName not in s_pcd_set:
|
if s_pcd.TokenSpaceGuidCName not in s_pcd_set:
|
||||||
s_pcd_set[s_pcd.TokenSpaceGuidCName] = []
|
s_pcd_set[s_pcd.TokenSpaceGuidCName] = []
|
||||||
@@ -376,17 +380,22 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
struct_pcd = StructurePcd()
|
struct_pcd = StructurePcd()
|
||||||
for item,LineNo in s_pcd_set[pcdname]:
|
for item,LineNo in s_pcd_set[pcdname]:
|
||||||
if "<HeaderFiles>" in item.TokenCName:
|
if "<HeaderFiles>" in item.TokenCName:
|
||||||
struct_pcd.StructuredPcdIncludeFile = item.DefaultValue
|
struct_pcd.StructuredPcdIncludeFile.append(item.DefaultValue)
|
||||||
elif "<Packages>" in item.TokenCName:
|
elif "<Packages>" in item.TokenCName:
|
||||||
dep_pkgs.append(item.DefaultValue)
|
dep_pkgs.append(item.DefaultValue)
|
||||||
elif item.DatumType == item.TokenCName:
|
elif item.DatumType == item.TokenCName:
|
||||||
struct_pcd.copy(item)
|
struct_pcd.copy(item)
|
||||||
struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()
|
struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()
|
||||||
struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")
|
struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")
|
||||||
|
struct_pcd.PcdDefineLineNo = LineNo
|
||||||
|
struct_pcd.PkgPath = self.MetaFile.File
|
||||||
|
struct_pcd.SetDecDefaultValue(item.DefaultValue)
|
||||||
else:
|
else:
|
||||||
struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue,self.MetaFile.File,LineNo)
|
struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue,self.MetaFile.File,LineNo)
|
||||||
|
|
||||||
struct_pcd.PackageDecs = dep_pkgs
|
struct_pcd.PackageDecs = dep_pkgs
|
||||||
|
if not struct_pcd.StructuredPcdIncludeFile:
|
||||||
|
EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName,self.MetaFile.File,LineNo ))
|
||||||
|
|
||||||
str_pcd_set.append(struct_pcd)
|
str_pcd_set.append(struct_pcd)
|
||||||
|
|
||||||
@@ -447,6 +456,11 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd
|
Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd
|
||||||
|
|
||||||
return Pcds
|
return Pcds
|
||||||
|
@property
|
||||||
|
def CommonIncludes(self):
|
||||||
|
if self._CommonIncludes is None:
|
||||||
|
self.Includes
|
||||||
|
return self._CommonIncludes
|
||||||
|
|
||||||
|
|
||||||
_Macros = property(_GetMacros)
|
_Macros = property(_GetMacros)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user