diff --git a/.gitignore b/.gitignore
index 2939e0dfe82..b76cbf2375b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,3 +87,4 @@ Utilities/TestProcessKernel/OC/*
Utilities/TestProcessKernel/ProcessKernel
Utilities/TestNtfsDxe/TestNtfsDxe
Utilities/TestExt4Dxe/TestExt4Dxe
+Utilities/TestFatDxe/TestFatDxe
diff --git a/AppleModels/DataBase/MacBook/MB81.yaml b/AppleModels/DataBase/MacBook/MB81.yaml
index 9ed22c4f972..ab25672910f 100644
--- a/AppleModels/DataBase/MacBook/MB81.yaml
+++ b/AppleModels/DataBase/MacBook/MB81.yaml
@@ -163,4 +163,4 @@ AppleModelYear:
- 2015
- 2016
MinimumOSVersion: "10.10.2"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/MacBook/MB91.yaml b/AppleModels/DataBase/MacBook/MB91.yaml
index 486a955d3e7..0200d148e3d 100644
--- a/AppleModels/DataBase/MacBook/MB91.yaml
+++ b/AppleModels/DataBase/MacBook/MB91.yaml
@@ -173,4 +173,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.11.4"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookAir/MBA61.yaml b/AppleModels/DataBase/MacBookAir/MBA61.yaml
index 890626ea1ef..93adf462f71 100644
--- a/AppleModels/DataBase/MacBookAir/MBA61.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA61.yaml
@@ -176,4 +176,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.9.2"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/MacBookAir/MBA62.yaml b/AppleModels/DataBase/MacBookAir/MBA62.yaml
index 02f6835a162..7d7ff745db7 100644
--- a/AppleModels/DataBase/MacBookAir/MBA62.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA62.yaml
@@ -186,4 +186,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.9.2"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/MacBookAir/MBA71.yaml b/AppleModels/DataBase/MacBookAir/MBA71.yaml
index 22fe2342e0c..79c7c5a2bd7 100644
--- a/AppleModels/DataBase/MacBookAir/MBA71.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA71.yaml
@@ -133,4 +133,4 @@ AppleModelYear:
- 2015
- 2016
MinimumOSVersion: "10.10.2"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookAir/MBA72.yaml b/AppleModels/DataBase/MacBookAir/MBA72.yaml
index dde849f2c99..22bd19a3a30 100644
--- a/AppleModels/DataBase/MacBookAir/MBA72.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA72.yaml
@@ -174,4 +174,4 @@ AppleModelYear:
- 2018
- 2019
MinimumOSVersion: "10.12.5"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookAir/MBA81.yaml b/AppleModels/DataBase/MacBookAir/MBA81.yaml
index a36546310a1..6f6ddca21d1 100644
--- a/AppleModels/DataBase/MacBookAir/MBA81.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA81.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBA81.88Z.F000.B00.2211301949"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBA81.88Z.F000.B00.2212212025"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookAir8,1"
SystemVersion: "1.0"
@@ -48,17 +48,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBA81.88Z.F000.B00.2211301949
+ BIOS ID: MBA81.88Z.F000.B00.2212212025
Model: MBA81
- EFI Version: 1916.60.2.0.0
- Built by: root@sd8ls
- Date: Wed Nov 30 19:49:39 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@tlllb
+ Date: Wed Dec 21 20:25:17 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 16A72B1E-415E-36C4-8AE1-3EBE6BF7A692
- UUID: 5AA856E1-3428-3871-B531-9B2CB84B753B
+ UUID: 7F22F10B-0563-32CA-B4EC-DF1B07B51DBF
+ UUID: AFFCADFA-FE76-3B4C-A1FC-1B98FBAACEE1
Specifications:
CPUCodename:
- "Amber Lake Y"
diff --git a/AppleModels/DataBase/MacBookAir/MBA82.yaml b/AppleModels/DataBase/MacBookAir/MBA82.yaml
index 31a487b5434..d338b7802ee 100644
--- a/AppleModels/DataBase/MacBookAir/MBA82.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA82.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBA82.88Z.F000.B00.2211301948"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBA82.88Z.F000.B00.2212212024"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookAir8,2"
SystemVersion: "1.0"
@@ -48,17 +48,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBA82.88Z.F000.B00.2211301948
+ BIOS ID: MBA82.88Z.F000.B00.2212212024
Model: MBA82
- EFI Version: 1916.60.2.0.0
- Built by: root@pc9x5
- Date: Wed Nov 30 19:48:32 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@vmcfr
+ Date: Wed Dec 21 20:24:37 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 16A72B1E-415E-36C4-8AE1-3EBE6BF7A692
- UUID: 8062D728-6DB5-37E0-9648-0F964566C00F
+ UUID: 7F22F10B-0563-32CA-B4EC-DF1B07B51DBF
+ UUID: 9C9AB476-62A7-38EF-B996-3914305FB0AA
Specifications:
CPUCodename:
- "Amber Lake Y"
diff --git a/AppleModels/DataBase/MacBookAir/MBA91.yaml b/AppleModels/DataBase/MacBookAir/MBA91.yaml
index 8e4235bdc34..def73c5b057 100644
--- a/AppleModels/DataBase/MacBookAir/MBA91.yaml
+++ b/AppleModels/DataBase/MacBookAir/MBA91.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBA91.88Z.F000.B00.2211302013"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBA91.88Z.F000.B00.2212212038"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookAir9,1"
SystemVersion: "1.0"
@@ -43,17 +43,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBA91.88Z.F000.B00.2211302013
+ BIOS ID: MBA91.88Z.F000.B00.2212212038
Model: MBA91
- EFI Version: 1916.60.2.0.0
- Built by: root@f6nrh
- Date: Wed Nov 30 20:13:45 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@87fdg
+ Date: Wed Dec 21 20:38:35 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 18EB1565-EA3F-34B7-A656-1B19BA6EAAEF
- UUID: 7088F371-2E1B-3C41-99C7-548B52D7DEC1
+ UUID: 5C72DAD7-5D51-3E5A-BA16-E9F832E90452
+ UUID: 78D2D151-4CA7-338A-8310-C0B4D69FBE09
Specifications:
CPUCodename:
- "Ice Lake Y"
diff --git a/AppleModels/DataBase/MacBookPro/MBP111.yaml b/AppleModels/DataBase/MacBookPro/MBP111.yaml
index b89a05453df..d3a861aced8 100755
--- a/AppleModels/DataBase/MacBookPro/MBP111.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP111.yaml
@@ -214,4 +214,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.9.4"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/MacBookPro/MBP112.yaml b/AppleModels/DataBase/MacBookPro/MBP112.yaml
index 2bcb0b4319f..e47afb38329 100644
--- a/AppleModels/DataBase/MacBookPro/MBP112.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP112.yaml
@@ -167,4 +167,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.9.4"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/MacBookPro/MBP113.yaml b/AppleModels/DataBase/MacBookPro/MBP113.yaml
index ddbf321ba8f..6de82d25912 100644
--- a/AppleModels/DataBase/MacBookPro/MBP113.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP113.yaml
@@ -156,4 +156,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.9.4"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/MacBookPro/MBP114.yaml b/AppleModels/DataBase/MacBookPro/MBP114.yaml
index 7931d2f2056..042e7823d77 100644
--- a/AppleModels/DataBase/MacBookPro/MBP114.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP114.yaml
@@ -135,4 +135,4 @@ AppleModelYear:
- 2017
- 2018
MinimumOSVersion: "10.10.3"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookPro/MBP115.yaml b/AppleModels/DataBase/MacBookPro/MBP115.yaml
index 5db04a73a60..096b5a0f707 100644
--- a/AppleModels/DataBase/MacBookPro/MBP115.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP115.yaml
@@ -126,4 +126,4 @@ AppleModelYear:
- 2017
- 2018
MinimumOSVersion: "10.10.3"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookPro/MBP121.yaml b/AppleModels/DataBase/MacBookPro/MBP121.yaml
index e4a420263eb..5990faae84b 100644
--- a/AppleModels/DataBase/MacBookPro/MBP121.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP121.yaml
@@ -150,4 +150,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.10.2"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookPro/MBP131.yaml b/AppleModels/DataBase/MacBookPro/MBP131.yaml
index 2eca77fe8d1..02f61eae16f 100644
--- a/AppleModels/DataBase/MacBookPro/MBP131.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP131.yaml
@@ -130,4 +130,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.12"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookPro/MBP132.yaml b/AppleModels/DataBase/MacBookPro/MBP132.yaml
index b69b2476f7b..44f8b6509b4 100644
--- a/AppleModels/DataBase/MacBookPro/MBP132.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP132.yaml
@@ -192,4 +192,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.12.1"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookPro/MBP133.yaml b/AppleModels/DataBase/MacBookPro/MBP133.yaml
index 9362868b57a..7565f067b4e 100644
--- a/AppleModels/DataBase/MacBookPro/MBP133.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP133.yaml
@@ -154,4 +154,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.12.1"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacBookPro/MBP151.yaml b/AppleModels/DataBase/MacBookPro/MBP151.yaml
index a7f6516152d..0d03e1378f9 100644
--- a/AppleModels/DataBase/MacBookPro/MBP151.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP151.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP151.88Z.F000.B00.2211301948"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP151.88Z.F000.B00.2212212026"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro15,1"
SystemVersion: "1.0"
@@ -50,17 +50,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP151.88Z.F000.B00.2211301948
+ BIOS ID: MBP151.88Z.F000.B00.2212212026
Model: MBP151
- EFI Version: 1916.60.2.0.0
- Built by: root@lgqdw
- Date: Wed Nov 30 19:48:54 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@n2b28
+ Date: Wed Dec 21 20:26:07 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: 31C8A456-EC14-38B4-A055-CD6108318684
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 1AB777A1-9529-3BBC-8C5A-2BBDC3D66275
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacBookPro/MBP152.yaml b/AppleModels/DataBase/MacBookPro/MBP152.yaml
index c19ab0d777a..8dc4a0a4745 100644
--- a/AppleModels/DataBase/MacBookPro/MBP152.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP152.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP152.88Z.F000.B00.2211301948"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP152.88Z.F000.B00.2212212026"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro15,2"
SystemVersion: "1.0"
@@ -55,17 +55,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP152.88Z.F000.B00.2211301948
+ BIOS ID: MBP152.88Z.F000.B00.2212212026
Model: MBP152
- EFI Version: 1916.60.2.0.0
- Built by: root@pv6f5
- Date: Wed Nov 30 19:48:53 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@w28rs
+ Date: Wed Dec 21 20:26:00 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: 31C8A456-EC14-38B4-A055-CD6108318684
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 77AA8272-679F-3D81-92E4-C15E4F026753
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacBookPro/MBP153.yaml b/AppleModels/DataBase/MacBookPro/MBP153.yaml
index bc1c0b80970..910e816fc48 100644
--- a/AppleModels/DataBase/MacBookPro/MBP153.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP153.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP153.88Z.F000.B00.2211301949"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP153.88Z.F000.B00.2212212025"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro15,3"
SystemVersion: "1.0"
@@ -55,17 +55,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP153.88Z.F000.B00.2211301949
+ BIOS ID: MBP153.88Z.F000.B00.2212212025
Model: MBP153
- EFI Version: 1916.60.2.0.0
- Built by: root@66zkt
- Date: Wed Nov 30 19:49:34 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@vhbqt
+ Date: Wed Dec 21 20:25:44 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: A9C7BF39-B001-3BFE-95AF-878FC9CB23B0
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 1AB777A1-9529-3BBC-8C5A-2BBDC3D66275
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacBookPro/MBP154.yaml b/AppleModels/DataBase/MacBookPro/MBP154.yaml
index c6814a3e4d9..fa795633da6 100644
--- a/AppleModels/DataBase/MacBookPro/MBP154.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP154.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP154.88Z.F000.B00.2211302003"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP154.88Z.F000.B00.2212212035"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro15,4"
SystemVersion: "1.0"
@@ -55,17 +55,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP154.88Z.F000.B00.2211302003
+ BIOS ID: MBP154.88Z.F000.B00.2212212035
Model: MBP154
- EFI Version: 1916.60.2.0.0
- Built by: root@cnz7h
- Date: Wed Nov 30 20:03:31 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@jgrc7
+ Date: Wed Dec 21 20:35:51 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: 31C8A456-EC14-38B4-A055-CD6108318684
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 77AA8272-679F-3D81-92E4-C15E4F026753
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacBookPro/MBP161.yaml b/AppleModels/DataBase/MacBookPro/MBP161.yaml
index a56da71aae8..a1c0a3be4f2 100644
--- a/AppleModels/DataBase/MacBookPro/MBP161.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP161.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP161.88Z.F000.B00.2211302003"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP161.88Z.F000.B00.2212212036"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro16,1"
SystemVersion: "1.0"
@@ -49,17 +49,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP161.88Z.F000.B00.2211302003
+ BIOS ID: MBP161.88Z.F000.B00.2212212036
Model: MBP161
- EFI Version: 1916.60.2.0.0
- Built by: root@zch2f
- Date: Wed Nov 30 20:03:28 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@xsv6g
+ Date: Wed Dec 21 20:36:09 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: 31C8A456-EC14-38B4-A055-CD6108318684
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 1AB777A1-9529-3BBC-8C5A-2BBDC3D66275
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacBookPro/MBP162.yaml b/AppleModels/DataBase/MacBookPro/MBP162.yaml
index 899e762ab97..ccb431d6e27 100644
--- a/AppleModels/DataBase/MacBookPro/MBP162.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP162.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP162.88Z.F000.B00.2211302002"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP162.88Z.F000.B00.2212212042"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro16,2"
SystemVersion: "1.0"
@@ -43,17 +43,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP162.88Z.F000.B00.2211302002
+ BIOS ID: MBP162.88Z.F000.B00.2212212042
Model: MBP162
- EFI Version: 1916.60.2.0.0
- Built by: root@jh684
- Date: Wed Nov 30 20:02:54 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@22c8q
+ Date: Wed Dec 21 20:42:37 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 18EB1565-EA3F-34B7-A656-1B19BA6EAAEF
- UUID: ADCE8C72-77B9-3075-8CCB-0C6AAC4F046E
+ UUID: 5C72DAD7-5D51-3E5A-BA16-E9F832E90452
+ UUID: 20C66F45-30AD-3C91-BD09-1930312DDBF8
Specifications:
CPUCodename:
- "Ice Lake U"
diff --git a/AppleModels/DataBase/MacBookPro/MBP163.yaml b/AppleModels/DataBase/MacBookPro/MBP163.yaml
index 421bd3606ad..1beeee59808 100644
--- a/AppleModels/DataBase/MacBookPro/MBP163.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP163.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP163.88Z.F000.B00.2211302002"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP163.88Z.F000.B00.2212212042"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro16,3"
SystemVersion: "1.0"
@@ -45,17 +45,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP163.88Z.F000.B00.2211302002
+ BIOS ID: MBP163.88Z.F000.B00.2212212042
Model: MBP163
- EFI Version: 1916.60.2.0.0
- Built by: root@56mxt
- Date: Wed Nov 30 20:02:41 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@9lwsz
+ Date: Wed Dec 21 20:42:08 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: A9C7BF39-B001-3BFE-95AF-878FC9CB23B0
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 1AB777A1-9529-3BBC-8C5A-2BBDC3D66275
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacBookPro/MBP164.yaml b/AppleModels/DataBase/MacBookPro/MBP164.yaml
index e7261aa4751..f72f780ab77 100644
--- a/AppleModels/DataBase/MacBookPro/MBP164.yaml
+++ b/AppleModels/DataBase/MacBookPro/MBP164.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MBP164.88Z.F000.B00.2211302004"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MBP164.88Z.F000.B00.2212212036"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacBookPro16,4"
SystemVersion: "1.0"
@@ -49,17 +49,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MBP164.88Z.F000.B00.2211302004
+ BIOS ID: MBP164.88Z.F000.B00.2212212036
Model: MBP164
- EFI Version: 1916.60.2.0.0
- Built by: root@p842r
- Date: Wed Nov 30 20:04:37 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@4qq5j
+ Date: Wed Dec 21 20:36:01 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: 31C8A456-EC14-38B4-A055-CD6108318684
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 77AA8272-679F-3D81-92E4-C15E4F026753
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/MacPro/MP61.yaml b/AppleModels/DataBase/MacPro/MP61.yaml
index 7cfb21a1d6d..0d815b6d304 100755
--- a/AppleModels/DataBase/MacPro/MP61.yaml
+++ b/AppleModels/DataBase/MacPro/MP61.yaml
@@ -154,4 +154,4 @@ AppleModelYear:
- 2018
- 2019
MinimumOSVersion: "10.9.1"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/MacPro/MP71.yaml b/AppleModels/DataBase/MacPro/MP71.yaml
index fbe4fb73124..8c64b8144de 100644
--- a/AppleModels/DataBase/MacPro/MP71.yaml
+++ b/AppleModels/DataBase/MacPro/MP71.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MP71.88Z.F000.B00.2211301949"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MP71.88Z.F000.B00.2212212025"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "MacPro7,1"
SystemVersion: "1.0"
@@ -50,17 +50,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MP71.88Z.F000.B00.2211301949
+ BIOS ID: MP71.88Z.F000.B00.2212212025
Model: MP71
- EFI Version: 1916.60.2.0.0
- Built by: root@l64zd
- Date: Wed Nov 30 19:49:22 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@jb5mr
+ Date: Wed Dec 21 20:25:08 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: C49A9121-F3F4-3DC8-B2D8-7329CC97413F
- UUID: 680F73FE-A4DB-3D48-B3C5-0E4DA6633A95
+ UUID: 5124C077-0B8E-3103-8CA6-A21659A4DBA2
+ UUID: 71561312-946A-391C-A263-FF4EE198E240
Specifications:
CPUCodename:
- "Cascade Lake"
@@ -72,6 +72,7 @@ Specifications:
- "Radeon Pro W5700X"
- "Radeon Pro Vega II"
- "Radeon Pro Vega II Duo"
+ - "Radeon Pro W6600X"
- "Radeon Pro W6800X"
- "Radeon Pro W6900X"
- "Radeon Pro W6800X Duo"
diff --git a/AppleModels/DataBase/Macmini/MM71.yaml b/AppleModels/DataBase/Macmini/MM71.yaml
index a22d83e8981..0d9b7b1ac48 100644
--- a/AppleModels/DataBase/Macmini/MM71.yaml
+++ b/AppleModels/DataBase/Macmini/MM71.yaml
@@ -160,4 +160,4 @@ AppleModelYear:
- 2017
- 2018
MinimumOSVersion: "10.10"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/Macmini/MM81.yaml b/AppleModels/DataBase/Macmini/MM81.yaml
index b41bbd8780c..6cb461f07a9 100644
--- a/AppleModels/DataBase/Macmini/MM81.yaml
+++ b/AppleModels/DataBase/Macmini/MM81.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "MM81.88Z.F000.B00.2211301948"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "MM81.88Z.F000.B00.2212212026"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "Macmini8,1"
SystemVersion: "1.0"
@@ -48,17 +48,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: MM81.88Z.F000.B00.2211301948
+ BIOS ID: MM81.88Z.F000.B00.2212212026
Model: MM81
- EFI Version: 1916.60.2.0.0
- Built by: root@bj85s
- Date: Wed Nov 30 19:48:44 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@qbhp8
+ Date: Wed Dec 21 20:26:05 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: 4C3B2409-DF13-36D3-A651-0977BB85ACEC
- UUID: 31C8A456-EC14-38B4-A055-CD6108318684
+ UUID: E540C872-5FF1-3B2D-8F1D-384DEA3C2799
+ UUID: 1AB777A1-9529-3BBC-8C5A-2BBDC3D66275
Specifications:
CPUCodename:
- "Coffee Lake"
diff --git a/AppleModels/DataBase/iMac/IM144.yaml b/AppleModels/DataBase/iMac/IM144.yaml
index a2fabf462da..48a9c91fd21 100644
--- a/AppleModels/DataBase/iMac/IM144.yaml
+++ b/AppleModels/DataBase/iMac/IM144.yaml
@@ -119,4 +119,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.9.3"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/iMac/IM151.yaml b/AppleModels/DataBase/iMac/IM151.yaml
index 51e3c0ed03d..3e60d931099 100644
--- a/AppleModels/DataBase/iMac/IM151.yaml
+++ b/AppleModels/DataBase/iMac/IM151.yaml
@@ -152,4 +152,4 @@ AppleModelYear:
- 2014
- 2015
MinimumOSVersion: "10.10.2"
-MaximumOSVersion: "11.7.2"
+MaximumOSVersion: "11.7.4"
diff --git a/AppleModels/DataBase/iMac/IM161.yaml b/AppleModels/DataBase/iMac/IM161.yaml
index 4cd8f65ca43..cadf00fcdde 100644
--- a/AppleModels/DataBase/iMac/IM161.yaml
+++ b/AppleModels/DataBase/iMac/IM161.yaml
@@ -184,4 +184,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.11"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/iMac/IM162.yaml b/AppleModels/DataBase/iMac/IM162.yaml
index f2dd396e13a..ad51d6a97c1 100644
--- a/AppleModels/DataBase/iMac/IM162.yaml
+++ b/AppleModels/DataBase/iMac/IM162.yaml
@@ -155,4 +155,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.11"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/iMac/IM171.yaml b/AppleModels/DataBase/iMac/IM171.yaml
index 3a70cc5863f..d8a7ebda6db 100644
--- a/AppleModels/DataBase/iMac/IM171.yaml
+++ b/AppleModels/DataBase/iMac/IM171.yaml
@@ -180,4 +180,4 @@ AppleModelYear:
- 2016
- 2017
MinimumOSVersion: "10.11"
-MaximumOSVersion: "12.6.2"
+MaximumOSVersion: "12.6.3"
diff --git a/AppleModels/DataBase/iMac/IM201.yaml b/AppleModels/DataBase/iMac/IM201.yaml
index 73f7e1e6bbd..ff56e952a9a 100644
--- a/AppleModels/DataBase/iMac/IM201.yaml
+++ b/AppleModels/DataBase/iMac/IM201.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "IM201.88Z.F000.B00.2211302005"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "IM201.88Z.F000.B00.2212212040"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "iMac20,1"
SystemVersion: "1.0"
@@ -48,17 +48,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: IM201.88Z.F000.B00.2211302005
+ BIOS ID: IM201.88Z.F000.B00.2212212040
Model: IM201
- EFI Version: 1916.60.2.0.0
- Built by: root@rzjfh
- Date: Wed Nov 30 20:05:31 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@kz46n
+ Date: Wed Dec 21 20:40:47 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: C73841A7-C034-32D3-9D59-5A2703273EA3
- UUID: ED566917-09B8-3866-98CA-E1FBDF3AAB10
+ UUID: 8D2F07FA-B3B1-3EE5-9439-F3DCC361D7CA
+ UUID: D8569C5E-2B81-3D2F-B657-CBEB5D03D9E2
Specifications:
CPUCodename:
- "Comet Lake"
diff --git a/AppleModels/DataBase/iMac/IM202.yaml b/AppleModels/DataBase/iMac/IM202.yaml
index e679b52e0b5..5810fe1ed39 100644
--- a/AppleModels/DataBase/iMac/IM202.yaml
+++ b/AppleModels/DataBase/iMac/IM202.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "IM201.88Z.F000.B00.2211302005"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "IM201.88Z.F000.B00.2212212040"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "iMac20,2"
SystemVersion: "1.0"
@@ -53,17 +53,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: IM201.88Z.F000.B00.2211302005
+ BIOS ID: IM201.88Z.F000.B00.2212212040
Model: IM201
- EFI Version: 1916.60.2.0.0
- Built by: root@rzjfh
- Date: Wed Nov 30 20:05:31 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@kz46n
+ Date: Wed Dec 21 20:40:47 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: C73841A7-C034-32D3-9D59-5A2703273EA3
- UUID: ED566917-09B8-3866-98CA-E1FBDF3AAB10
+ UUID: 8D2F07FA-B3B1-3EE5-9439-F3DCC361D7CA
+ UUID: D8569C5E-2B81-3D2F-B657-CBEB5D03D9E2
Specifications:
CPUCodename:
- "Comet Lake"
diff --git a/AppleModels/DataBase/iMacPro/IMP11.yaml b/AppleModels/DataBase/iMacPro/IMP11.yaml
index 9bc12ab7629..fab5f4bedd7 100644
--- a/AppleModels/DataBase/iMacPro/IMP11.yaml
+++ b/AppleModels/DataBase/iMacPro/IMP11.yaml
@@ -1,7 +1,7 @@
BIOSVendor: "Apple Inc."
-BIOSVersion: "1916.60.2.0.0"
-BIOSLegacyVersion: "IMP11.88Z.F000.B00.2211301949"
-BIOSReleaseDate: "11/30/2022"
+BIOSVersion: "1916.80.2.0.0"
+BIOSLegacyVersion: "IMP11.88Z.F000.B00.2212212025"
+BIOSReleaseDate: "12/21/2022"
SystemManufacturer: "Apple Inc."
SystemProductName: "iMacPro1,1"
SystemVersion: "1.0"
@@ -48,17 +48,17 @@ SmcPlatform:
- 0x00
OEMStrings: |-
Apple ROM Version
- BIOS ID: IMP11.88Z.F000.B00.2211301949
+ BIOS ID: IMP11.88Z.F000.B00.2212212025
Model: IMP11
- EFI Version: 1916.60.2.0.0
- Built by: root@gtmbh
- Date: Wed Nov 30 19:49:20 2022
- Revision: 1916.60.2 (B&I)
+ EFI Version: 1916.80.2.0.0
+ Built by: root@54j6r
+ Date: Wed Dec 21 20:25:13 2022
+ Revision: 1916.80.2 (B&I)
ROM Version: F000_B00
Build Type: Official Build, RELEASE
Compiler: clang-1400.0.29.2
- UUID: F3BBA805-8801-3486-AAD5-086B451AB3E4
- UUID: C3F649CE-19E6-3F66-AA6E-3A34F0D5D0D9
+ UUID: 8E5B4515-2890-36DB-833D-315D3BCBE6FD
+ UUID: 9D6B576A-F3C8-3708-A269-63754AE08FB2
Specifications:
CPUCodename:
- "Skylake"
diff --git a/Application/Bootstrap/Bootstrap.inf b/Application/Bootstrap/Bootstrap.inf
index 74710926049..1a095602ac0 100644
--- a/Application/Bootstrap/Bootstrap.inf
+++ b/Application/Bootstrap/Bootstrap.inf
@@ -54,4 +54,5 @@
MemoryAllocationLib
OcDevicePathLib
OcFileLib
+ OcMiscLib
OcStringLib
diff --git a/Application/CsrUtil/CsrUtil.inf b/Application/CsrUtil/CsrUtil.inf
index e753139788b..b0ce982854b 100644
--- a/Application/CsrUtil/CsrUtil.inf
+++ b/Application/CsrUtil/CsrUtil.inf
@@ -34,6 +34,8 @@
OpenCorePkg/OpenCorePkg.dec
[LibraryClasses]
+ OcMiscLib
+ OcStringLib
OcVariableLib
UefiBootServicesTableLib
UefiApplicationEntryPoint
diff --git a/Application/ListPartitions/ListPartitions.c b/Application/ListPartitions/ListPartitions.c
new file mode 100644
index 00000000000..2cfa2d4e9b2
--- /dev/null
+++ b/Application/ListPartitions/ListPartitions.c
@@ -0,0 +1,91 @@
+/** @file
+ List available partitions on the system.
+
+Copyright (c) 2021-2023, Mikhail Krichanov. All rights reserved.
+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
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+EFI_STATUS
+EFIAPI
+UefiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN HandleCount;
+ EFI_HANDLE *Handles;
+ EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ CONST EFI_PARTITION_ENTRY *PartitionEntry;
+
+ //
+ // Find HardDrive
+ //
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &Handles
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "Failed to find any partitions - %r\n", Status));
+ return Status;
+ }
+
+ for (Index = 0; Index < HandleCount; ++Index) {
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEfiBlockIoProtocolGuid,
+ (VOID **)&BlkIo
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "Partition #%u is unavailable - %r\n", (UINT32)(Index + 1), Status));
+ continue;
+ }
+
+ if (!BlkIo->Media->LogicalPartition) {
+ DEBUG ((DEBUG_WARN, "Partition #%u is not a logical partition\n", (UINT32)(Index + 1)));
+ continue;
+ }
+
+ PartitionEntry = OcGetGptPartitionEntry (Handles[Index]);
+ if (PartitionEntry == NULL) {
+ DEBUG ((DEBUG_WARN, "Partition #%u GPT entry is not accessible\n", (UINT32)(Index + 1)));
+ continue;
+ }
+
+ if (IsZeroGuid (&PartitionEntry->UniquePartitionGUID)) {
+ DEBUG ((DEBUG_WARN, "Partition #%u GPT entry has all-zero GUID\n", (UINT32)(Index + 1)));
+ continue;
+ }
+
+ DEBUG ((DEBUG_WARN, "Partition #%u details:\n", (UINT32)(Index + 1)));
+ DEBUG ((DEBUG_WARN, " PartitionName : %-36s\n", PartitionEntry->PartitionName));
+ DEBUG ((DEBUG_WARN, " PartitionTypeGUID : %g\n", &PartitionEntry->PartitionTypeGUID));
+ DEBUG ((DEBUG_WARN, " UniquePartitionGUID: %g\n", &PartitionEntry->UniquePartitionGUID));
+ }
+
+ FreePool (Handles);
+
+ return EFI_SUCCESS;
+}
diff --git a/Application/ListPartitions/ListPartitions.inf b/Application/ListPartitions/ListPartitions.inf
new file mode 100644
index 00000000000..54b10373184
--- /dev/null
+++ b/Application/ListPartitions/ListPartitions.inf
@@ -0,0 +1,53 @@
+## @file
+# List available partitions on the system.
+#
+# Copyright (c) 2021-2023, Vitaly Cheptsov. All rights reserved.
+#
+# 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.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = ListPartitions
+ FILE_GUID = 58856DD3-44DF-481A-BBD2-7ED13741EDF8
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ ListPartitions.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OpenCorePkg/OpenCorePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
+
+[Protocols]
+ gEfiBlockIoProtocolGuid ## CONSUMES
+
+[LibraryClasses]
+ OcConsoleControlEntryModeGenericLib
+ OcFileLib
+ DebugLib
+ UefiApplicationEntryPoint
+ UefiLib
+ PcdLib
+ IoLib
diff --git a/Application/OpenControl/OpenControl.c b/Application/OpenControl/OpenControl.c
index 7e1f7014d94..38d5f354d43 100644
--- a/Application/OpenControl/OpenControl.c
+++ b/Application/OpenControl/OpenControl.c
@@ -44,7 +44,7 @@ UefiMain (
);
if (EFI_ERROR (Status)) {
- Print (L"FwRuntime protocol is unavilable - %r\n", Status);
+ Print (L"FwRuntime protocol is unavailable - %r\n", Status);
return EFI_SUCCESS;
}
diff --git a/Changelog.md b/Changelog.md
index 874c9d44d6c..af50bbf34fb 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,9 +1,31 @@
OpenCore Changelog
==================
+#### v0.9.1
+- Fixed long comment printing for ACPI patches, thx @corpnewt
+
+#### v0.9.0
+- Resolved issues with verbose boot log appearing over picker graphics
+- Added version number to EnableGop UI section, so tool builders can track it
+- Added `ProvideCurrentCpuInfo` support for macOS 13.3 DP
+- Added AMD support, GOP offset auto-detection and macOS 10.11+ support to EnableGop vBIOS insertion script
+- Included precompiled EDK-II `EfiRom` and `GenFfs` in `Utilities/BaseTools` with OpenCore releases
+
#### v0.8.9
- Improved debug logging when applying ACPI patches
- Fixed loading macOS with legacy boot without Apple Secure Boot
- Added Linux support to legacy boot BootInstall script
+- Updated builtin firmware versions for SMBIOS and the rest
+- Fixed incomplete console mode initialisation when started in graphics mode
+- Provided additional UEFI forge mode, for use in firmware drivers
+- Implemented firmware driver enabling pre-OpenCore graphics on non-natively supported GPUs on EFI-era Macs
+- Prevented unwanted clear screen to console background colour when in graphics mode
+- Added `ResizeUsePciRbIo` quirk to workaround broken PciIo on some UEFI firmwares, thx @xCuri0
+- Fixed crash while using `SysReport` on older Atom systems
+- Fixed kexts without a Contents folder not being patched during a cacheless boot
+- Added read-only sections (`.rdata`) to all drivers for better memory protection when supported
+- Fixed crash while using `SysReport` on systems with non-audio HDA codecs
+- Fixed debug script support for GDB and LLDB
+- Fixed legacy boot debug builds asserting on macOS loading
#### v0.8.8
- Updated underlying EDK II package to edk2-stable202211
diff --git a/Debug/Scripts/gdb_uefi.py b/Debug/Scripts/gdb_uefi.py
index 32101b84c59..3c8d8f0b75c 100644
--- a/Debug/Scripts/gdb_uefi.py
+++ b/Debug/Scripts/gdb_uefi.py
@@ -251,71 +251,9 @@ def pe_parse_debug(self, base):
#
# Prepares gdb symbol load command with proper section information.
- # Currently supports Mach-O and single-section files.
#
- # TODO: Proper ELF support.
- #
- def get_sym_cmd(self, file, orgbase, sections, macho, fallack_base):
- cmd = f'add-symbol-file {file}'
-
- # Fallback case, no sections, just load .text.
- if not sections.get('.text') or not sections.get('.data'):
- cmd += f' 0x{fallack_base:x}'
- return cmd
-
- cmd += f" 0x{int(orgbase) + sections['.text']:x}"
-
- if not macho or not os.path.exists(file):
- # Another fallback, try to load data at least.
- cmd += f" -s .data 0x{int(orgbase) + sections['.data']:x}"
- return cmd
-
- # 1. Parse Mach-O.
- # FIXME: We should not rely on otool really.
- commands = subprocess.check_output(['otool', '-l', file])
- try:
- lines = commands.decode('utf-8').split('\n')
- except Exception:
- lines = commands.split('\n')
- in_sect = False
- machsections = {}
- for line in lines:
- line = line.strip()
- if line.startswith('Section'):
- in_sect = True
- sectname = None
- segname = None
- elif in_sect:
- if line.startswith('sectname'):
- sectname = line.split()[1]
- elif line.startswith('segname'):
- segname = line.split()[1]
- elif line.startswith('addr'):
- machsections[segname + '.' + sectname] = int(line.split()[1], base=16)
- in_sect = False
-
- # 2. Convert section names to gdb sections.
- mapping = {
- '__TEXT.__cstring': '.cstring',
- '__TEXT.__const': '.const',
- '__TEXT.__ustring': '__TEXT.__ustring',
- '__DATA.__const': '.const_data',
- '__DATA.__data': '.data',
- '__DATA.__bss': '.bss',
- '__DATA.__common': '__DATA.__common',
- # FIXME: These should not be loadable, but gdb still loads them :/
- # '__DWARF.__apple_names': '__DWARF.__apple_names',
- # '__DWARF.__apple_namespac': '__DWARF.__apple_namespac',
- # '__DWARF.__apple_types': '__DWARF.__apple_types',
- # '__DWARF.__apple_objc': '__DWARF.__apple_objc',
- }
-
- # 3. Rebase.
- for section, new_section in mapping.items():
- if machsections.get(section):
- cmd += f' -s {new_section} 0x{int(orgbase) + machsections[section]:x}'
-
- return cmd
+ def get_sym_cmd(self, file, base, sections, macho):
+ return f'add-symbol-file {file} -o 0x{base:x}'
#
# Parses an EFI_LOADED_IMAGE_PROTOCOL, figuring out the symbol file name.
@@ -325,7 +263,7 @@ def get_sym_cmd(self, file, orgbase, sections, macho, fallack_base):
#
def parse_image(self, image, syms):
- orgbase = base = image['ImageBase']
+ base = image['ImageBase']
pe = self.pe_headers(base)
opt = self.pe_optional(pe)
file = self.pe_file(pe)
@@ -345,7 +283,7 @@ def parse_image(self, image, syms):
elif sym_name_dbg != sym_name and os.path.exists(sym_name_dbg):
# TODO: implement .elf handling.
sym_name = sym_name_dbg
- syms.append(self.get_sym_cmd(sym_name, int(orgbase), sections, macho, int(base)))
+ syms.append(self.get_sym_cmd(sym_name, int(base), sections, macho))
#
# Parses table EFI_DEBUG_IMAGE_INFO structures, builds
diff --git a/Docs/Configuration.md5 b/Docs/Configuration.md5
index 2428e1cec42..808a837d82c 100644
--- a/Docs/Configuration.md5
+++ b/Docs/Configuration.md5
@@ -1 +1 @@
-32a9068c12dd2418920da6e0b992c8d9
+47527529965806028b67eda9e36c0db8
diff --git a/Docs/Configuration.pdf b/Docs/Configuration.pdf
index 1542e2d8534..03640325927 100644
Binary files a/Docs/Configuration.pdf and b/Docs/Configuration.pdf differ
diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex
index f1dfa2d0c1f..b23f5b7dc2a 100755
--- a/Docs/Configuration.tex
+++ b/Docs/Configuration.tex
@@ -94,7 +94,7 @@
\vspace{0.2in}
- Reference Manual (0.8.9)
+ Reference Manual (0.9.1)
\vspace{0.2in}
@@ -106,7 +106,7 @@
\rmfamily
- Copyright \textcopyright 2018-2022 vit9696
+ Copyright \textcopyright 2018-2023 vit9696
\end{center}
\end{titlepage}
@@ -3723,10 +3723,15 @@ \subsection{Boot Properties}\label{miscbootprops}
\emph{Note 3}: On Macs with problematic GOP, it may be difficult to re-bless OpenCore if its bless status
is lost. The \texttt{BootKicker} utility can be used to work around this problem, if set up as a Tool
- in OpenCore (e.g. on a CDROM) with \texttt{FullNvramAccess} enabled. It will launch the Apple picker,
- which allows selection of an item to boot next (with \texttt{Enter}), or next and subsequently, i.e.
- as the blessed entry (with \texttt{CTRL+Enter}), as normal. After the selection is made, the system
- will reboot and the chosen entry will be booted.
+ in OpenCore with \texttt{FullNvramAccess} enabled. It will launch the Apple picker,
+ which allows selection of an item to boot next (with \texttt{Enter}), or next and from then on until
+ the next change (with \texttt{CTRL+Enter}). Note that after the selection is made, the system
+ \emph{will reboot} before the chosen entry is booted. While this behaviour might seem surprising,
+ it can be used both to switch which OpenCore installation is blessed, with \texttt{CTRL+Enter},
+ e.g. from a recovery OpenCore installation on CD (selected with the \texttt{C} key on boot) back
+ to the main installion of OpenCore on the hard drive, if this is lost after an NVRAM reset. It can
+ also be used, even when the native picker cannot be shown normally (unsupported GPU), to do a one-shot
+ boot without OpenCore, e.g. to another OS or tool, or to an earlier version of macOS.
\item
\texttt{PickerVariant}\\
@@ -6355,6 +6360,11 @@ \subsection{Drivers}\label{uefidrivers}
any available writeable filesystem upon pressing \texttt{F10}.
This is a modified version of \href{https://github.com/LongSoft/CrScreenshotDxe}{\texttt{CrScreenshotDxe}}
driver by \href{https://github.com/NikolajSchlej}{Nikolaj Schlej}. \\
+\href{https://github.com/acidanthera/OpenCorePkg}{\texttt{EnableGop\{Direct\}}}\textbf{*}
+& Early beta release firmware-embeddable driver providing pre-OpenCore non-native GPU support
+ on MacPro5,1. Installation instructions can be found in the
+ \href{https://github.com/acidanthera/OpenCorePkg/blob/master/Staging/EnableGop/README.md}{\texttt{Utilities/EnableGop}}
+ directory of the OpenCore release zip file - proceed with caution. \\
\href{https://github.com/acidanthera/OcBinaryData}{\texttt{ExFatDxe}}
& Proprietary ExFAT file system driver for Bootcamp support commonly found in Apple
firmware. For Sandy Bridge and earlier CPUs, the \texttt{ExFatDxeLegacy} driver should be
@@ -6808,7 +6818,7 @@ \subsubsection{Configuration}
\medskip
As example usage, it is possible to use \texttt{+=} format to add
- a \texttt{vt.handoff} options, such as \texttt{autopts+="vt.handoff=7"} or \texttt{autopts+="vt.handoff=3"}
+ a \texttt{vt.handoff} options, such as \texttt{autoopts+="vt.handoff=7"} or \texttt{autoopts+="vt.handoff=3"}
(check \texttt{cat /proc/cmdline} when booted via the distro's default bootloader) on Ubuntu and related distros,
in order to add the \texttt{vt.handoff} option to the auto-detected GRUB defaults, and avoid a flash of text
showing before the distro splash screen.
@@ -8669,6 +8679,17 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
or corrupted in any way.
\end{itemize}
+\item
+ \texttt{ResizeUsePciRbIo}\\
+ \textbf{Type}: \texttt{plist\ boolean}\\
+ \textbf{Failsafe}: \texttt{false}\\
+ \textbf{Description}: Use PciRootBridgeIo for \texttt{ResizeGpuBars} and \texttt{ResizeAppleGpuBars}
+
+ The quirk makes \texttt{ResizeGpuBars} and \texttt{ResizeAppleGpuBars} use \texttt{PciRootBridgeIo} instead of PciIo.
+ This is needed on systems with a buggy \texttt{PciIo} implementation where trying to configure
+ Resizable BAR results in \texttt{Capability I/O Error}. Typically this is required on
+ older systems which have been modified with \href{https://github.com/xCuri0/ReBarUEFI}{ReBarUEFI}.
+
\item
\texttt{ResizeGpuBars}\\
\textbf{Type}: \texttt{plist\ integer}\\
diff --git a/Docs/Differences/Differences.pdf b/Docs/Differences/Differences.pdf
index 1fc4e896f85..c4ef208718d 100644
Binary files a/Docs/Differences/Differences.pdf and b/Docs/Differences/Differences.pdf differ
diff --git a/Docs/Differences/Differences.tex b/Docs/Differences/Differences.tex
index 380b47bf009..602d075ed31 100644
--- a/Docs/Differences/Differences.tex
+++ b/Docs/Differences/Differences.tex
@@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
-%DIF DEL PreviousConfiguration.tex Mon Jan 2 20:13:00 2023
-%DIF ADD ../Configuration.tex Sun Jan 8 15:18:30 2023
+%DIF DEL PreviousConfiguration.tex Thu Mar 9 06:57:33 2023
+%DIF ADD ../Configuration.tex Thu Mar 9 22:49:02 2023
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
@@ -118,7 +118,7 @@
%DIF HYPERREF PREAMBLE %DIF PREAMBLE
\providecommand{\DIFadd}[1]{\texorpdfstring{\DIFaddtex{#1}}{#1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{\texorpdfstring{\DIFdeltex{#1}}{}} %DIF PREAMBLE
-%DIF LISTINGS PREAMBLE %DIF PREAMBLE
+%DIF COLORLISTINGS PREAMBLE %DIF PREAMBLE
\RequirePackage{listings} %DIF PREAMBLE
\RequirePackage{color} %DIF PREAMBLE
\lstdefinelanguage{DIFcode}{ %DIF PREAMBLE
@@ -154,7 +154,7 @@
\vspace{0.2in}
- Reference Manual (0.8\DIFdelbegin \DIFdel{.8}\DIFdelend \DIFaddbegin \DIFadd{.9}\DIFaddend )
+ Reference Manual (0.9\DIFdelbegin \DIFdel{.0}\DIFdelend \DIFaddbegin \DIFadd{.1}\DIFaddend )
\vspace{0.2in}
@@ -166,7 +166,7 @@
\rmfamily
- Copyright \textcopyright 2018-2022 vit9696
+ Copyright \textcopyright 2018-2023 vit9696
\end{center}
\end{titlepage}
@@ -723,18 +723,16 @@ \subsection{Contribution}\label{configuration-comp}
The latest Xcode version is recommended for use despite the toolchain name.
An example command sequence is as follows:
-\DIFmodbegin
-\begin{lstlisting}[caption=Compilation Commands, label=compile, style=ocbash,alsolanguage=DIFcode]
+\begin{lstlisting}[caption=Compilation Commands, label=compile, style=ocbash]
git clone --depth=1 https://github.com/acidanthera/audk UDK
cd UDK
git submodule update --init --recommend-shallow
-%DIF > rm -rf OpenCorePkg
+rm -rf OpenCorePkg
git clone --depth=1 https://github.com/acidanthera/OpenCorePkg
. ./edksetup.sh
make -C BaseTools
build -a X64 -b RELEASE -t XCODE5 -p OpenCorePkg/OpenCorePkg.dsc
\end{lstlisting}
-\DIFmodend
For IDE usage Xcode projects are available in the root of the repositories. Another
approach could be using \href{https://microsoft.github.io/language-server-protocol}{Language Server Protocols}. For example, \href{https://www.sublimetext.com}{Sublime Text} with
@@ -3785,10 +3783,15 @@ \subsection{Boot Properties}\label{miscbootprops}
\emph{Note 3}: On Macs with problematic GOP, it may be difficult to re-bless OpenCore if its bless status
is lost. The \texttt{BootKicker} utility can be used to work around this problem, if set up as a Tool
- in OpenCore (e.g. on a CDROM) with \texttt{FullNvramAccess} enabled. It will launch the Apple picker,
- which allows selection of an item to boot next (with \texttt{Enter}), or next and subsequently, i.e.
- as the blessed entry (with \texttt{CTRL+Enter}), as normal. After the selection is made, the system
- will reboot and the chosen entry will be booted.
+ in OpenCore with \texttt{FullNvramAccess} enabled. It will launch the Apple picker,
+ which allows selection of an item to boot next (with \texttt{Enter}), or next and from then on until
+ the next change (with \texttt{CTRL+Enter}). Note that after the selection is made, the system
+ \emph{will reboot} before the chosen entry is booted. While this behaviour might seem surprising,
+ it can be used both to switch which OpenCore installation is blessed, with \texttt{CTRL+Enter},
+ e.g. from a recovery OpenCore installation on CD (selected with the \texttt{C} key on boot) back
+ to the main installion of OpenCore on the hard drive, if this is lost after an NVRAM reset. It can
+ also be used, even when the native picker cannot be shown normally (unsupported GPU), to do a one-shot
+ boot without OpenCore, e.g. to another OS or tool, or to an earlier version of macOS.
\item
\texttt{PickerVariant}\\
@@ -6417,6 +6420,11 @@ \subsection{Drivers}\label{uefidrivers}
any available writeable filesystem upon pressing \texttt{F10}.
This is a modified version of \href{https://github.com/LongSoft/CrScreenshotDxe}{\texttt{CrScreenshotDxe}}
driver by \href{https://github.com/NikolajSchlej}{Nikolaj Schlej}. \\
+\href{https://github.com/acidanthera/OpenCorePkg}{\texttt{EnableGop\{Direct\}}}\textbf{*}
+& Early beta release firmware-embeddable driver providing pre-OpenCore non-native GPU support
+ on MacPro5,1. Installation instructions can be found in the
+ \href{https://github.com/acidanthera/OpenCorePkg/blob/master/Staging/EnableGop/README.md}{\texttt{Utilities/EnableGop}}
+ directory of the OpenCore release zip file - proceed with caution. \\
\href{https://github.com/acidanthera/OcBinaryData}{\texttt{ExFatDxe}}
& Proprietary ExFAT file system driver for Bootcamp support commonly found in Apple
firmware. For Sandy Bridge and earlier CPUs, the \texttt{ExFatDxeLegacy} driver should be
@@ -6870,7 +6878,7 @@ \subsubsection{Configuration}
\medskip
As example usage, it is possible to use \texttt{+=} format to add
- a \texttt{vt.handoff} options, such as \texttt{autopts+="vt.handoff=7"} or \texttt{autopts+="vt.handoff=3"}
+ a \texttt{vt.handoff} options, such as \texttt{\DIFdelbegin \DIFdel{autopts}\DIFdelend \DIFaddbegin \DIFadd{autoopts}\DIFaddend +="vt.handoff=7"} or \texttt{\DIFdelbegin \DIFdel{autopts}\DIFdelend \DIFaddbegin \DIFadd{autoopts}\DIFaddend +="vt.handoff=3"}
(check \texttt{cat /proc/cmdline} when booted via the distro's default bootloader) on Ubuntu and related distros,
in order to add the \texttt{vt.handoff} option to the auto-detected GRUB defaults, and avoid a flash of text
showing before the distro splash screen.
@@ -8731,6 +8739,17 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
or corrupted in any way.
\end{itemize}
+\item
+ \texttt{ResizeUsePciRbIo}\\
+ \textbf{Type}: \texttt{plist\ boolean}\\
+ \textbf{Failsafe}: \texttt{false}\\
+ \textbf{Description}: Use PciRootBridgeIo for \texttt{ResizeGpuBars} and \texttt{ResizeAppleGpuBars}
+
+ The quirk makes \texttt{ResizeGpuBars} and \texttt{ResizeAppleGpuBars} use \texttt{PciRootBridgeIo} instead of PciIo.
+ This is needed on systems with a buggy \texttt{PciIo} implementation where trying to configure
+ Resizable BAR results in \texttt{Capability I/O Error}. Typically this is required on
+ older systems which have been modified with \href{https://github.com/xCuri0/ReBarUEFI}{ReBarUEFI}.
+
\item
\texttt{ResizeGpuBars}\\
\textbf{Type}: \texttt{plist\ integer}\\
@@ -8783,9 +8802,9 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
\emph{Note 2}: While this quirk can increase GPU PCI BAR sizes, this will not
work on most firmware as is, because the quirk does not relocate BARs in memory,
- and they will likely overlap. \DIFdelbegin \DIFdel{Contributions to improve this feature are welcome}\DIFdelend \DIFaddbegin \DIFadd{In most cases it is best to either update the
+ and they will likely overlap. In most cases it is best to either update the
firmware to the latest version or customise it with a specialised driver
- like }\href{https://github.com/xCuri0/ReBarUEFI}{\DIFadd{ReBarUEFI}}\DIFaddend .
+ like \href{https://github.com/xCuri0/ReBarUEFI}{ReBarUEFI}.
\item
\texttt{TscSyncTimeout}\\
diff --git a/Docs/Differences/PreviousConfiguration.tex b/Docs/Differences/PreviousConfiguration.tex
index 05711ad4e97..d3884a0d63d 100755
--- a/Docs/Differences/PreviousConfiguration.tex
+++ b/Docs/Differences/PreviousConfiguration.tex
@@ -94,7 +94,7 @@
\vspace{0.2in}
- Reference Manual (0.8.8)
+ Reference Manual (0.9.0)
\vspace{0.2in}
@@ -106,7 +106,7 @@
\rmfamily
- Copyright \textcopyright 2018-2022 vit9696
+ Copyright \textcopyright 2018-2023 vit9696
\end{center}
\end{titlepage}
@@ -667,6 +667,7 @@ \subsection{Contribution}\label{configuration-comp}
git clone --depth=1 https://github.com/acidanthera/audk UDK
cd UDK
git submodule update --init --recommend-shallow
+rm -rf OpenCorePkg
git clone --depth=1 https://github.com/acidanthera/OpenCorePkg
. ./edksetup.sh
make -C BaseTools
@@ -3722,10 +3723,15 @@ \subsection{Boot Properties}\label{miscbootprops}
\emph{Note 3}: On Macs with problematic GOP, it may be difficult to re-bless OpenCore if its bless status
is lost. The \texttt{BootKicker} utility can be used to work around this problem, if set up as a Tool
- in OpenCore (e.g. on a CDROM) with \texttt{FullNvramAccess} enabled. It will launch the Apple picker,
- which allows selection of an item to boot next (with \texttt{Enter}), or next and subsequently, i.e.
- as the blessed entry (with \texttt{CTRL+Enter}), as normal. After the selection is made, the system
- will reboot and the chosen entry will be booted.
+ in OpenCore with \texttt{FullNvramAccess} enabled. It will launch the Apple picker,
+ which allows selection of an item to boot next (with \texttt{Enter}), or next and from then on until
+ the next change (with \texttt{CTRL+Enter}). Note that after the selection is made, the system
+ \emph{will reboot} before the chosen entry is booted. While this behaviour might seem surprising,
+ it can be used both to switch which OpenCore installation is blessed, with \texttt{CTRL+Enter},
+ e.g. from a recovery OpenCore installation on CD (selected with the \texttt{C} key on boot) back
+ to the main installion of OpenCore on the hard drive, if this is lost after an NVRAM reset. It can
+ also be used, even when the native picker cannot be shown normally (unsupported GPU), to do a one-shot
+ boot without OpenCore, e.g. to another OS or tool, or to an earlier version of macOS.
\item
\texttt{PickerVariant}\\
@@ -6354,6 +6360,11 @@ \subsection{Drivers}\label{uefidrivers}
any available writeable filesystem upon pressing \texttt{F10}.
This is a modified version of \href{https://github.com/LongSoft/CrScreenshotDxe}{\texttt{CrScreenshotDxe}}
driver by \href{https://github.com/NikolajSchlej}{Nikolaj Schlej}. \\
+\href{https://github.com/acidanthera/OpenCorePkg}{\texttt{EnableGop\{Direct\}}}\textbf{*}
+& Early beta release firmware-embeddable driver providing pre-OpenCore non-native GPU support
+ on MacPro5,1. Installation instructions can be found in the
+ \href{https://github.com/acidanthera/OpenCorePkg/blob/master/Staging/EnableGop/README.md}{\texttt{Utilities/EnableGop}}
+ directory of the OpenCore release zip file - proceed with caution. \\
\href{https://github.com/acidanthera/OcBinaryData}{\texttt{ExFatDxe}}
& Proprietary ExFAT file system driver for Bootcamp support commonly found in Apple
firmware. For Sandy Bridge and earlier CPUs, the \texttt{ExFatDxeLegacy} driver should be
@@ -8668,6 +8679,17 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
or corrupted in any way.
\end{itemize}
+\item
+ \texttt{ResizeUsePciRbIo}\\
+ \textbf{Type}: \texttt{plist\ boolean}\\
+ \textbf{Failsafe}: \texttt{false}\\
+ \textbf{Description}: Use PciRootBridgeIo for \texttt{ResizeGpuBars} and \texttt{ResizeAppleGpuBars}
+
+ The quirk makes \texttt{ResizeGpuBars} and \texttt{ResizeAppleGpuBars} use \texttt{PciRootBridgeIo} instead of PciIo.
+ This is needed on systems with a buggy \texttt{PciIo} implementation where trying to configure
+ Resizable BAR results in \texttt{Capability I/O Error}. Typically this is required on
+ older systems which have been modified with \href{https://github.com/xCuri0/ReBarUEFI}{ReBarUEFI}.
+
\item
\texttt{ResizeGpuBars}\\
\textbf{Type}: \texttt{plist\ integer}\\
@@ -8720,7 +8742,9 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
\emph{Note 2}: While this quirk can increase GPU PCI BAR sizes, this will not
work on most firmware as is, because the quirk does not relocate BARs in memory,
- and they will likely overlap. Contributions to improve this feature are welcome.
+ and they will likely overlap. In most cases it is best to either update the
+ firmware to the latest version or customise it with a specialised driver
+ like \href{https://github.com/xCuri0/ReBarUEFI}{ReBarUEFI}.
\item
\texttt{TscSyncTimeout}\\
diff --git a/Docs/Errata/Errata.pdf b/Docs/Errata/Errata.pdf
index b76806b237b..34fdc5ab6d3 100644
Binary files a/Docs/Errata/Errata.pdf and b/Docs/Errata/Errata.pdf differ
diff --git a/Docs/Errata/Errata.tex b/Docs/Errata/Errata.tex
index 0dc72c837e8..74ae42139d9 100755
--- a/Docs/Errata/Errata.tex
+++ b/Docs/Errata/Errata.tex
@@ -101,7 +101,7 @@
\rmfamily
- Copyright \textcopyright 2020-2022 vit9696
+ Copyright \textcopyright 2020-2023 vit9696
\end{center}
\end{titlepage}
diff --git a/Docs/Kexts.md b/Docs/Kexts.md
index f9572684bbe..dff8b534156 100644
--- a/Docs/Kexts.md
+++ b/Docs/Kexts.md
@@ -49,7 +49,6 @@ Kexts
| [kXAudioDriver.kext](https://github.com/kxproject/kx-audio-driver) | — | — | — |
| [Nvidia CUDA drivers](https://www.nvidia.com/object/mac-driver-archive.html) | 10.0.0 (10.6) | 17.9.9 (10.13) | — |
| [Nvidia Web-drivers](https://gfe.nvidia.com/mac-update) | 12.0.0 (10.8) | 17.9.9 (10.13) | — |
-| [SNBGraphicsMojaveInstaller](https://github.com/Andrej-Antipov/SNBGraphicsMojaveInstaller) | 18.0.0 (10.14) | — | From 10.13 |
| [VoodooHDA.kext](https://sourceforge.net/projects/voodoohda/) | — | — | — |
| [WhateverGreen.kext](https://github.com/acidanthera/WhateverGreen) | 10.0.0 (10.6) | — | — |
| [Polaris22Fixup.kext](https://github.com/osy86/Polaris22Fixup) | 18.0.0 (10.14) | — | — |
@@ -84,6 +83,7 @@ Kexts
| [Sinetek-rtsx.kext](https://www.insanelymac.com/forum/topic/321080-sineteks-driver-for-realtek-rtsx-sdhc-card-readers/?do=findComment&comment=2376387) | — | — | — |
| [VoodooSDHC.kext](https://github.com/lvs1974/VoodooSDHCMod) | — | — | — |
| [RealtekCardReader.kext](https://github.com/0xFireWolf/RealtekCardReader) | — | — | — |
+| [EmeraldSDHC.kext](https://github.com/acidanthera/EmeraldSDHC) | — | — | — |
| Other kexts | MinKernel (Min macOS) | MaxKernel (Max macOS) | Note |
|-------------|-----------------------|-----------------------|------|
diff --git a/Docs/Sample.plist b/Docs/Sample.plist
index 46369d6ab0a..b1c95720db3 100644
--- a/Docs/Sample.plist
+++ b/Docs/Sample.plist
@@ -1923,6 +1923,8 @@
ResizeGpuBars
-1
+ ResizeUsePciRbIo
+
TscSyncTimeout
0
UnblockFsConnect
diff --git a/Docs/SampleCustom.plist b/Docs/SampleCustom.plist
index 0a6300b98f9..c2e00e74532 100644
--- a/Docs/SampleCustom.plist
+++ b/Docs/SampleCustom.plist
@@ -2291,6 +2291,8 @@
ResizeGpuBars
-1
+ ResizeUsePciRbIo
+
TscSyncTimeout
0
UnblockFsConnect
diff --git a/Include/Acidanthera/Library/OcAfterBootCompatLib.h b/Include/Acidanthera/Library/OcAfterBootCompatLib.h
index 8a7f848396b..9de93a7eadf 100644
--- a/Include/Acidanthera/Library/OcAfterBootCompatLib.h
+++ b/Include/Acidanthera/Library/OcAfterBootCompatLib.h
@@ -180,6 +180,10 @@ typedef struct OC_ABC_SETTINGS_ {
///
BOOLEAN SyncRuntimePermissions;
///
+ /// Use PciRootBridgeIo for resizing GPU BARs
+ ///
+ BOOLEAN ResizeUsePciRbIo;
+ ///
/// Reduce GPU BARs for macOS to maximum supported version.
///
INT8 ResizeAppleGpuBars;
diff --git a/Include/Acidanthera/Library/OcBootManagementLib.h b/Include/Acidanthera/Library/OcBootManagementLib.h
index 1a6eb90f374..f2e4bfdcdec 100644
--- a/Include/Acidanthera/Library/OcBootManagementLib.h
+++ b/Include/Acidanthera/Library/OcBootManagementLib.h
@@ -6,7 +6,8 @@
#ifndef OC_BOOT_MANAGEMENT_LIB_H
#define OC_BOOT_MANAGEMENT_LIB_H
-#include
+#include
+#include
#include
#include
#include
@@ -19,6 +20,8 @@
#include
#include
#include
+#include
+#include
#if defined (OC_TARGET_DEBUG) || defined (OC_TARGET_NOOPT)
// #define BUILTIN_DEMONSTRATE_TYPING
@@ -2075,6 +2078,17 @@ OcAddEntriesFromBootEntryProtocol (
IN BOOLEAN CreateForHotKey
);
+/**
+ Force Apple Firmware UI to always reconnect to current console GOP.
+
+ @retval EFI_SUCCESS Firmware UI ConnectGop method was successfully reset.
+ @retval other Compatible firmware UI protocol for reset could not be found.
+**/
+EFI_STATUS
+OcUnlockAppleFirmwareUI (
+ VOID
+ );
+
/**
Launch Apple boot picker firmware application.
diff --git a/Include/Acidanthera/Library/OcConfigurationLib.h b/Include/Acidanthera/Library/OcConfigurationLib.h
index ac3b7495c29..10c22624bf6 100644
--- a/Include/Acidanthera/Library/OcConfigurationLib.h
+++ b/Include/Acidanthera/Library/OcConfigurationLib.h
@@ -741,6 +741,7 @@ OC_DECLARE (OC_UEFI_PROTOCOL_OVERRIDES)
_(BOOLEAN , ForgeUefiSupport , , FALSE , ()) \
_(BOOLEAN , IgnoreInvalidFlexRatio , , FALSE , ()) \
_(INT8 , ResizeGpuBars , , -1 , ()) \
+ _(BOOLEAN , ResizeUsePciRbIo , , FALSE , ()) \
_(BOOLEAN , ReleaseUsbOwnership , , FALSE , ()) \
_(BOOLEAN , ReloadOptionRoms , , FALSE , ()) \
_(BOOLEAN , RequestBootVarRouting , , FALSE , ()) \
diff --git a/Include/Acidanthera/Library/OcCpuLib.h b/Include/Acidanthera/Library/OcCpuLib.h
index 1cc29403fa1..7be50217c52 100644
--- a/Include/Acidanthera/Library/OcCpuLib.h
+++ b/Include/Acidanthera/Library/OcCpuLib.h
@@ -38,8 +38,8 @@ typedef enum {
OcCpuGenerationPreYonah,
OcCpuGenerationYonahMerom,
OcCpuGenerationPenryn,
- OcCpuGenerationNehalem,
OcCpuGenerationBonnell,
+ OcCpuGenerationNehalem,
OcCpuGenerationWestmere,
OcCpuGenerationSilvermont,
OcCpuGenerationSandyBridge,
diff --git a/Include/Acidanthera/Library/OcDeviceMiscLib.h b/Include/Acidanthera/Library/OcDeviceMiscLib.h
index dd8fdb711d0..24e653b3f1f 100644
--- a/Include/Acidanthera/Library/OcDeviceMiscLib.h
+++ b/Include/Acidanthera/Library/OcDeviceMiscLib.h
@@ -73,11 +73,17 @@ OcPciInfoDump (
/**
Upgrade UEFI version to 2.x.
+ @param[in] Forge If TRUE forge, else just report status.
+ @param[in] Trash If TRUE trash gBS->CreateEventEx directly, else reallocate gBS.
+ Reallocate strategy will only affect current image and any images
+ it loads. Trash strategy should affect all images.
+
@retval EFI_SUCCESS on success.
**/
EFI_STATUS
OcForgeUefiSupport (
- VOID
+ IN BOOLEAN Forge,
+ IN BOOLEAN Trash
);
/**
@@ -134,7 +140,8 @@ typedef enum {
EFI_STATUS
ResizeGpuBars (
IN PCI_BAR_SIZE Size,
- IN BOOLEAN Increase
+ IN BOOLEAN Increase,
+ IN BOOLEAN UseRbIo
);
//
diff --git a/Include/Acidanthera/Library/OcMainLib.h b/Include/Acidanthera/Library/OcMainLib.h
index a96d96b2213..d90929b7e8a 100644
--- a/Include/Acidanthera/Library/OcMainLib.h
+++ b/Include/Acidanthera/Library/OcMainLib.h
@@ -30,7 +30,7 @@
OpenCore version reported to log and NVRAM.
OPEN_CORE_VERSION must follow X.Y.Z format, where X.Y.Z are single digits.
**/
-#define OPEN_CORE_VERSION "0.8.9"
+#define OPEN_CORE_VERSION "0.9.1"
/**
OpenCore build type reported to log and NVRAM.
diff --git a/Include/Apple/IndustryStandard/AppleFeatures.h b/Include/Apple/IndustryStandard/AppleFeatures.h
index d2f8417384d..de4367e3a1f 100644
--- a/Include/Apple/IndustryStandard/AppleFeatures.h
+++ b/Include/Apple/IndustryStandard/AppleFeatures.h
@@ -111,12 +111,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
#define FW_FEATURE_PLATFORM_SECURITY_POLICY_02 0x00000800U // 11
//
-// Supports Apple Tamper Resistant Boot, which helps FindMyMac functionality.
+// Support Apple Tamper Resistant Boot, which helps FindMyMac functionality.
+// Firmware Locked bit is controlled by the same protocol which determines whether
+// firmware actually gets locked down by SPI registers at DXE start, on EFI-era Macs.
+// Firmware unlock can be triggered by pressing and holding power button at power up on
+// Mac Pro 144.0.0.0.0 firmware. Same protocol is present, but no known way to trigger
+// unlock, on similar era models such as iMac.
// Not set on Macs with T2 via detected non APPLE_EFI_FIRMWARE_GEN3_ID_MAGIC.
// See: /System/Library/PrivateFrameworks/FindMyMac.framework/XPCServices/com.apple.HasTRB.xpc/Contents/MacOS/com.apple.HasTRB.
//
-#define FW_FEATURE_SUPPORTS_TRB 0x00001000U // 12
-#define FW_FEATURE_UNKNOWN_BIT13 0x00002000U // 13
+#define FW_FEATURE_FIRMWARE_LOCKED 0x00001000U // 12
+#define FW_FEATURE_UNKNOWN_BIT13 0x00002000U // 13
//
// Supports USB 2.0 in the firmware. Found in AppleACPIPlatform.kext.
//
diff --git a/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.c b/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.c
index d7249e014a9..071f7ed3e25 100644
--- a/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.c
+++ b/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.c
@@ -117,9 +117,9 @@ OcAbcInitialize (
Settings->AvoidRuntimeDefrag,
Settings->DevirtualiseMmio,
Settings->DisableSingleUser,
- Settings->ForceBooterSignature,
Settings->DisableVariableWrite,
Settings->ProtectSecureBoot,
+ Settings->ForceBooterSignature,
Settings->DiscardHibernateMap,
Settings->EnableSafeModeSlide,
Settings->EnableWriteUnprotector
@@ -127,7 +127,7 @@ OcAbcInitialize (
DEBUG ((
DEBUG_INFO,
- "OCABC: FEXITBS %d PRMRG %d CSLIDE %d MSLIDE %d PRSRV %d RBMAP %d VMAP %d APPLOS %d RTPERMS %d ARBAR %d\n",
+ "OCABC: FEXITBS %d PRMRG %d CSLIDE %d MSLIDE %d PRSRV %d RBMAP %d VMAP %d APPLOS %d RTPERMS %d ARBAR %d RBIO %d\n",
Settings->ForceExitBootServices,
Settings->ProtectMemoryRegions,
Settings->ProvideCustomSlide,
@@ -137,7 +137,8 @@ OcAbcInitialize (
Settings->SetupVirtualMap,
Settings->SignalAppleOS,
Settings->SyncRuntimePermissions,
- Settings->ResizeAppleGpuBars
+ Settings->ResizeAppleGpuBars,
+ Settings->ResizeUsePciRbIo
));
DEBUG_CODE_BEGIN ();
diff --git a/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.inf b/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.inf
index 61374a562cb..a3253e98cb6 100644
--- a/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.inf
+++ b/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.inf
@@ -65,6 +65,7 @@
OcCryptoLib
OcDeviceTreeLib
OcGuardLib
+ OcLogAggregatorLib
OcMemoryLib
OcOSInfoLib
OcRngLib
diff --git a/Library/OcAfterBootCompatLib/ServiceOverrides.c b/Library/OcAfterBootCompatLib/ServiceOverrides.c
index 5c76dd48e5b..40144881b88 100644
--- a/Library/OcAfterBootCompatLib/ServiceOverrides.c
+++ b/Library/OcAfterBootCompatLib/ServiceOverrides.c
@@ -1243,7 +1243,7 @@ OcStartImage (
if ( (BootCompat->Settings.ResizeAppleGpuBars >= 0)
&& (BootCompat->Settings.ResizeAppleGpuBars < PciBarTotal))
{
- ResizeGpuBars (BootCompat->Settings.ResizeAppleGpuBars, FALSE);
+ ResizeGpuBars (BootCompat->Settings.ResizeAppleGpuBars, FALSE, BootCompat->Settings.ResizeUsePciRbIo);
}
} else if (BootCompat->Settings.SignalAppleOS) {
Status = gBS->LocateProtocol (
diff --git a/Library/OcAppleKernelLib/CachelessContext.c b/Library/OcAppleKernelLib/CachelessContext.c
index 6c97e5ece17..25260239646 100644
--- a/Library/OcAppleKernelLib/CachelessContext.c
+++ b/Library/OcAppleKernelLib/CachelessContext.c
@@ -398,7 +398,7 @@ ScanExtensions (
L"%s\\%s\\%s%s",
FilePath,
FileInfo->FileName,
- UseContents ? L"Contents\\MacOS\\" : L"\\",
+ UseContents ? L"Contents\\MacOS\\" : L"",
BuiltinKext->BinaryFileName
);
if (EFI_ERROR (Status)) {
diff --git a/Library/OcAppleKernelLib/CpuidPatches.c b/Library/OcAppleKernelLib/CpuidPatches.c
index c0a9267e8f1..7a248653fe7 100644
--- a/Library/OcAppleKernelLib/CpuidPatches.c
+++ b/Library/OcAppleKernelLib/CpuidPatches.c
@@ -1301,12 +1301,13 @@ PatchProvideCurrentCpuInfoMSR35h (
Patcher,
&mProvideCurrentCpuInfoTopologyCorePerPackageV1Patch
);
- if (EFI_ERROR (Status)) {
- Status = PatcherApplyGenericPatch (
- Patcher,
- &mProvideCurrentCpuInfoTopologyCorePerPackageV1_5Patch
- );
- }
+ }
+
+ if (EFI_ERROR (Status)) {
+ Status = PatcherApplyGenericPatch (
+ Patcher,
+ &mProvideCurrentCpuInfoTopologyCorePerPackageV1_5Patch
+ );
}
DEBUG ((DEBUG_INFO, "OCAK: Patching core per package count - %r\n", Status));
diff --git a/Library/OcBootManagementLib/HotKeySupport.c b/Library/OcBootManagementLib/HotKeySupport.c
index 04e4fb44fdf..4c74383e786 100644
--- a/Library/OcBootManagementLib/HotKeySupport.c
+++ b/Library/OcBootManagementLib/HotKeySupport.c
@@ -378,6 +378,12 @@ GetPickerKeyInfo (
//
// CMD+V is always valid and enables Verbose Mode.
//
+ // Note: Verbose boot may be entered in three different ways:
+ // - Loaded image options passed from bootloader (as will happen due to below
+ // code, when CMD+V is pressed during OpenCore picker menu).
+ // - `-v` option in NVRAM `boot-args` variable.
+ // - boot.efi itself detecting that CMD+V is held down when it starts.
+ //
if (HasCommand && HasKeyV) {
if (OcGetArgumentFromCmd (Context->AppleBootArgs, "-v", L_STR_LEN ("-v"), NULL) == NULL) {
DEBUG ((DEBUG_INFO, "OCHK: CMD+V means -v\n"));
diff --git a/Library/OcBootManagementLib/OcBootManagementLib.c b/Library/OcBootManagementLib/OcBootManagementLib.c
index d4a90faa1d9..6086e480286 100644
--- a/Library/OcBootManagementLib/OcBootManagementLib.c
+++ b/Library/OcBootManagementLib/OcBootManagementLib.c
@@ -165,50 +165,6 @@ InternalRunRequestPrivilege (
return Status;
}
-//
-// Since the Apple picker is GOP-based, it is reasonable to use specifically GOP to clear up after it.
-// Note that depending on settings, resetting ConsoleControl to text mode followed by ConOut->ClearScreen,
-// within the builtin picker, is not always sufficient to display it after the Apple picker, with no left-
-// over Apple picker baggage on screen, so we add this.
-//
-STATIC
-EFI_STATUS
-GopClearScreen (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Pixel;
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **)&Gop
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Pixel.Raw = 0x0;
-
- Gop->Blt (
- Gop,
- &Pixel.Pixel,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- Gop->Mode->Info->HorizontalResolution,
- Gop->Mode->Info->VerticalResolution,
- 0
- );
-
- return EFI_UNSUPPORTED;
-}
-
EFI_STATUS
OcRunBootPicker (
IN OC_PICKER_CONTEXT *Context
@@ -311,7 +267,6 @@ OcRunBootPicker (
if (IsApplePickerSelection) {
DEBUG ((DEBUG_WARN, "OCB: Apple Picker returned no entry valid under OC, falling back to builtin\n"));
Context->PickerMode = OcPickerModeBuiltin;
- GopClearScreen ();
} else {
DEBUG ((DEBUG_INFO, "OCB: System has no boot entries, showing picker with auxiliary\n"));
}
@@ -459,16 +414,30 @@ OcRunBootPicker (
}
}
+STATIC
+EFI_STATUS
+SetPickerEntryReason (
+ IN APPLE_PICKER_ENTRY_REASON PickerEntryReason
+ )
+{
+ return gRT->SetVariable (
+ APPLE_PICKER_ENTRY_REASON_VARIABLE_NAME,
+ &gAppleVendorVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (PickerEntryReason),
+ &PickerEntryReason
+ );
+}
+
EFI_STATUS
OcRunFirmwareApplication (
IN EFI_GUID *ApplicationGuid,
IN BOOLEAN SetReason
)
{
- EFI_STATUS Status;
- EFI_HANDLE NewHandle;
- EFI_DEVICE_PATH_PROTOCOL *Dp;
- APPLE_PICKER_ENTRY_REASON PickerEntryReason;
+ EFI_STATUS Status;
+ EFI_HANDLE NewHandle;
+ EFI_DEVICE_PATH_PROTOCOL *Dp;
DEBUG ((DEBUG_INFO, "OCB: run fw app attempting to find %g...\n", ApplicationGuid));
@@ -493,14 +462,7 @@ OcRunFirmwareApplication (
if (!EFI_ERROR (Status)) {
if (SetReason) {
- PickerEntryReason = ApplePickerEntryReasonUnknown;
- Status = gRT->SetVariable (
- APPLE_PICKER_ENTRY_REASON_VARIABLE_NAME,
- &gAppleVendorVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (PickerEntryReason),
- &PickerEntryReason
- );
+ Status = SetPickerEntryReason (ApplePickerEntryReasonUnknown);
}
DEBUG ((
@@ -524,14 +486,86 @@ OcRunFirmwareApplication (
return Status;
}
+//
+// Patching prolog of this function works on more similar era firmware
+// than assuming that mGopAlreadyConnected is located immediately after
+// protocol interface (which applies on MacPro5,1 v144.0.0.0.0 but not others).
+//
+// MacPro5,1 + some iMacs:
+//
+// sub rsp, 28h
+// cmp cs:mGopAlreadyConnected, 0 ///< Ignore offset of this var
+// jz short loc_10004431
+// xor eax, eax
+// jmp short loc_1000446F ///< Change this to no jump
+//
+STATIC CONST UINT8 ConnectGopPrologue[] = {
+ 0x48, 0x83, 0xEC, 0x28, 0x80, 0x3D, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x74, 0x04, 0x33, 0xC0, 0xEB,
+ 0x3E
+};
+
+STATIC CONST UINT8 ConnectGopPrologueMask[] = {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF
+};
+
+STATIC CONST UINT8 ConnectGopReplace[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00
+};
+
+STATIC CONST UINT8 ConnectGopReplaceMask[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF
+};
+
+//
+// iMac11,1:
+//
+// push rbx
+// sub rsp, 30h
+// cmp cs:byte_100065C8, 0
+// jz short loc_10004077
+// xor ebx, ebx
+// jmp short loc_100040D1
+//
+
+STATIC CONST UINT8 AltConnectGopPrologue[] = {
+ 0x48, 0x53, 0x48, 0x83, 0xEC, 0x30,
+ 0x80, 0x3D, 0x00, 0x00, 0x00, 0x00,0x00,
+ 0x74, 0x04, 0x33, 0xDB, 0xEB, 0x5A
+};
+
+STATIC CONST UINT8 AltConnectGopPrologueMask[] = {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+};
+
+STATIC CONST UINT8 AltConnectGopReplace[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+STATIC CONST UINT8 AltConnectGopReplaceMask[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
+};
+
EFI_STATUS
-OcLaunchAppleBootPicker (
+OcUnlockAppleFirmwareUI (
VOID
)
{
EFI_STATUS Status;
APPLE_FIRMWARE_USER_INTERFACE_PROTOCOL *FirmwareUI;
- UINT8 *aGopAlreadyConnected;
+ UINT32 ReplaceCount;
Status = gBS->LocateProtocol (
&gAppleFirmwareUserInterfaceProtocolGuid,
@@ -540,11 +574,11 @@ OcLaunchAppleBootPicker (
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "OC: Cannot locate FirmwareUI protocol - %r\n", Status));
+ DEBUG ((DEBUG_INFO, "OCB: Cannot locate FirmwareUI protocol - %r\n", Status));
} else if (FirmwareUI->Revision != APPLE_FIRMWARE_USER_INTERFACE_PROTOCOL_REVISION) {
DEBUG ((
DEBUG_INFO,
- "OC: Launch Apple picker incompatible FirmwareUI protocol revision %u != %u\n",
+ "OCB: Unlock FirmwareUI incompatible protocol revision %u != %u\n",
FirmwareUI->Revision,
APPLE_FIRMWARE_USER_INTERFACE_PROTOCOL_REVISION
));
@@ -552,19 +586,63 @@ OcLaunchAppleBootPicker (
}
if (!EFI_ERROR (Status)) {
- //
- // Location of relevant byte variable within loaded driver.
- //
- aGopAlreadyConnected = (VOID *)((UINT8 *)FirmwareUI + sizeof (APPLE_FIRMWARE_USER_INTERFACE_PROTOCOL));
+ ReplaceCount = ApplyPatch (
+ ConnectGopPrologue,
+ ConnectGopPrologueMask,
+ sizeof (ConnectGopPrologue),
+ ConnectGopReplace,
+ ConnectGopReplaceMask,
+ (VOID *)FirmwareUI->ConnectGop,
+ sizeof (ConnectGopPrologue),
+ 1,
+ 0
+ );
+
+ if (ReplaceCount == 0) {
+ ReplaceCount = ApplyPatch (
+ AltConnectGopPrologue,
+ AltConnectGopPrologueMask,
+ sizeof (AltConnectGopPrologue),
+ AltConnectGopReplace,
+ AltConnectGopReplaceMask,
+ (VOID *)FirmwareUI->ConnectGop,
+ sizeof (AltConnectGopPrologue),
+ 1,
+ 0
+ );
+ }
- if (*aGopAlreadyConnected != 1) {
- DEBUG ((DEBUG_WARN, "OC: Cannot force reconnect Apple GOP %u\n", *aGopAlreadyConnected));
- } else {
- *aGopAlreadyConnected = 0;
- DEBUG ((DEBUG_INFO, "OC: Force reconnect Apple GOP\n"));
+ Status = EFI_SUCCESS;
+ if (ReplaceCount == 0) {
+ Status = EFI_NOT_FOUND;
+ DEBUG ((
+ DEBUG_INFO,
+ "OCB: 0x%016LX 0x%016LX 0x%016LX\n",
+ *((UINT64 *)((UINT8 *)FirmwareUI->ConnectGop)),
+ *((UINT64 *)(((UINT8 *)FirmwareUI->ConnectGop) + 8)),
+ *((UINT64 *)(((UINT8 *)FirmwareUI->ConnectGop) + 16))
+ ));
}
+
+ DEBUG ((
+ EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
+ "OCB: FirmwareUI ConnectGop patch - %r\n",
+ Status
+ ));
}
+ return Status;
+}
+
+EFI_STATUS
+OcLaunchAppleBootPicker (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ OcUnlockAppleFirmwareUI ();
+
Status = OcRunFirmwareApplication (&gAppleBootPickerFileGuid, TRUE);
return Status;
diff --git a/Library/OcConfigurationLib/OcConfigurationLib.c b/Library/OcConfigurationLib/OcConfigurationLib.c
index fb687f872a7..389675d44f9 100644
--- a/Library/OcConfigurationLib/OcConfigurationLib.c
+++ b/Library/OcConfigurationLib/OcConfigurationLib.c
@@ -727,6 +727,7 @@ OC_SCHEMA
OC_SCHEMA_BOOLEAN_IN ("ReloadOptionRoms", OC_GLOBAL_CONFIG, Uefi.Quirks.ReloadOptionRoms),
OC_SCHEMA_BOOLEAN_IN ("RequestBootVarRouting", OC_GLOBAL_CONFIG, Uefi.Quirks.RequestBootVarRouting),
OC_SCHEMA_INTEGER_IN ("ResizeGpuBars", OC_GLOBAL_CONFIG, Uefi.Quirks.ResizeGpuBars),
+ OC_SCHEMA_BOOLEAN_IN ("ResizeUsePciRbIo", OC_GLOBAL_CONFIG, Uefi.Quirks.ResizeUsePciRbIo),
OC_SCHEMA_INTEGER_IN ("TscSyncTimeout", OC_GLOBAL_CONFIG, Uefi.Quirks.TscSyncTimeout),
OC_SCHEMA_BOOLEAN_IN ("UnblockFsConnect", OC_GLOBAL_CONFIG, Uefi.Quirks.UnblockFsConnect)
};
diff --git a/Library/OcConsoleLib/ConsoleControl.c b/Library/OcConsoleLib/ConsoleControl.c
index 07a2561d20a..fda7e2bdb18 100644
--- a/Library/OcConsoleLib/ConsoleControl.c
+++ b/Library/OcConsoleLib/ConsoleControl.c
@@ -72,9 +72,9 @@ OcConsoleControlSetMode (
EFI_STATUS
OcConsoleControlInstallProtocol (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *NewProtocol,
- OUT EFI_CONSOLE_CONTROL_PROTOCOL *OldProtocol OPTIONAL,
- OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *OldMode OPTIONAL
+ IN EFI_CONSOLE_CONTROL_PROTOCOL *NewProtocol,
+ OUT EFI_CONSOLE_CONTROL_PROTOCOL *OldProtocol OPTIONAL,
+ IN OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *OldMode OPTIONAL
)
{
EFI_STATUS Status;
diff --git a/Library/OcConsoleLib/OcConsoleLib.inf b/Library/OcConsoleLib/OcConsoleLib.inf
index b5c8227d7b3..e0ac9d386b3 100644
--- a/Library/OcConsoleLib/OcConsoleLib.inf
+++ b/Library/OcConsoleLib/OcConsoleLib.inf
@@ -66,6 +66,7 @@
BaseMemoryLib
DebugLib
OcBlitLib
+ OcMiscLib
MtrrLib
UefiBootServicesTableLib
UefiRuntimeServicesTableLib
diff --git a/Library/OcConsoleLib/OcConsoleLibInternal.h b/Library/OcConsoleLib/OcConsoleLibInternal.h
index 78a3716d6e4..f8d4565f146 100644
--- a/Library/OcConsoleLib/OcConsoleLibInternal.h
+++ b/Library/OcConsoleLib/OcConsoleLibInternal.h
@@ -49,11 +49,14 @@ OcSetConsoleModeForProtocol (
IN UINT32 Height
);
+//
+// Note: OldMode remains unchanged if no native console control protocol implementation is found.
+//
EFI_STATUS
OcConsoleControlInstallProtocol (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *NewProtocol,
- OUT EFI_CONSOLE_CONTROL_PROTOCOL *OldProtocol OPTIONAL,
- OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *OldMode OPTIONAL
+ IN EFI_CONSOLE_CONTROL_PROTOCOL *NewProtocol,
+ OUT EFI_CONSOLE_CONTROL_PROTOCOL *OldProtocol OPTIONAL,
+ IN OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *OldMode OPTIONAL
);
EFI_STATUS
diff --git a/Library/OcConsoleLib/TextOutputBuiltin.c b/Library/OcConsoleLib/TextOutputBuiltin.c
index 63dd0ca8b9e..dd9c038325d 100644
--- a/Library/OcConsoleLib/TextOutputBuiltin.c
+++ b/Library/OcConsoleLib/TextOutputBuiltin.c
@@ -162,6 +162,7 @@ STATIC UINTN mConsoleWidth;
STATIC UINTN mConsoleHeight;
STATIC UINTN mConsoleMaxPosX;
STATIC UINTN mConsoleMaxPosY;
+STATIC BOOLEAN mConsoleHasCleared;
STATIC UINTN mPrivateColumn; ///< At least UEFI Shell trashes Mode values.
STATIC UINTN mPrivateRow; ///< At least UEFI Shell trashes Mode values.
STATIC UINT32 mConsoleGopMode;
@@ -381,27 +382,31 @@ RenderResync (
return EFI_OUT_OF_RESOURCES;
}
- mConsoleGopMode = mGraphicsOutput->Mode->Mode;
- mConsoleWidth = (Info->HorizontalResolution / TGT_CHAR_WIDTH) - 2 * SCR_PADD;
- mConsoleHeight = (Info->VerticalResolution / TGT_CHAR_HEIGHT) - 2 * SCR_PADD;
- mConsoleMaxPosX = 0;
- mConsoleMaxPosY = 0;
+ mConsoleGopMode = mGraphicsOutput->Mode->Mode;
+ mConsoleWidth = (Info->HorizontalResolution / TGT_CHAR_WIDTH) - 2 * SCR_PADD;
+ mConsoleHeight = (Info->VerticalResolution / TGT_CHAR_HEIGHT) - 2 * SCR_PADD;
+ mConsoleMaxPosX = 0;
+ mConsoleMaxPosY = 0;
+ mConsoleHasCleared = FALSE;
mPrivateColumn = mPrivateRow = 0;
This->Mode->CursorColumn = This->Mode->CursorRow = 0;
- mGraphicsOutput->Blt (
- mGraphicsOutput,
- &mBackgroundColor.Pixel,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- Info->HorizontalResolution,
- Info->VerticalResolution,
- 0
- );
+ if (mConsoleMode == EfiConsoleControlScreenText) {
+ mGraphicsOutput->Blt (
+ mGraphicsOutput,
+ &mBackgroundColor.Pixel,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ Info->HorizontalResolution,
+ Info->VerticalResolution,
+ 0
+ );
+ }
+
return EFI_SUCCESS;
}
@@ -737,13 +742,25 @@ AsciiTextClearScreen (
}
}
- //
- // X coordinate points to the right most coordinate of the last printed
- // character, but after this character we may also have cursor.
- // Y coordinate points to the top most coordinate of the last printed row.
- //
- Width = TGT_PADD_WIDTH + (mConsoleMaxPosX + 1) * TGT_CHAR_WIDTH;
- Height = TGT_PADD_HEIGHT + (mConsoleMaxPosY + 1) * TGT_CHAR_HEIGHT;
+ if (mConsoleHasCleared) {
+ //
+ // X coordinate points to the right most coordinate of the last printed
+ // character, but after this character we may also have cursor.
+ // Y coordinate points to the top most coordinate of the last printed row.
+ //
+ Width = TGT_PADD_WIDTH + (mConsoleMaxPosX + 1) * TGT_CHAR_WIDTH;
+ Height = TGT_PADD_HEIGHT + (mConsoleMaxPosY + 1) * TGT_CHAR_HEIGHT;
+ Width = MIN (Width, mGraphicsOutput->Mode->Info->HorizontalResolution);
+ Height = MIN (Height, mGraphicsOutput->Mode->Info->VerticalResolution);
+ } else {
+ //
+ // Clear full screen at least once when console clear screen is requested
+ // after switch to new mode.
+ //
+ Width = mGraphicsOutput->Mode->Info->HorizontalResolution;
+ Height = mGraphicsOutput->Mode->Info->VerticalResolution;
+ mConsoleHasCleared = TRUE;
+ }
mGraphicsOutput->Blt (
mGraphicsOutput,
@@ -753,8 +770,8 @@ AsciiTextClearScreen (
0,
0,
0,
- MIN (Width, mGraphicsOutput->Mode->Info->HorizontalResolution),
- MIN (Height, mGraphicsOutput->Mode->Info->VerticalResolution),
+ Width,
+ Height,
0
);
@@ -891,7 +908,13 @@ ConsoleControlSetMode (
IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
)
{
- mConsoleMode = Mode;
+ if (mConsoleMode != Mode) {
+ mConsoleMode = Mode;
+ if (mConsoleMode == EfiConsoleControlScreenText) {
+ gST->ConOut->ClearScreen (gST->ConOut);
+ }
+ }
+
return EFI_SUCCESS;
}
@@ -968,13 +991,14 @@ OcUseBuiltinTextOutput (
mFontScale = 1;
}
- DEBUG ((DEBUG_INFO, "OCC: Using builtin text renderer with %d scale\n", mFontScale));
+ DEBUG ((DEBUG_INFO, "OCC: Using builtin text renderer scale %u mode %u\n", mFontScale, Mode));
- Status = AsciiTextResetEx (&mAsciiTextOutputProtocol, TRUE, TRUE);
+ mConsoleMode = Mode;
+ Status = AsciiTextResetEx (&mAsciiTextOutputProtocol, TRUE, TRUE);
if (!EFI_ERROR (Status)) {
- OcConsoleControlSetMode (Mode);
OcConsoleControlInstallProtocol (&mConsoleControlProtocol, NULL, NULL);
+ OcConsoleControlSetMode (Mode);
gST->ConOut = &mAsciiTextOutputProtocol;
gST->Hdr.CRC32 = 0;
diff --git a/Library/OcConsoleLib/TextOutputSystem.c b/Library/OcConsoleLib/TextOutputSystem.c
index 47253f88c18..b122c54cc91 100644
--- a/Library/OcConsoleLib/TextOutputSystem.c
+++ b/Library/OcConsoleLib/TextOutputSystem.c
@@ -344,11 +344,11 @@ OcUseSystemTextOutput (
));
if (Renderer == OcConsoleRendererSystemGraphics) {
+ OcConsoleControlInstallProtocol (&mConsoleControlProtocol, NULL, NULL);
OcConsoleControlSetMode (EfiConsoleControlScreenGraphics);
- OcConsoleControlInstallProtocol (&mConsoleControlProtocol, NULL, &mConsoleMode);
} else if (Renderer == OcConsoleRendererSystemText) {
+ OcConsoleControlInstallProtocol (&mConsoleControlProtocol, NULL, NULL);
OcConsoleControlSetMode (EfiConsoleControlScreenText);
- OcConsoleControlInstallProtocol (&mConsoleControlProtocol, NULL, &mConsoleMode);
} else {
OcConsoleControlInstallProtocol (&mConsoleControlProtocol, &mOriginalConsoleControlProtocol, &mConsoleMode);
}
diff --git a/Library/OcCpuLib/OcCpuLib.inf b/Library/OcCpuLib/OcCpuLib.inf
index 077ab73d9ce..b8c9a1739fb 100755
--- a/Library/OcCpuLib/OcCpuLib.inf
+++ b/Library/OcCpuLib/OcCpuLib.inf
@@ -35,6 +35,7 @@
[LibraryClasses]
BaseLib
OcGuardLib
+ OcMiscLib
OcVariableLib
IoLib
UefiRuntimeServicesTableLib
diff --git a/Library/OcCryptoLib/X64/Sha512Avx.nasm b/Library/OcCryptoLib/X64/Sha512Avx.nasm
index b87f0d02fef..461dae83b43 100644
--- a/Library/OcCryptoLib/X64/Sha512Avx.nasm
+++ b/Library/OcCryptoLib/X64/Sha512Avx.nasm
@@ -22,7 +22,7 @@ BITS 64
extern ASM_PFX(SHA512_K)
extern ASM_PFX(mIsAccelEnabled)
-section .rodata
+section RODATA_SECTION_NAME
align 16
; Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
XMM_QWORD_BSWAP:
diff --git a/Library/OcDebugLibNull/OcDebugLibNull.c b/Library/OcDebugLibNull/OcDebugLibNull.c
index d37aee45a63..1710d5e4df6 100644
--- a/Library/OcDebugLibNull/OcDebugLibNull.c
+++ b/Library/OcDebugLibNull/OcDebugLibNull.c
@@ -196,22 +196,6 @@ DebugPrintLevelEnabled (
return FALSE;
}
-/**
- Prints via gST->ConOut without any pool allocations.
- Otherwise equivalent to Print.
- Note: EFIAPI must be present for VA_ARGS forwarding (causes bugs with gcc).
-
- @param[in] Format Formatted string.
-**/
-VOID
-EFIAPI
-OcPrintScreen (
- IN CONST CHAR16 *Format,
- ...
- )
-{
-}
-
VOID
#if defined (__GNUC__) || defined (__clang__)
__attribute__ ((noinline))
@@ -258,40 +242,3 @@ DebugPrintHexDump (
)
{
}
-
-APPLE_DEBUG_LOG_PROTOCOL *
-OcAppleDebugLogInstallProtocol (
- IN BOOLEAN Reinstall
- )
-{
- return NULL;
-}
-
-VOID
-OcAppleDebugLogConfigure (
- IN BOOLEAN Enable
- )
-{
-}
-
-VOID
-OcAppleDebugLogPerfAllocated (
- IN OUT VOID *PerfBuffer,
- IN UINTN PerfBufferSize
- )
-{
-}
-
-EFI_STATUS
-OcConfigureLogProtocol (
- IN OC_LOG_OPTIONS Options,
- IN CONST CHAR8 *LogModules,
- IN UINT32 DisplayDelay,
- IN UINTN DisplayLevel,
- IN UINTN HaltLevel,
- IN CONST CHAR16 *LogPrefixPath OPTIONAL,
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *LogFileSystem OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/Library/OcDebugLibSerial/OcDebugLibSerial.c b/Library/OcDebugLibSerial/OcDebugLibSerial.c
index 7cfc94429b9..bbd13c761d3 100644
--- a/Library/OcDebugLibSerial/OcDebugLibSerial.c
+++ b/Library/OcDebugLibSerial/OcDebugLibSerial.c
@@ -367,22 +367,6 @@ DebugPrintLevelEnabled (
return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
-/**
- Prints via gST->ConOut without any pool allocations.
- Otherwise equivalent to Print.
- Note: EFIAPI must be present for VA_ARGS forwarding (causes bugs with gcc).
-
- @param[in] Format Formatted string.
-**/
-VOID
-EFIAPI
-OcPrintScreen (
- IN CONST CHAR16 *Format,
- ...
- )
-{
-}
-
VOID
#if defined (__GNUC__) || defined (__clang__)
__attribute__ ((noinline))
@@ -429,40 +413,3 @@ DebugPrintHexDump (
)
{
}
-
-APPLE_DEBUG_LOG_PROTOCOL *
-OcAppleDebugLogInstallProtocol (
- IN BOOLEAN Reinstall
- )
-{
- return NULL;
-}
-
-VOID
-OcAppleDebugLogConfigure (
- IN BOOLEAN Enable
- )
-{
-}
-
-VOID
-OcAppleDebugLogPerfAllocated (
- IN OUT VOID *PerfBuffer,
- IN UINTN PerfBufferSize
- )
-{
-}
-
-EFI_STATUS
-OcConfigureLogProtocol (
- IN OC_LOG_OPTIONS Options,
- IN CONST CHAR8 *LogModules,
- IN UINT32 DisplayDelay,
- IN UINTN DisplayLevel,
- IN UINTN HaltLevel,
- IN CONST CHAR16 *LogPrefixPath OPTIONAL,
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *LogFileSystem OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/Library/OcDeviceMiscLib/ForgeUefi.c b/Library/OcDeviceMiscLib/ForgeUefi.c
index 28726af85ed..f951fa79d45 100644
--- a/Library/OcDeviceMiscLib/ForgeUefi.c
+++ b/Library/OcDeviceMiscLib/ForgeUefi.c
@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2020, joevt. All rights reserved.
- Copyright (C) 2021, vit9696. All rights reserved.
+ Copyright (C) 2021-2023, vit9696, mikebeaton. All rights reserved.
All rights reserved.
@@ -13,13 +13,14 @@
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include
+#include
#include
#include
#include
#include
+#include
#include
#include
#include
@@ -67,23 +68,46 @@ OcCreateEventEx (
return EFI_SUCCESS;
}
+//
+// The Trash strategy relies on old Apple firmware allocating gBS and gDS consecutively.
+// This layout is directly inherited from standard edk EFI code.
+// The strategy trashes the DXE_SERVICES_SIGNATURE value in gDS->Hdr.Signature, which
+// happily is only used when the memory is being loaded (when we check for references
+// to DXE_SERVICES_SIGNATURE throughout the edk code).
+// For the Trash strategy to work, we are required to trash exactly that QWORD of memory,
+// but in the targeted firmware we can confirm that it is harmless to do so before proceeding.
+//
EFI_STATUS
OcForgeUefiSupport (
- VOID
+ IN BOOLEAN Forge,
+ IN BOOLEAN Trash
)
{
EFI_BOOT_SERVICES *NewBS;
DEBUG ((
DEBUG_INFO,
- "OCDM: Found 0x%X UEFI version (%u bytes, rebuilding to %u)\n",
+ "OCDM: Found 0x%X/0x%X UEFI version (%u bytes, %u %a to %u) gST %p gBS %p gBS->CreateEventEx %p &gBS %p\n",
gST->Hdr.Revision,
+ gBS->Hdr.Revision,
gBS->Hdr.HeaderSize,
- (UINT32)sizeof (EFI_BOOT_SERVICES)
+ Forge,
+ Trash ? "trashing" : "rebuilding",
+ (UINT32)sizeof (EFI_BOOT_SERVICES),
+ gST,
+ gBS,
+ gBS->CreateEventEx,
+ &gBS
));
+ if (!Forge) {
+ return EFI_SUCCESS;
+ }
+
//
// Already too new.
+ // This check will replace any earlier forge to 2.0 <= UEFI < 2.3.
+ // This is desirable in some cases and harmless in others.
//
if (gST->Hdr.Revision >= EFI_2_30_SYSTEM_TABLE_REVISION) {
return EFI_ALREADY_STARTED;
@@ -93,14 +117,30 @@ OcForgeUefiSupport (
return EFI_INVALID_PARAMETER;
}
- NewBS = AllocateZeroPool (sizeof (EFI_BOOT_SERVICES));
- if (NewBS == NULL) {
- DEBUG ((DEBUG_INFO, "OCDM: Failed to allocate BS copy\n"));
- return EFI_OUT_OF_RESOURCES;
+ if (Trash) {
+ if ((VOID *)&gBS->CreateEventEx != (VOID *)gDS) {
+ DEBUG ((
+ DEBUG_WARN,
+ "OCDM: Aborting trash strategy, gDS does not follow gBS\n"
+ ));
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "OCDM: Trashing gDS->Hdr.Signature with gBS->CreateEventEx\n"
+ ));
+ NewBS = gBS;
+ } else {
+ NewBS = AllocateZeroPool (sizeof (EFI_BOOT_SERVICES));
+ if (NewBS == NULL) {
+ DEBUG ((DEBUG_INFO, "OCDM: Failed to allocate BS copy\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (NewBS, gBS, gBS->Hdr.HeaderSize);
}
- CopyMem (NewBS, gBS, gBS->Hdr.HeaderSize);
-
NewBS->CreateEventEx = OcCreateEventEx;
NewBS->Hdr.HeaderSize = sizeof (EFI_BOOT_SERVICES);
NewBS->Hdr.Revision = EFI_2_30_SYSTEM_TABLE_REVISION;
@@ -113,5 +153,10 @@ OcForgeUefiSupport (
gST->Hdr.CRC32 = 0;
gST->Hdr.CRC32 = CalculateCrc32 (gST, gST->Hdr.HeaderSize);
+ if (Trash) {
+ gDS->Hdr.CRC32 = 0;
+ gDS->Hdr.CRC32 = CalculateCrc32 (gDS, gDS->Hdr.HeaderSize);
+ }
+
return EFI_SUCCESS;
}
diff --git a/Library/OcDeviceMiscLib/OcDeviceMiscLib.inf b/Library/OcDeviceMiscLib/OcDeviceMiscLib.inf
index ec0f7fa16b5..ffb4481f801 100755
--- a/Library/OcDeviceMiscLib/OcDeviceMiscLib.inf
+++ b/Library/OcDeviceMiscLib/OcDeviceMiscLib.inf
@@ -38,6 +38,7 @@
[Protocols]
gEfiPciIoProtocolGuid
+ gEfiPciRootBridgeIoProtocolGuid
gEfiDecompressProtocolGuid
# For handle parsing
@@ -62,6 +63,7 @@
PrintLib
UefiLib
UefiBootServicesTableLib
+ DxeServicesTableLib
[Sources]
ActivateHpetSupport.c
diff --git a/Library/OcDeviceMiscLib/SetResizableBar.c b/Library/OcDeviceMiscLib/SetResizableBar.c
index 0d68607101d..f95da1533e8 100644
--- a/Library/OcDeviceMiscLib/SetResizableBar.c
+++ b/Library/OcDeviceMiscLib/SetResizableBar.c
@@ -17,9 +17,11 @@
#include
#include
+#include
#include
#include
+#include
#include
#include
#include
@@ -29,7 +31,7 @@
STATIC
EFI_STATUS
-LocatePciCapability (
+LocatePciCapabilityPciIo (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT16 CapId,
OUT UINT32 *Offset
@@ -78,9 +80,79 @@ LocatePciCapability (
return EFI_NOT_FOUND;
}
+//
+// Needed to access address larger than 256
+//
+STATIC
+UINT64
+PciAddrOffset (
+ UINT64 PciAddress,
+ INT32 Offset
+ )
+{
+ UINT32 Reg = (UINT32)((PciAddress & 0xffffffff00000000) >> 32);
+ UINT8 Bus = (UINT8)((PciAddress & 0xff000000) >> 24);
+ UINT8 Dev = (UINT8)((PciAddress & 0xff0000) >> 16);
+ UINT8 Func = (UINT8)((PciAddress & 0xff00) >> 8);
+
+ return EFI_PCI_ADDRESS (Bus, Dev, Func, (Reg + Offset));
+}
+
STATIC
EFI_STATUS
-SetResizableBarOnDevice (
+LocatePciCapabilityRbIo (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
+ IN UINT64 PciAddress,
+ IN UINT16 CapId,
+ OUT UINT32 *Offset
+ )
+{
+ EFI_STATUS Status;
+ UINT32 CapabilityPtr;
+ UINT32 CapabilityEntry;
+ UINT16 CapabilityID;
+
+ CapabilityPtr = EFI_PCIE_CAPABILITY_BASE_OFFSET;
+
+ while (CapabilityPtr != 0) {
+ //
+ // Mask it to DWORD alignment per PCI spec
+ //
+ CapabilityPtr &= 0xFFC;
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ PciAddrOffset (PciAddress, CapabilityPtr),
+ 1,
+ &CapabilityEntry
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "OCDM: Capability I/O error - %r\n", Status));
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (CapabilityEntry == MAX_UINT32) {
+ DEBUG ((DEBUG_INFO, "OCDM: Read from disabled device\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CapabilityID = (UINT16)CapabilityEntry;
+
+ if (CapabilityID == CapId) {
+ DEBUG ((DEBUG_VERBOSE, "OCDM: Found CAP 0x%X at 0x%X\n", CapabilityID, CapabilityPtr));
+ *Offset = CapabilityPtr;
+ return EFI_SUCCESS;
+ }
+
+ CapabilityPtr = (CapabilityEntry >> 20) & 0xFFF;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+STATIC
+EFI_STATUS
+SetResizableBarOnDevicePciIo (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN PCI_BAR_SIZE Size,
IN BOOLEAN Increase
@@ -102,7 +174,7 @@ SetResizableBarOnDevice (
ChangedBars = FALSE;
- Status = LocatePciCapability (
+ Status = LocatePciCapabilityPciIo (
PciIo,
PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID,
&ResizableBarOffset
@@ -309,8 +381,234 @@ SetResizableBarOnDevice (
return EFI_SUCCESS;
}
+STATIC
EFI_STATUS
-ResizeGpuBars (
+SetResizableBarOnDeviceRbIo (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
+ IN UINT64 PciAddress,
+ IN PCI_BAR_SIZE Size,
+ IN BOOLEAN Increase
+ )
+{
+ EFI_STATUS Status;
+ UINT32 ResizableBarOffset;
+ PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY Entries[PCI_MAX_BAR];
+ PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CONTROL ResizableBarControl;
+ UINT32 Offset;
+ UINT32 Index;
+ UINT32 ResizableBarNumber;
+ UINT64 Capabilities;
+ UINT64 NewCapabilities;
+ UINT32 OldBar[PCI_MAX_BAR];
+ UINT32 NewBar[PCI_MAX_BAR];
+ INTN Bit;
+
+ Status = LocatePciCapabilityRbIo (
+ PciRootBridgeIo,
+ PciAddress,
+ PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID,
+ &ResizableBarOffset
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "OCDM: RBAR is unsupported by device - %r\n", Status));
+ return EFI_UNSUPPORTED;
+ }
+
+ ResizableBarControl.Uint32 = 0;
+ Offset = ResizableBarOffset + sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER)
+ + sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CAPABILITY);
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint8,
+ PciAddrOffset (PciAddress, Offset),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CONTROL),
+ &ResizableBarControl
+ );
+
+ DEBUG ((
+ DEBUG_INFO,
+ "OCDM: RBAR control is %X, total %u - %r\n",
+ ResizableBarControl.Uint32,
+ MIN (ResizableBarControl.Bits.ResizableBarNumber, PCI_MAX_BAR),
+ Status
+ ));
+
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ ResizableBarNumber = MIN (ResizableBarControl.Bits.ResizableBarNumber, PCI_MAX_BAR);
+
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint8,
+ PciAddrOffset (PciAddress, ResizableBarOffset + sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER)),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY) * ResizableBarNumber,
+ Entries
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "OCDM: RBAR caps cannot be read - %r\n", Status));
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ PciAddrOffset (PciAddress, OFFSET_OF (PCI_TYPE00, Device.Bar)),
+ PCI_MAX_BAR,
+ OldBar
+ );
+ if (EFI_ERROR (Status)) {
+ ZeroMem (OldBar, sizeof (OldBar));
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "OCDM: Old BAR %08X %08X %08X %08X %08X %08X - %r\n",
+ OldBar[0],
+ OldBar[1],
+ OldBar[2],
+ OldBar[3],
+ OldBar[4],
+ OldBar[5],
+ Status
+ ));
+
+ for (Index = 0; Index < ResizableBarNumber; Index++) {
+ //
+ // When the bit of Capabilities Set, indicates that the Function supports
+ // operating with the BAR sized to (2^Bit) MB.
+ // Example:
+ // Bit 0 is set: supports operating with the BAR sized to 1 MB
+ // Bit 1 is set: supports operating with the BAR sized to 2 MB
+ // Bit n is set: supports operating with the BAR sized to (2^n) MB
+ //
+ // Reference values for RX 6900 with two resizable BARs.
+ // Disabled values:
+ // Resizeable Bar Capability [1]
+ // ResizableBarCapability 0007F000
+ // ResizableBarControl 0840
+ // Resizeable Bar Capability [2]
+ // ResizableBarCapability 00001FE0
+ // ResizableBarControl 0102
+ // Enabled values:
+ // Resizeable Bar Capability [1]
+ // ResizableBarCapability 0007F000
+ // ResizableBarControl 0E40
+ // Resizeable Bar Capability [2]
+ // ResizableBarCapability 00001FE0
+ // ResizableBarControl 0802
+ //
+ NewCapabilities = Capabilities = LShiftU64 (Entries[Index].ResizableBarControl.Bits.BarSizeCapability, 28)
+ | Entries[Index].ResizableBarCapability.Bits.BarSizeCapability;
+
+ //
+ // Restrict supported BARs to specified value.
+ //
+ NewCapabilities &= PCI_BAR_CAP_LIMIT (Size);
+
+ //
+ // Disable bits higher than current as we are not allowed to increase bar size
+ // more than we already have.
+ //
+ if (!Increase) {
+ NewCapabilities &= PCI_BAR_CAP_LIMIT (Entries[Index].ResizableBarControl.Bits.BarSize);
+ }
+
+ //
+ // If requested BAR size is too low, choose the lowest available BAR size.
+ //
+ if ( (NewCapabilities == 0)
+ && (Entries[Index].ResizableBarControl.Bits.BarSize > (UINT32)Size))
+ {
+ Bit = LowBitSet64 (Capabilities);
+ } else {
+ Bit = HighBitSet64 (NewCapabilities);
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "OCDM: RBAR %u/%u supports 0x%Lx, sizing %u inc %d results setting from %u to %d\n",
+ Index + 1,
+ ResizableBarNumber,
+ Capabilities,
+ Size,
+ Increase,
+ Entries[Index].ResizableBarControl.Bits.BarSize,
+ (INT32)Bit
+ ));
+
+ //
+ // If we have no supported configuration, just skip.
+ //
+ if ((Bit < 0) || (Entries[Index].ResizableBarControl.Bits.BarSize == (UINT32)Bit)) {
+ continue;
+ }
+
+ Offset = ResizableBarOffset + sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER)
+ + Index * sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY)
+ + OFFSET_OF (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY, ResizableBarControl);
+
+ Entries[Index].ResizableBarControl.Bits.BarSize = (UINT32)Bit;
+ PciRootBridgeIo->Pci.Write (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ PciAddrOffset (PciAddress, Offset),
+ 1,
+ &Entries[Index].ResizableBarControl.Uint32
+ );
+ }
+
+ DEBUG_CODE_BEGIN ();
+
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ PciAddrOffset (PciAddress, OFFSET_OF (PCI_TYPE00, Device.Bar)),
+ PCI_MAX_BAR,
+ NewBar
+ );
+ if (EFI_ERROR (Status)) {
+ ZeroMem (NewBar, sizeof (NewBar));
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "OCDM: New BAR %08X %08X %08X %08X %08X %08X - %r\n",
+ NewBar[0],
+ NewBar[1],
+ NewBar[2],
+ NewBar[3],
+ NewBar[4],
+ NewBar[5],
+ Status
+ ));
+
+ DEBUG_CODE_END ();
+
+ //
+ // PCI BARs are reset after resizing, so we must restore them. This follows the spec:
+ // After writing the BAR Size field, the contents of the corresponding BAR are undefined.
+ // To ensure that it contains a valid address after resizing the BAR, system software must
+ // reprogram the BAR, and Set the Memory Space Enable bit (unless the resource is not allocated).
+ // TODO: We do not bother touching `Memory Space Enable` bit but strictly we should.
+ //
+ if (!IsZeroBuffer (OldBar, sizeof (OldBar))) {
+ Status = PciRootBridgeIo->Pci.Write (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ PciAddrOffset (PciAddress, OFFSET_OF (PCI_TYPE00, Device.Bar)),
+ PCI_MAX_BAR,
+ OldBar
+ );
+ DEBUG ((DEBUG_INFO, "OCDM: Reprogrammed BARs to original - %r\n", Status));
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ResizeGpuBarsPciIo (
IN PCI_BAR_SIZE Size,
IN BOOLEAN Increase
)
@@ -376,15 +674,194 @@ ResizeGpuBars (
Index+1,
HandleCount
));
- Status = SetResizableBarOnDevice (PciIo, Size, Increase);
+ Status = SetResizableBarOnDevicePciIo (PciIo, Size, Increase);
if (!EFI_ERROR (Status)) {
HasSuccess = TRUE;
}
}
+ FreePool (HandleBuffer);
+
if (HasSuccess) {
return EFI_SUCCESS;
}
return EFI_NOT_FOUND;
}
+
+STATIC
+BOOLEAN
+PciGetNextBusRange (
+ IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
+ OUT UINT16 *MinBus,
+ OUT UINT16 *MaxBus
+ )
+{
+ //
+ // When *Descriptors is NULL, Configuration() is not implemented, so assume
+ // range is 0~PCI_MAX_BUS
+ //
+ if ((*Descriptors) == NULL) {
+ *MinBus = 0;
+ *MaxBus = PCI_MAX_BUS;
+ return FALSE;
+ }
+
+ //
+ // *Descriptors points to one or more address space descriptors, which
+ // ends with a end tagged descriptor. Examine each of the descriptors,
+ // if a bus typed one is found and its bus range covers bus, this handle
+ // is the handle we are looking for.
+ //
+
+ while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
+ if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
+ *MinBus = (UINT16)(*Descriptors)->AddrRangeMin;
+ *MaxBus = (UINT16)(*Descriptors)->AddrRangeMax;
+ (*Descriptors)++;
+ return FALSE;
+ }
+
+ (*Descriptors)++;
+ }
+
+ return TRUE;
+}
+
+STATIC
+EFI_STATUS
+ResizeGpuBarsRbIo (
+ IN PCI_BAR_SIZE Size,
+ IN BOOLEAN Increase
+ )
+{
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+ UINT8 HdrType;
+ UINT8 Bus;
+ UINT8 Dev;
+ UINT8 Func;
+ UINT16 MinBus;
+ UINT16 MaxBus;
+ BOOLEAN IsEnd;
+ BOOLEAN HasSuccess;
+ PCI_CLASSCODE ClassCode;
+ UINT64 PciAddress;
+
+ ASSERT (Size < PciBarTotal);
+
+ HasSuccess = FALSE;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "OCDM: No PCI devices for RBAR support - %r\n", Status));
+ return Status;
+ }
+
+ for (Index = 0; Index < HandleCount; ++Index) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiPciRootBridgeIoProtocolGuid,
+ (VOID **)&PciRootBridgeIo
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **)&Descriptors);
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ //
+ // Not sure if multiple root bridge systems even exist but this should support them
+ //
+ while (TRUE) {
+ IsEnd = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus);
+
+ if (IsEnd || (Descriptors == NULL)) {
+ break;
+ }
+
+ for (Bus = 0; Bus <= MaxBus; Bus++) {
+ for (Dev = 0; Dev <= PCI_MAX_DEVICE; Dev++) {
+ for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
+ PciAddress = EFI_PCI_ADDRESS (Bus, Dev, Func, 0);
+
+ // PciAddrOffset doesnt need to be used below 256
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint8,
+ PciAddress + PCI_CLASSCODE_OFFSET,
+ sizeof (PCI_CLASSCODE) / sizeof (UINT8),
+ &ClassCode
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ DEBUG ((DEBUG_VERBOSE, "OCDM: PCI device %u/%u/%u has class %X\n", Bus, Dev, Func, ClassCode));
+
+ if (ClassCode.BaseCode != PCI_CLASS_DISPLAY) {
+ continue;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "OCDM: Setting RBAR to %u inc %d on %u/%u/%u\n",
+ Size,
+ Increase,
+ Bus,
+ Dev,
+ Func
+ ));
+ Status = SetResizableBarOnDeviceRbIo (PciRootBridgeIo, PciAddress, Size, Increase);
+ if (!EFI_ERROR (Status)) {
+ HasSuccess = TRUE;
+ }
+
+ PciRootBridgeIo->Pci.Read (PciRootBridgeIo, EfiPciWidthUint8, PciAddress + PCI_HEADER_TYPE_OFFSET, 1, &HdrType);
+ if (!Func && ((HdrType & HEADER_TYPE_MULTI_FUNCTION) == 0)) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ FreePool (HandleBuffer);
+
+ if (HasSuccess) {
+ return EFI_SUCCESS;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+EFI_STATUS
+ResizeGpuBars (
+ IN PCI_BAR_SIZE Size,
+ IN BOOLEAN Increase,
+ IN BOOLEAN UseRbIo
+ )
+{
+ if (UseRbIo) {
+ DEBUG ((DEBUG_INFO, "OCDM: RBAR using PciRootBridgeIo\n"));
+ return ResizeGpuBarsRbIo (Size, Increase);
+ }
+
+ DEBUG ((DEBUG_INFO, "OCDM: RBAR using PciIo\n"));
+ return ResizeGpuBarsPciIo (Size, Increase);
+}
diff --git a/Library/OcLogAggregatorLib/OcLogAggregatorLib.inf b/Library/OcLogAggregatorLib/OcLogAggregatorLib.inf
index 0af7ef6e85c..ab8eae1fe05 100755
--- a/Library/OcLogAggregatorLib/OcLogAggregatorLib.inf
+++ b/Library/OcLogAggregatorLib/OcLogAggregatorLib.inf
@@ -22,7 +22,7 @@
FILE_GUID = 2D7559C7-CB17-426A-927D-69BBCD270A9A
MODULE_TYPE = BASE
VERSION_STRING = 1.0
- LIBRARY_CLASS = DebugLib
+ LIBRARY_CLASS = OcLogAggregatorLib
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
diff --git a/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.c b/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.c
new file mode 100644
index 00000000000..6a83611388d
--- /dev/null
+++ b/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.c
@@ -0,0 +1,59 @@
+/** @file
+ Null OcLogAggregatorLib instance.
+
+ Copyright (c) 2023, Mike Beaton. All rights reserved.
+ SPDX-License-Identifier: BSD-3-Clause
+**/
+
+#include
+
+#include
+#include
+#include
+#include
+
+VOID
+EFIAPI
+OcPrintScreen (
+ IN CONST CHAR16 *Format,
+ ...
+ )
+{
+}
+
+APPLE_DEBUG_LOG_PROTOCOL *
+OcAppleDebugLogInstallProtocol (
+ IN BOOLEAN Reinstall
+ )
+{
+ return NULL;
+}
+
+VOID
+OcAppleDebugLogConfigure (
+ IN BOOLEAN Enable
+ )
+{
+}
+
+VOID
+OcAppleDebugLogPerfAllocated (
+ IN OUT VOID *PerfBuffer,
+ IN UINTN PerfBufferSize
+ )
+{
+}
+
+EFI_STATUS
+OcConfigureLogProtocol (
+ IN OC_LOG_OPTIONS Options,
+ IN CONST CHAR8 *LogModules,
+ IN UINT32 DisplayDelay,
+ IN UINTN DisplayLevel,
+ IN UINTN HaltLevel,
+ IN CONST CHAR16 *LogPrefixPath OPTIONAL,
+ IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *LogFileSystem OPTIONAL
+ )
+{
+ return EFI_UNSUPPORTED;
+}
diff --git a/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.inf b/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.inf
new file mode 100755
index 00000000000..f67c7b2e1ba
--- /dev/null
+++ b/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.inf
@@ -0,0 +1,25 @@
+## @file
+#
+# Component description file for null instance of OC Log Aggregator Library using the OcLog protocol.
+#
+# Copyright (C) 2023, Mike Beaton. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = OcLogAggregatorLibNull
+ FILE_GUID = B748F380-1479-4014-B873-4185E514B54F
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = OcLogAggregatorLib
+
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+
+[Packages]
+ OpenCorePkg/OpenCorePkg.dec
+ MdePkg/MdePkg.dec
+
+[Sources]
+ OcLogAggregatorLibNull.c
diff --git a/Library/OcMacInfoLib/AutoGenerated.c b/Library/OcMacInfoLib/AutoGenerated.c
index 7b50dff7cd9..b54bd926a68 100755
--- a/Library/OcMacInfoLib/AutoGenerated.c
+++ b/Library/OcMacInfoLib/AutoGenerated.c
@@ -583,8 +583,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 52, 48, 107, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Air",
@@ -608,8 +608,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 52, 48, 97, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Air",
@@ -633,8 +633,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 50, 51, 48, 107, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Air",
@@ -1058,8 +1058,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 54, 56, 48, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1083,8 +1083,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 51, 50, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1108,8 +1108,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 55, 56, 48, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1133,8 +1133,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 50, 49, 51, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1158,8 +1158,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 53, 50, 102, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1183,8 +1183,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 50, 49, 52, 107, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1208,8 +1208,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 50, 50, 51, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1233,8 +1233,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 50, 49, 53, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacBook Pro",
@@ -1833,8 +1833,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 54, 48, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "MacPro",
@@ -2108,8 +2108,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 55, 52, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "Mac mini",
@@ -2758,8 +2758,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 56, 53, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "iMac",
@@ -2783,8 +2783,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 56, 53, 102, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "iMac",
@@ -3008,8 +3008,8 @@ CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {
.SmcRevision = {0},
.SmcBranch = {0},
.SmcPlatform = {106, 49, 51, 55, 0, 0, 0, 0},
- .BIOSVersion = "1916.60.2.0.0",
- .BIOSReleaseDate = "11/30/2022",
+ .BIOSVersion = "1916.80.2.0.0",
+ .BIOSReleaseDate = "12/21/2022",
.SystemVersion = "1.0",
.SystemSKUNumber = "",
.SystemFamily = "iMac Pro",
diff --git a/Library/OcMachoLib/Fat.c b/Library/OcMachoLib/MachoFat.c
similarity index 100%
rename from Library/OcMachoLib/Fat.c
rename to Library/OcMachoLib/MachoFat.c
diff --git a/Library/OcMachoLib/OcMachoLib.inf b/Library/OcMachoLib/OcMachoLib.inf
index d36e0f8b91d..3158fa0a47d 100644
--- a/Library/OcMachoLib/OcMachoLib.inf
+++ b/Library/OcMachoLib/OcMachoLib.inf
@@ -31,7 +31,7 @@
[Sources]
CxxSymbols.c
CxxSymbolsX.h
- Fat.c
+ MachoFat.c
Header.c
HeaderX.h
OcMachoLibInternal.h
diff --git a/Library/OcMainLib/OpenCoreAcpi.c b/Library/OcMainLib/OpenCoreAcpi.c
index 769006cead9..254dff79568 100644
--- a/Library/OcMainLib/OpenCoreAcpi.c
+++ b/Library/OcMainLib/OpenCoreAcpi.c
@@ -140,6 +140,7 @@ OcAcpiPatchTables (
EFI_STATUS Status;
UINT32 Index;
OC_ACPI_PATCH_ENTRY *UserPatch;
+ CONST CHAR8 *Comment;
OC_ACPI_PATCH Patch;
for (Index = 0; Index < Config->Acpi.Patch.Count; ++Index) {
@@ -149,6 +150,8 @@ OcAcpiPatchTables (
continue;
}
+ Comment = OC_BLOB_GET (&UserPatch->Comment);
+
//
// Ignore patch if:
// - There is nothing to replace.
@@ -161,7 +164,7 @@ OcAcpiPatchTables (
|| ((UserPatch->Mask.Size > 0) && (UserPatch->Find.Size != UserPatch->Mask.Size))
|| ((UserPatch->ReplaceMask.Size > 0) && (UserPatch->Replace.Size != UserPatch->ReplaceMask.Size)))
{
- DEBUG ((DEBUG_ERROR, "OC: ACPI patch %u is borked\n", Index));
+ DEBUG ((DEBUG_ERROR, "OC: ACPI patch (%a) at %u is borked\n", Comment, Index));
continue;
}
@@ -190,16 +193,17 @@ OcAcpiPatchTables (
DEBUG ((
DEBUG_INFO,
- "OC: Applying %u byte ACPI patch patch at %u, skip %u, count %u\n",
+ "OC: Applying %u byte ACPI patch (%a) at %u, skip %u, count %u\n",
Patch.Size,
- (UINT32)Index,
+ Comment,
+ Index,
Patch.Skip,
Patch.Count
));
Status = AcpiApplyPatch (Context, &Patch);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_WARN, "OC: ACPI patcher failed %u - %r\n", Index, Status));
+ DEBUG ((DEBUG_WARN, "OC: ACPI patcher failed (%a) at %u - %r\n", Comment, Index, Status));
}
}
}
diff --git a/Library/OcMainLib/OpenCoreUefi.c b/Library/OcMainLib/OpenCoreUefi.c
index 0e3ffd80a44..813e022436a 100644
--- a/Library/OcMainLib/OpenCoreUefi.c
+++ b/Library/OcMainLib/OpenCoreUefi.c
@@ -693,6 +693,7 @@ OcLoadBooterUefiSupport (
AbcSettings.ProvideMaxSlide = Config->Booter.Quirks.ProvideMaxSlide;
AbcSettings.ProtectUefiServices = Config->Booter.Quirks.ProtectUefiServices;
AbcSettings.RebuildAppleMemoryMap = Config->Booter.Quirks.RebuildAppleMemoryMap;
+ AbcSettings.ResizeUsePciRbIo = Config->Uefi.Quirks.ResizeUsePciRbIo;
AbcSettings.ResizeAppleGpuBars = Config->Booter.Quirks.ResizeAppleGpuBars;
AbcSettings.SetupVirtualMap = Config->Booter.Quirks.SetupVirtualMap;
AbcSettings.SignalAppleOS = Config->Booter.Quirks.SignalAppleOS;
@@ -940,9 +941,7 @@ OcLoadUefiSupport (
OcInstallPermissiveSecurityPolicy ();
}
- if (Config->Uefi.Quirks.ForgeUefiSupport) {
- OcForgeUefiSupport ();
- }
+ OcForgeUefiSupport (Config->Uefi.Quirks.ForgeUefiSupport, FALSE);
if (Config->Uefi.Quirks.ReloadOptionRoms) {
OcReloadOptionRoms ();
@@ -956,8 +955,8 @@ OcLoadUefiSupport (
if ( (Config->Uefi.Quirks.ResizeGpuBars >= 0)
&& (Config->Uefi.Quirks.ResizeGpuBars < PciBarTotal))
{
- DEBUG ((DEBUG_INFO, "OC: Increasing GPU BARs to %d\n", Config->Uefi.Quirks.ResizeGpuBars));
- ResizeGpuBars (Config->Uefi.Quirks.ResizeGpuBars, TRUE);
+ DEBUG ((DEBUG_INFO, "OC: Setting GPU BARs to %d\n", Config->Uefi.Quirks.ResizeGpuBars));
+ ResizeGpuBars (Config->Uefi.Quirks.ResizeGpuBars, TRUE, Config->Uefi.Quirks.ResizeUsePciRbIo);
}
OcMiscUefiQuirksLoaded (Config);
diff --git a/Library/OcStringLib/OcStringLib.inf b/Library/OcStringLib/OcStringLib.inf
index 151264bcc32..e63915e35fb 100755
--- a/Library/OcStringLib/OcStringLib.inf
+++ b/Library/OcStringLib/OcStringLib.inf
@@ -43,5 +43,6 @@
BaseLib
BaseMemoryLib
MemoryAllocationLib
+ OcGuardLib
PrintLib
SortLib
diff --git a/OpenCorePkg.dec b/OpenCorePkg.dec
index 24c168194a3..6832118e2ae 100755
--- a/OpenCorePkg.dec
+++ b/OpenCorePkg.dec
@@ -744,6 +744,12 @@
## @Prompt Use Pin Capabilities to identify audio outputs.
gOpenCorePkgTokenSpaceGuid.PcdAudioControllerUsePinCapsForOutputs|TRUE|BOOLEAN|0x00000008
+ ## Indicates whether to build EnableGop driver with DirectGopRendering.
+ ## TRUE - DirectGopRendering will be used.
+ ## FALSE - DirectGopRendering will not be used.
+ ## @Prompt Use DirectGopRendering.
+ gOpenCorePkgTokenSpaceGuid.PcdEnableGopDirect|FALSE|BOOLEAN|0x00000009
+
[PcdsFixedAtBuild]
## Defines the Console Control initialization mode set on entry.
## 0 - EfiConsoleControlScreenText
diff --git a/OpenCorePkg.dsc b/OpenCorePkg.dsc
index 86484eb8df2..00dd22ed9c2 100755
--- a/OpenCorePkg.dsc
+++ b/OpenCorePkg.dsc
@@ -22,6 +22,7 @@
BUILD_TARGETS = RELEASE|DEBUG|NOOPT
SKUID_IDENTIFIER = DEFAULT
DSC_SPECIFICATION = 0x00010006
+ FLASH_DEFINITION = OpenCorePkg/OpenCorePkg.fdf
#
# Network definition
@@ -204,6 +205,7 @@
OpenCorePkg/Application/GopPerf/GopPerf.inf
OpenCorePkg/Application/GopStop/GopStop.inf
OpenCorePkg/Application/KeyTester/KeyTester.inf
+ OpenCorePkg/Application/ListPartitions/ListPartitions.inf
OpenCorePkg/Application/MmapDump/MmapDump.inf
OpenCorePkg/Application/OpenControl/OpenControl.inf
OpenCorePkg/Application/OpenCore/OpenCore.inf {
@@ -270,6 +272,7 @@
OpenCorePkg/Library/OcHiiDatabaseLib/OcHiiDatabaseLocalLib.inf
OpenCorePkg/Library/OcInputLib/OcInputLib.inf
OpenCorePkg/Library/OcLogAggregatorLib/OcLogAggregatorLib.inf
+ OpenCorePkg/Library/OcLogAggregatorLibNull/OcLogAggregatorLibNull.inf
OpenCorePkg/Library/OcMachoLib/OcMachoLib.inf
OpenCorePkg/Library/OcMainLib/OcMainLib.inf
OpenCorePkg/Library/OcMemoryLib/OcMemoryLib.inf
@@ -319,6 +322,14 @@
OpenCorePkg/Platform/ResetNvramEntry/ResetNvramEntry.inf
OpenCorePkg/Platform/ToggleSipEntry/ToggleSipEntry.inf
OpenCorePkg/Staging/AudioDxe/AudioDxe.inf
+ OpenCorePkg/Staging/EnableGop/EnableGop.inf {
+
+ DebugLib|OpenCorePkg/Library/OcDebugLibNull/OcDebugLibNull.inf
+ }
+ OpenCorePkg/Staging/EnableGop/EnableGopDirect.inf {
+
+ DebugLib|OpenCorePkg/Library/OcDebugLibNull/OcDebugLibNull.inf
+ }
OpenCorePkg/Staging/OpenHfsPlus/OpenHfsPlus.inf
OpenCorePkg/Tests/AcpiTest/AcpiTest.inf
OpenCorePkg/Tests/AcpiTest/AcpiTestApp.inf
@@ -420,11 +431,4 @@
XCODE:NOOPT_*_*_CC_FLAGS = $(OCPKG_BUILD_OPTIONS_GEN) $(OCPKG_ANAL_OPTIONS_GEN) -fstack-protector-strong -ftrivial-auto-var-init=pattern
XCODE:RELEASE_*_*_CC_FLAGS = $(OCPKG_BUILD_OPTIONS_GEN) $(OCPKG_ANAL_OPTIONS_GEN) -Oz -flto -fstack-protector-strong -ftrivial-auto-var-init=pattern
- # Force page alignment for all files allowing for page protection.
- GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
- XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000
- XCODE:*_*_*_MTOC_FLAGS = -align 0x1000
- CLANGPDB:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:512
- CLANGGCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
-
!include NetworkPkg/NetworkBuildOptions.dsc.inc
diff --git a/OpenCorePkg.fdf b/OpenCorePkg.fdf
new file mode 100644
index 00000000000..99162e3b8ac
--- /dev/null
+++ b/OpenCorePkg.fdf
@@ -0,0 +1,107 @@
+## @file
+# Compile standalone firmware filesystem files.
+#
+# Copyright (C) 2022-2023, Mike Beaton. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+##
+
+#
+# For now disable non-64-bit build; Mac Pro cannot use it, and EDK-II
+# build system does not separate 64 bit and 32 bit .ffs files, which
+# we want to distribute.
+#
+# If we needed all archs in future we could distribute the complete
+# .fv files, from which the .ffs can be re-extracted.
+#
+!if ($(ARCH) == X64)
+
+!if ($(ARCH) == X64)
+ [FV.FfsFilesX64]
+!else
+ [FV.FfsFilesIA32]
+!endif
+
+ BlockSize = 0x10000
+ NumBlocks = 8
+ FvAlignment = 16 #FV alignment and FV attributes setting.
+ ERASE_POLARITY = 1
+ MEMORY_MAPPED = TRUE
+ STICKY_WRITE = TRUE
+ LOCK_CAP = TRUE
+ LOCK_STATUS = TRUE
+ WRITE_DISABLED_CAP = TRUE
+ WRITE_ENABLED_CAP = TRUE
+ WRITE_STATUS = TRUE
+ WRITE_LOCK_CAP = TRUE
+ WRITE_LOCK_STATUS = TRUE
+ READ_DISABLED_CAP = TRUE
+ READ_ENABLED_CAP = TRUE
+ READ_STATUS = TRUE
+ READ_LOCK_CAP = TRUE
+ READ_LOCK_STATUS = TRUE
+
+ #
+ # DXE Drivers (other .inf files for conversion to .ffs may be added here)
+ #
+ INF OpenCorePkg/Staging/EnableGop/EnableGop.inf
+
+!if ($(ARCH) == X64)
+ [FV.EnableGopDirectX64]
+!else
+ [FV.EnableGopDirectIA32]
+!endif
+
+ BlockSize = 0x10000
+ NumBlocks = 8
+ FvAlignment = 16 #FV alignment and FV attributes setting.
+ ERASE_POLARITY = 1
+ MEMORY_MAPPED = TRUE
+ STICKY_WRITE = TRUE
+ LOCK_CAP = TRUE
+ LOCK_STATUS = TRUE
+ WRITE_DISABLED_CAP = TRUE
+ WRITE_ENABLED_CAP = TRUE
+ WRITE_STATUS = TRUE
+ WRITE_LOCK_CAP = TRUE
+ WRITE_LOCK_STATUS = TRUE
+ READ_DISABLED_CAP = TRUE
+ READ_ENABLED_CAP = TRUE
+ READ_STATUS = TRUE
+ READ_LOCK_CAP = TRUE
+ READ_LOCK_STATUS = TRUE
+
+ #
+ # DXE Drivers
+ #
+
+ #
+ # EnableGopDirect intentionally has the same GUID as EnableGop, so it must go in a separate FV.
+ # (We don't care about the FV, rather the intermediate FFS files which are generated during build.)
+ #
+ INF OpenCorePkg/Staging/EnableGop/EnableGopDirect.inf
+
+!endif
+
+#
+# Uses patched GenSec to support legacy TianoCompress compression, producing an ffs which matches
+# those found in legacy Mac firmware.
+#
+# Removing the wrapping COMPRESS and GUIDED sections below gives an uncompressed ffs from non-patched
+# tools which Mac legacy firmware can read (at about four times the size of the compressed version).
+#
+# Using standard (PI_STD) COMPRESS produces a compressed ffs which legacy Mac firmware cannot read.
+#
+# Note: `GUIDED A31280AD-481E-41B6-95E8-127F4C984779` with standard tools makes a Tiano compressed
+# GUIDED section, but this is different from a Tiano compressed COMPRESS section and legacy Mac
+# firmware also cannot read it.
+#
+[Rule.Common.DXE_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) Checksum {
+ COMPRESS TIANO {
+ GUIDED {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME) $(VERSION_STRING)" Optional
+ }
+ }
+ }
diff --git a/Platform/CrScreenshotDxe/CrScreenshotDxe.inf b/Platform/CrScreenshotDxe/CrScreenshotDxe.inf
index ba6dbf9b6f7..d738e334583 100644
--- a/Platform/CrScreenshotDxe/CrScreenshotDxe.inf
+++ b/Platform/CrScreenshotDxe/CrScreenshotDxe.inf
@@ -25,8 +25,9 @@
UefiDriverEntryPoint
DebugLib
PrintLib
- OcPngLib
OcFileLib
+ OcMiscLib
+ OcPngLib
[Protocols]
gEfiGraphicsOutputProtocolGuid
diff --git a/Platform/OpenCanopy/OcBootstrap.c b/Platform/OpenCanopy/OcBootstrap.c
index 1db57e876e9..b52f27fd028 100644
--- a/Platform/OpenCanopy/OcBootstrap.c
+++ b/Platform/OpenCanopy/OcBootstrap.c
@@ -195,6 +195,20 @@ OcShowMenuByOc (
GuiDrawLoop (&mDrawContext);
ASSERT (mGuiContext.BootEntry != NULL || mGuiContext.Refresh);
+ //
+ // There are reasons to prefer not to perform this screen clear:
+ // - If starting macOS, boot.efi performs the same screen clear to the same UI theme colour
+ // immediately afterwards anyway
+ // - The native Apple picker does not clear its graphics before exit (i.e. does not do this)
+ // - Most OS booters in most circumstance perform their own screen clear
+ // - Each screen clear on a slow GOP (such as direct GOP rendering) is a noticeable slowdown
+ // However:
+ // - Windows without ACPI->Quirks->ResetLogoStatus does not clear any pre-existing graphics
+ // - Ref: https://github.com/acidanthera/bugtracker/issues/2231
+ // - Peforming this screen clear gives a sense of progress (i.e. something happens immediately
+ // rather than nothing) if the selected entry will be very slow to start (e.g. Recovery, in
+ /// some circumstances)
+ //
if (!mGuiContext.Refresh) {
//
// Clear the screen only when we exit.
@@ -261,10 +275,17 @@ OcShowPasswordByOc (
GuiRedrawAndFlushScreen (&mDrawContext);
GuiDrawLoop (&mDrawContext);
+
//
- // Clear the screen only if we will not show BootPicker afterwards.
+ // This screen clear is useful, even though the boot entry started will in general
+ // perform its own screen clear eventually anyway, since this gives a better sense
+ // of progress between (intentionally slow - computationally intensive) password
+ // verification and (can be slow) start of Recovery.
//
if (Context->PickerCommand != OcPickerShowPicker) {
+ //
+ // Clear the screen only if we will not show BootPicker afterwards.
+ //
GuiClearScreen (&mDrawContext, &mGuiContext.BackgroundColor.Pixel);
}
diff --git a/Platform/OpenVariableRuntimeDxe/VariableDxe.c b/Platform/OpenVariableRuntimeDxe/VariableDxe.c
index b2ee7d55535..b89022efa12 100644
--- a/Platform/OpenVariableRuntimeDxe/VariableDxe.c
+++ b/Platform/OpenVariableRuntimeDxe/VariableDxe.c
@@ -648,10 +648,8 @@ VariableServiceInitialize (
)
{
EFI_STATUS Status;
- UINTN OffsetQVI;
- UINTN HeaderQVI;
- EFI_EVENT EndOfDxeEvent;
EFI_EVENT ReadyToBootEvent;
+ EFI_EVENT EndOfDxeEvent;
EFI_CREATE_EVENT_EX OriginalCreateEventEx;
SaveAcpiGlobalVariable (SystemTable);
@@ -686,18 +684,16 @@ VariableServiceInitialize (
//
// Avoid setting UEFI 2.x interface member on EFI 1.x.
//
- // First test all systable elements as some may have been spoofed and pass a limited element check
- // Then check that QueryVariableInfo is specifically available before setting the interface member
- //
- if ( ((SystemTable->Hdr.Revision >> 16U) > 1)
- && ((SystemTable->BootServices->Hdr.Revision >> 16U) > 1)
- && ((SystemTable->RuntimeServices->Hdr.Revision >> 16U) > 1))
- {
- OffsetQVI = OFFSET_OF (EFI_RUNTIME_SERVICES, QueryVariableInfo);
- HeaderQVI = OffsetQVI + sizeof (SystemTable->RuntimeServices->QueryVariableInfo);
- if (SystemTable->RuntimeServices->Hdr.HeaderSize >= HeaderQVI) {
- SystemTable->RuntimeServices->QueryVariableInfo = VariableServiceQueryVariableInfo;
- }
+ // Note 1: It is always desirable to overwrite the value here if it already exists:
+ // we need a consistent runtime variable implementation.
+ //
+ // Note 2: We ignore the theoretical situation where some other spoofer has modified
+ // the gRT header revision but not allocated sufficient space for this method,
+ // since this is a highly theoretical 'problem', and providing a solution for
+ // it over-complicates the code, instead of just over-complicating this comment.
+ //
+ if (SystemTable->RuntimeServices->Hdr.Revision >= EFI_2_00_SYSTEM_TABLE_REVISION) {
+ SystemTable->RuntimeServices->QueryVariableInfo = VariableServiceQueryVariableInfo;
}
//
diff --git a/Staging/AudioDxe/HdaCodec/HdaCodec.c b/Staging/AudioDxe/HdaCodec/HdaCodec.c
index 09885a2677a..f5473cf8099 100644
--- a/Staging/AudioDxe/HdaCodec/HdaCodec.c
+++ b/Staging/AudioDxe/HdaCodec/HdaCodec.c
@@ -840,6 +840,12 @@ HdaCodecProbeCodec (
}
}
+ // Do not support codecs without audio function groups (i.e. modem codecs).
+ if (HdaCodecDev->AudioFuncGroup == NULL) {
+ DEBUG ((DEBUG_INFO, "HDA: | Codec contains no audio function groups\n"));
+ return EFI_UNSUPPORTED;
+ }
+
return EFI_SUCCESS;
}
diff --git a/Staging/EnableGop/EnableGop.c b/Staging/EnableGop/EnableGop.c
new file mode 100644
index 00000000000..971d77d0d57
--- /dev/null
+++ b/Staging/EnableGop/EnableGop.c
@@ -0,0 +1,132 @@
+/** @file
+ Provide GOP on unsupported graphics cards on EFI-era MacPro and iMac.
+
+ Copyright (c) 2022-2023, Mike Beaton. All rights reserved.
+ SPDX-License-Identifier: BSD-3-Clause
+**/
+
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+STATIC EFI_GET_MEMORY_SPACE_MAP mOriginalGetMemorySpaceMap;
+
+//
+// Equivalent to a very cut down OcLoadUefiOutputSupport.
+//
+STATIC
+EFI_STATUS
+LoadUefiOutputSupport (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = OcProvideConsoleGop (FALSE);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ OcSetConsoleResolution (
+ 0,
+ 0,
+ 0,
+ FALSE
+ );
+
+ if (FeaturePcdGet (PcdEnableGopDirect)) {
+ OcUseDirectGop (-1);
+ }
+
+ OcSetupConsole (
+ OcConsoleRendererBuiltinGraphics,
+ FALSE,
+ FALSE,
+ FALSE,
+ FALSE
+ );
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+ProvideGop (
+ VOID
+ )
+{
+ OcUnlockAppleFirmwareUI ();
+
+ return LoadUefiOutputSupport ();
+}
+
+//
+// This memory map access happens twice during PlatformBdsPolicyBehavior, once
+// in the equivalent of efi InitializeMemoryTest at the start of the function,
+// and once during PlatformBdsDiagnostics, slightly later. The second call(s)
+// (there is more than one code path, depending on the boot type) are after
+// the default console has been connected, and therefore ideal for us.
+//
+EFI_STATUS
+EFIAPI
+WrappedGetMemorySpaceMap (
+ OUT UINTN *NumberOfDescriptors,
+ OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap
+ )
+{
+ STATIC UINTN mGetMemorySpaceMapAccessCount = 0;
+
+ mGetMemorySpaceMapAccessCount++;
+
+ if (mGetMemorySpaceMapAccessCount == 2) {
+ ProvideGop ();
+ }
+
+ return mOriginalGetMemorySpaceMap (
+ NumberOfDescriptors,
+ MemorySpaceMap
+ );
+}
+
+STATIC
+VOID
+WrapGetMemorySpaceMap (
+ VOID
+ )
+{
+ mOriginalGetMemorySpaceMap = gDS->GetMemorySpaceMap;
+ gDS->GetMemorySpaceMap = WrappedGetMemorySpaceMap;
+
+ gDS->Hdr.CRC32 = 0;
+ gBS->CalculateCrc32 (gDS, gDS->Hdr.HeaderSize, &gDS->Hdr.CRC32);
+}
+
+//
+// If we execute the entire console setup at Driver#### time then we have to forge UEFI, reload option ROMs
+// and connect them, all at that point.
+// This works on some systems but causes crashes others, or causes an empty picker with question mark folder.
+// Current strategy is:
+// - Forge UEFI early; relatively easy: just do it immediately, as below, and insert this driver either
+// a) anywhere in main firmware volume, or b) in VBIOS anywhere before GOP driver which needs it
+// - Execute rest of payload after option roms have been loaded, _and_ after firmware has already connected
+// them (see WrapGetMemorySpaceMap strategy above).
+// With this strategy we do not need to reload or reconnect any option ROMs, which is much more stable.
+//
+EFI_STATUS
+EFIAPI
+UefiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ OcForgeUefiSupport (TRUE, TRUE);
+ WrapGetMemorySpaceMap ();
+
+ return EFI_SUCCESS;
+}
diff --git a/Staging/EnableGop/EnableGop.inf b/Staging/EnableGop/EnableGop.inf
new file mode 100644
index 00000000000..c75afed0dfa
--- /dev/null
+++ b/Staging/EnableGop/EnableGop.inf
@@ -0,0 +1,46 @@
+## @file
+#
+# Provide GOP on unsupported graphics cards on EFI-era MacPro and iMac.
+#
+# Copyright (c) 2022-2023, Mike Beaton. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = EnableGop
+ FILE_GUID = 3FBA58B1-F8C0-41BC-ACD8-253043A3A17F
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.1
+ ENTRY_POINT = UefiMain
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ EnableGop.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OpenCorePkg/OpenCorePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DxeServicesTableLib
+ OcBootManagementLib
+ OcConsoleLib
+ OcDeviceMiscLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+
+[FeaturePcd]
+ gOpenCorePkgTokenSpaceGuid.PcdEnableGopDirect|FALSE
+
+[Depex]
+ TRUE
diff --git a/Staging/EnableGop/EnableGopDirect.inf b/Staging/EnableGop/EnableGopDirect.inf
new file mode 100644
index 00000000000..483d332a903
--- /dev/null
+++ b/Staging/EnableGop/EnableGopDirect.inf
@@ -0,0 +1,46 @@
+## @file
+#
+# Provide GOP on unsupported graphics cards on EFI-era MacPro and iMac using DirectGopRendering.
+#
+# Copyright (c) 2023, Mike Beaton. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = EnableGopDirect
+ FILE_GUID = 3FBA58B1-F8C0-41BC-ACD8-253043A3A17F
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.1
+ ENTRY_POINT = UefiMain
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ EnableGop.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OpenCorePkg/OpenCorePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DxeServicesTableLib
+ OcBootManagementLib
+ OcConsoleLib
+ OcDeviceMiscLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+
+[FeaturePcd]
+ gOpenCorePkgTokenSpaceGuid.PcdEnableGopDirect|TRUE
+
+[Depex]
+ TRUE
diff --git a/Staging/EnableGop/README.md b/Staging/EnableGop/README.md
new file mode 100644
index 00000000000..a4224c33b10
--- /dev/null
+++ b/Staging/EnableGop/README.md
@@ -0,0 +1,158 @@
+# Provides standalone GOP driver for EFI era Mac Pro and iMac
+
+## Releases
+
+EnableGop version (OpenCore version)
+### 1.1 (0.9.0)
+ - Fixed early verbose boot lines appearing over picker
+ - Added EnableGop version number to UI section
+
+### 1.0 (0.8.9)
+ - Initial public release
+
+## Status
+**Current status: Beta release.**
+
+This driver has been tested and is working on several iMac models
+with several different GPUs, and on several MacPro4,1/5,1 machines with several different GPUs. However, in the worst
+case (and still possible) scenario, an incompatible or incorrectly installed driver
+in firmware may brick your hardware.
+
+*In all cases take a backup of the main firmware or vBIOS firmware which you are modifying, and confirm that
+you can successfully restore from this, before starting.*
+
+## Recovery from bricked hardware
+ - If attempting firmware insertion on a MacPro4,1/5,1, for recovery from a bricked device you will either
+need a Matt card (which may breach intellectual property laws in some jurisdictions) or the ability to
+desolder and reprogram your own NVRAM chip.
+ - If testing via firmware insertion on an iMac, you will need the ability to disassemble your iMac and
+reprogram its NVRAM chip using a SOIC clip attached to a CH341A controller running on another computer.
+ - If testing via vBIOS insertion (iMac or Mac Pro), you will need the ability to disassemble your system,
+likely remove the heat sink from the graphics card, and then reprogram its NVRAM chip using a SOIC
+clip attached to a CH341A controller running on another computer.
+ - If testing via vBIOS insertion, in some cases it may also be possible
+to use physical electrical connection to your GPU NVRAM chip in order to boot with no graphics, then connect
+to your machine with `ssh` (which must have been enabled beforehand) and reprogram the GPU NVRAM. Advice on
+this is not provided here, but may be found for instance on the iMac GPU related forum threads listed below.
+
+*If you are not familiar with the above procedures, you are strongly recommended to wait for further testing by
+users who are. No further help can be provided here, and you proceed entirely at your own risk.*
+
+## Summary
+Targetting EFI-era (~2009-2012) MacPro4,1/5,1 and iMac firmware, this driver gathers and injects the parts of
+OpenCore needed for pre-boot graphics support with non-natively supported GPUs.
+
+The requirements for using this driver are:
+
+ - EFI-era (~2009-2012) MacPro4,1/5,1 or iMac with most recent firmware.
+ - A GPU which does not produce native pre-boot graphics (such as native picker when pressing ALT key during boot)
+ before OpenCore starts (otherwise, you do not need it).
+ - A GPU which produces graphics when using OpenCore (this must include successfully showing the native Apple boot
+ picker when started via the latest version of OpenCore tool `BootKicker.efi`) (otherwise, the driver will not work).
+ - *Note*: If your OpenCore installation includes a required GOP driver for your graphics card (this is added
+ automatically on some systems by recent versions of OpenCore Legacy Patcher, as a way to enable OpenCore menu
+ in cards such as ex-mining GPUs), then you would also need to burn that driver to the vBIOS of your graphics
+ card in order to obtain pre-OpenCore graphics; instructions for this are outside the scope of this tutorial,
+ although the procedures required for modifying vBIOS are similar to what is covered here.
+
+When installed, the driver should enable:
+
+ - Native boot picker via ALT key
+ - Firmware password UI
+ - Target disk mode UI
+ - macOS boot progress screen
+ - etc.
+
+Compiled versions of the driver files and these instructions may be found in the `Utilities/EnableGop`
+directory of the OpenCore release package.
+
+For GPUs needing `DirectGopRendering` in OpenCore configuration, use `EnableGopDirect.efi`, otherwise use `EnableGop.efi`
+as it renders faster on most other systems.
+
+The driver may be installed to vBIOS or to main firmware. It is expected that most Mac Pro users will use firmware insertion
+and most iMac users will chose vBIOS insertion, however both techniques work on both systems (but it is harder to modify the
+iMac firmware, since there is no simple way to enable writing to it).
+
+Further discussion and community support for this driver is available at:
+
+ - https://forums.macrumors.com/threads/pre-opencore-gop-support-for-efi-era-imacs-and-mac-pros.2378942/
+
+## Usage
+
+## Install to firmware
+
+For reading and writing to firmware on the Mac Pro, @Macschrauber's [Rom Dump](https://youtu.be/yHnZeht_isU) works
+well. Alternatively the kexts and executables which this uses can be sourced individually (or extracted from the Rom Dump app) and
+run from the command line.
+
+The firmware on the iMac cannot be updated without an initial hardware flash (SOIC clip plus CH341A controller), therefore
+the recommended approach on iMac systems is [vBIOS injection](#install-to-vBIOS). However, the below instructions for firmware
+injection do work, if you are willing to do a hardware flash of the resulting firmware file, or if you have already
+[unprotected your iMac firmware](https://forums.macrumors.com/threads/imac-2011-see-more-uefi-firmware-mod.2257435/page-3?post=31087001#post-31087001) -
+which reduces security, and is only recommended for those actively developing firmware modifications.
+
+The `.ffs` file provided in this directory can be manually added to the extracted firmware file using [`UEFITool`](https://github.com/LongSoft/UEFITool),
+or automatically added using @dosdude1's [`DXEInject`](https://dosdude1.com/apps/). Once more, if you are not familiar with these procedures,
+you are recommended to proceed with extreme caution.
+
+### Using DXEInject
+
+To install the driver via `DXEInject`, the command is:
+
+ - `DXEInject {original}.rom {modified}.rom EnableGop.ffs`
+
+The file `{modifed}.rom` is ready for burning, although the result can be checked using UEFITool, if required.
+
+> *Note*: If only reading a file with UEFITool, the latest version is recommended, as it provides the most information.
+For writing, the older version 0.25.1 must be used, as described below.
+
+### Using UEFITool
+
+The `.ffs` file may be inserted anywhere within the same firmware volume which contains `DuetBds`
+(file GUID `A6F691AC-31C8-4444-854C-E2C1A6950F92`). However, for simplicity, these instructions
+will insert it in the same place that `DXEInject` does:
+
+ - Use UEFITool 0.25.1 (it must be that old version, not the newer NE or new engine versions, which
+cannot yet edit)
+ - Perform a header-only GUID search for `BAE7599F-3C6B-43B7-BDF0-9CE07AA91AA6`
+ - Double-click on the search result
+ - Right-click on the DXE driver with that GUID which should then appear
+ - Choose "Insert after..." and select `EnableGop.ffs`
+ - Save the modified firmware
+
+The end result, after saving and re-loading, should look like this:
+
+
+
+## Install to vBIOS
+
+Instructions and a script for inserting the driver into Nvidia or AMD vBIOS are provided.
+
+Please note all the cautions already given above about the difficulty of recovering, unless you are familiar with
+the procedures necessary, if this process fails.
+
+To use the provided `vBiosInsert.sh` script:
+
+ - Locate an appropriate version of the `nvflash` tool (Nvidia) or `amdvbflash` tool (AMD) (both are available for
+ Linux and Windows), which can be used to read from and write to the GPU vBIOS.
+ - Use that tool to read a copy of the vBIOS.
+ - Run `./vBiosInsertEfi.sh [-a|-n] {original}.rom EnableGop.efi {modified}.rom`, with `-a` for AMD and `-n` for Nvidia.
+ - The new file `{modified}.rom` may be burnt to the vBIOS firmware.
+
+In the case of AMD, considerably less space is normally available, due to a strict limit of 128k for legacy and EFI
+parts of the larger ROM image. If there is not enough space (i.e. script reports
+data would be truncated) then it is necessary to [strip some legacy VGA parts of the
+vBIOS](https://github.com/Ausdauersportler/IMAC-EFI-BOOT-SCREEN/wiki/Deleting-the-VGA). This is beyond the scope
+of these instructions.
+
+If required to manually detect the GOP offset (this should normally be autodetected):
+
+> Using a hex editor, search in the vBIOS for the byte sequence `F1 0E 00 00` with the byte sequence `55 AA` coming
+ close before it; the start address of the `55 AA` is the GOP offset value needed.
+
+For further information on vBIOS modification, see:
+
+ - https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
+ - https://forums.macrumors.com/threads/imac-2011-maxwell-and-pascal-gpu-upgrade.2300989/
+ - https://github.com/Ausdauersportler/IMAC-EFI-BOOT-SCREEN/wiki
+ - https://winraid.level1techs.com/t/amd-and-nvidia-gop-update-no-requests-diy/30917
diff --git a/Staging/EnableGop/UEFITool_Inserted_Screenshot.png b/Staging/EnableGop/UEFITool_Inserted_Screenshot.png
new file mode 100644
index 00000000000..13681fa56df
Binary files /dev/null and b/Staging/EnableGop/UEFITool_Inserted_Screenshot.png differ
diff --git a/Staging/EnableGop/vBiosInsert.sh b/Staging/EnableGop/vBiosInsert.sh
new file mode 100755
index 00000000000..dec1a5bda3c
--- /dev/null
+++ b/Staging/EnableGop/vBiosInsert.sh
@@ -0,0 +1,274 @@
+#!/bin/bash
+
+#
+# Copyright © 2023 Mike Beaton. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Insert EFI into AMD or Nvidia VBIOS.
+# Tested back to Mac OS X 10.11 El Capitan.
+#
+
+usage() {
+ echo "Usage: ./${SELFNAME} [args] {rom-file} {efi-file} {out-file}"
+ echo "Args:"
+ echo " -a : AMD"
+ echo " -n : Nvidia"
+ echo " -o {GOP offset} : GOP offset (auto-detected if Homebrew grep is installed)"
+ echo " Can specify 0x{hex} or {decimal}"
+ echo " -t {temp dir} : Specify temporary directory, and keep temp files"
+ echo "Examples:"
+ echo " ./${SELFNAME} -n -o 0xFC00 nv.rom EnableGop.efi nv_mod.rom"
+ echo " ./${SELFNAME} -n nv.rom EnableGop.efi nv_mod.rom"
+ echo " ./${SELFNAME} -a amd.rom EnableGop.efi amd_mod.rom"
+ echo ""
+}
+
+SELFNAME="$(/usr/bin/basename "${0}")"
+
+commands=(
+ "EfiRom"
+ "UEFIRomExtract"
+ "hexdump"
+ "grep"
+)
+
+FOUND=1
+for command in "${commands[@]}"; do
+ if ! command -v "$command" 1>/dev/null ; then
+ echo "${command} not available!"
+ FOUND=0
+ fi
+done
+
+if [ "$FOUND" -eq 0 ] ; then
+ exit 1
+fi
+
+AMD=0
+AMD_SAFE_SIZE="0x20000"
+GOP_OFFSET="-"
+NVIDIA=0
+POS=0
+
+while true; do
+ if [ "$1" = "-a" ] ; then
+ AMD=1
+ NVIDIA=0
+ shift
+ elif [ "$1" = "-n" ] ; then
+ AMD=0
+ NVIDIA=1
+ shift
+ elif [ "$1" = "-o" ] ; then
+ shift
+ if [ "$1" != "" ] && ! [ "${1:0:1}" = "-" ] ; then
+ GOP_OFFSET=$1
+ shift
+ else
+ echo "No GOP offset specified" && exit 1
+ fi
+ elif [ "$1" = "-s" ] ; then # semi-secret option to modify AMD safe size
+ shift
+ if [ "$1" != "" ] && ! [ "${1:0:1}" = "-" ] ; then
+ AMD_SAFE_SIZE=$1
+ shift
+ else
+ echo "No AMD safe size specified" && exit 1
+ fi
+ elif [ "$1" = "-t" ] ; then
+ shift
+ if [ "$1" != "" ] && ! [ "${1:0:1}" = "-" ] ; then
+ TEMP_DIR=$1
+ shift
+ else
+ echo "No temp dir specified" && exit 1
+ fi
+ elif [ "${1:0:1}" = "-" ] ; then
+ echo "Unknown option: ${1}" && exit 1
+ elif [ "$1" != "" ] ; then
+ case "$POS" in
+ 0 )
+ ROM_FILE="$1"
+ ;;
+ 1 )
+ EFI_FILE="$1"
+ ;;
+ 2 )
+ OUT_FILE="$1"
+ ;;
+ * )
+ echo "Too many filenames specified" && exit 1
+ ;;
+ esac
+ POS=$(($POS+1))
+ shift
+ else
+ break
+ fi
+done
+
+if [ "$ROM_FILE" = "" ] ||
+ [ "$EFI_FILE" = "" ] ||
+ [ "$OUT_FILE" = "" ] ; then
+ usage
+ exit 0
+fi
+
+if [ "$AMD" -eq 0 ] && [ "$NVIDIA" -eq 0 ] ; then
+ echo "Must specify -a or -n" && exit 1
+fi
+
+if [ "$TEMP_DIR" != "" ] ; then
+ mkdir -p "$TEMP_DIR" || exit 1
+ tmpdir="$TEMP_DIR"
+else
+ # https://unix.stackexchange.com/a/84980/340732
+ tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'vbios') || exit 1
+fi
+
+ORIGINAL_SIZE=$(stat -f%z "$ROM_FILE") || exit 1
+
+if [ "$AMD" -eq 1 ] ; then
+ if [ "$ORIGINAL_SIZE" -lt "$((AMD_SAFE_SIZE))" ] ; then
+ echo " - File size of ${ORIGINAL_SIZE} bytes must be at least safe size of $((AMD_SAFE_SIZE)) bytes; use -s or check file" && exit 1
+ fi
+
+ dd bs=1 if="$ROM_FILE" of="$tmpdir/modify_part.rom" count=$(($AMD_SAFE_SIZE)) 2>/dev/null || exit 1
+ dd bs=1 if="$ROM_FILE" of="$tmpdir/keep_part.rom" skip=$(($AMD_SAFE_SIZE)) 2>/dev/null || exit 1
+else
+ cp "$ROM_FILE" "$tmpdir/modify_part.rom" || exit 1
+ echo -n > "$tmpdir/keep_part.rom" || exit 1
+fi
+
+if [ "$GOP_OFFSET" = "-" ] ; then
+ echo "Auto-detecting GOP offset..."
+
+ # nicer techniques which do not assume nice alignment of what is being searched for do not work on older Mac OS X
+ OUTPUT=$(hexdump -C "$tmpdir/modify_part.rom" | grep '55 aa .. .. f1 0e 00 00' | head -1)
+ # Make macOS bash to split as expected:
+ # shellcheck disable=SC2206
+ GOP_ARRAY=($OUTPUT)
+ GOP_OFFSET=${GOP_ARRAY[0]}
+ if [ "$GOP_OFFSET" != "" ] ; then
+ GOP_OFFSET="0x${GOP_OFFSET}"
+ GOP_OFFSET=$(($GOP_OFFSET))
+ else
+ GOP_OFFSET=-1
+ fi
+
+ if [ "$GOP_OFFSET" -eq -1 ] ; then
+ echo " - No GOP found in ROM!" && exit 1
+ fi
+fi
+
+dd bs=1 if="$tmpdir/modify_part.rom" of="$tmpdir/original_first_part.rom" count=$(($GOP_OFFSET)) 2>/dev/null || exit 1
+dd bs=1 if="$tmpdir/modify_part.rom" of="$tmpdir/original_last_part.rom" skip=$(($GOP_OFFSET)) 2>/dev/null || exit 1
+
+echo "Compressing EFI using EfiRom..."
+if [ "$AMD" -eq 1 ] ; then
+ EfiRom -o "$tmpdir/insert.rom" -ec "$EFI_FILE" -f 0xAAAA -i 0xBBBB -l 0x30000 -p || exit 1
+else
+ EfiRom -o "$tmpdir/insert.rom" -ec "$EFI_FILE" -f 0xAAAA -i 0xBBBB -l 0x30000 || exit 1
+fi
+
+if [ "$NVIDIA" -eq 1 ] ; then
+ echo "Adding Nvidia header..."
+ dd bs=1 if="$tmpdir/insert.rom" of="$tmpdir/insert_first_part" count=$((0x38)) 2>/dev/null || exit 1
+ dd bs=1 if="$tmpdir/insert.rom" of="$tmpdir/insert_last_part" skip=$((0x38)) 2>/dev/null || exit 1
+
+ # TODO: truncation logic must be fixed for when there is not enough spare padding in output of EfiRom
+ INSERT_SIZE=$(stat -f%z "$tmpdir/insert.rom") || exit 1
+
+ # add NPDE from original GOP
+ dd bs=1 if="$tmpdir/original_last_part.rom" of="$tmpdir/insert_first_part" skip=$((0x38)) seek=$((0x38)) count=$((0x18)) 2>/dev/null || exit 1
+ cat "$tmpdir/insert_first_part" "$tmpdir/insert_last_part" > "$tmpdir/insert_oversize.rom" || exit 1
+ # Note: `truncate` command is not present by default on macOS
+ dd bs=1 if="$tmpdir/insert_oversize.rom" of="$tmpdir/insert_fixed.rom" count="$INSERT_SIZE" 2>/dev/null || exit 1
+
+ # patch size in NPDE
+ dd bs=1 if="$tmpdir/insert.rom" of="$tmpdir/insert_fixed.rom" skip=$((0x2)) seek=$((0x48)) count=1 conv=notrunc 2>/dev/null || exit 1
+else
+ cp "$tmpdir/insert.rom" "$tmpdir/insert_fixed.rom" || exit 1
+fi
+
+# patch with vendor and device id from original GOP
+dd bs=1 if="$tmpdir/original_last_part.rom" of="$tmpdir/insert_fixed.rom" skip=$((0x20)) seek=$((0x20)) count=4 conv=notrunc 2>/dev/null || exit 1
+
+if [ "$NVIDIA" -eq 1 ] ; then
+ # patch size in PCIR
+ dd bs=1 if="$tmpdir/original_last_part.rom" of="$tmpdir/insert_fixed.rom" skip=$((0x16)) seek=$((0x16)) count=1 conv=notrunc 2>/dev/null || exit 1
+
+ # patch end marker in NPDE in fixed ROM (leave PCIR correct and EFI extractable from fixed ROM)
+ echo -n -e '\x00' | dd bs=1 of="$tmpdir/insert_fixed.rom" seek=$((0x4A)) conv=notrunc 2>/dev/null || exit 1
+fi
+
+echo "Combining..."
+cat "$tmpdir/original_first_part.rom" "$tmpdir/insert_fixed.rom" "$tmpdir/original_last_part.rom" > "$tmpdir/combined.rom" || exit 1
+
+TRUNCATE=0
+if [ "$AMD" -eq 1 ] ; then
+ TRUNCATE=1
+ TRUNCATE_SIZE="$AMD_SAFE_SIZE"
+else
+ printf '%x' "$ORIGINAL_SIZE" | grep -q "000$" && TRUNCATE=1
+ if [ "$TRUNCATE" -eq 1 ] ; then
+ echo "Detected standard ROM size, truncating to original size..."
+ TRUNCATE_SIZE="$ORIGINAL_SIZE"
+ fi
+fi
+if [ "$TRUNCATE" -eq 1 ] ; then
+ dd bs=1 if="$tmpdir/combined.rom" of="$tmpdir/truncated.rom" count="$TRUNCATE_SIZE" 2>/dev/null || exit 1
+
+ COUNT=$(hexdump -v -e '1/8 " %016X\n"' "$tmpdir/truncated.rom" | tail -n 8 | grep "FFFFFFFFFFFFFFFF" | wc -l)
+ if [ "$COUNT" -ne 8 ] ; then
+ # Some Nvidia ROMs, at least, incorrectly have 00000000 padding after active contents
+ # (it is incorrect, since writing only active contents using nvflash resets the rest to ffffffff).
+ # May also be relevant if we ever have any truly 00000000 default ROM images.
+ COUNT=$(hexdump -v -e '1/8 " %016X\n"' "$tmpdir/truncated.rom" | tail -n 8 | grep "0000000000000000" | wc -l)
+ fi
+
+ if [ "$COUNT" -ne 8 ] ; then
+ echo " - Not enough space within $((TRUNCATE_SIZE / 1024))k limit - aborting!" && exit 1
+ fi
+
+ cat "$tmpdir/truncated.rom" "$tmpdir/keep_part.rom" > "$OUT_FILE" || exit 1
+else
+ cp "$tmpdir/combined.rom" "$OUT_FILE" || exit 1
+fi
+
+# patch end marker in PCIR in out file
+echo -n -e '\x00' | dd bs=1 of="$OUT_FILE" seek=$(($GOP_OFFSET + 0x31)) conv=notrunc 2>/dev/null || exit 1
+
+printf "Verifying (starting at 0x%X)...\n" "$GOP_OFFSET"
+dd bs=1 if="$OUT_FILE" of="$tmpdir/out_efi_part.rom" skip=$(($GOP_OFFSET)) 2>/dev/null || exit 1
+# UEFIRomExtract error messages are on stdout, so we cannot suppress unwanted normal output here
+UEFIRomExtract "$tmpdir/out_efi_part.rom" "$tmpdir/extracted.efi" || exit 1
+ERROR=0
+diff "$tmpdir/extracted.efi" "$EFI_FILE" 1>/dev/null || ERROR=1
+
+if [ "$ERROR" -ne 0 ] ; then
+ echo " - Failure comparing extracted EFI to original!"
+fi
+
+OLD_EFI_COUNT=$(EfiRom -d "$tmpdir/original_last_part.rom" | grep "0x0EF1" | wc -l) || exit 1
+OLD_EFI_COUNT=$(($OLD_EFI_COUNT)) || exit 1
+
+NEW_EFI_COUNT=$(EfiRom -d "$tmpdir/out_efi_part.rom" | grep "0x0EF1" | wc -l) || exit 1
+NEW_EFI_COUNT=$(($NEW_EFI_COUNT)) || exit 1
+
+if [ "$NEW_EFI_COUNT" -ne $(($OLD_EFI_COUNT + 1)) ] ; then
+ echo " - ${OLD_EFI_COUNT} EFI parts in original ROM, and detected ${NEW_EFI_COUNT} EFI parts in modified ROM, expected $(($OLD_EFI_COUNT + 1))!"
+ ERROR=1
+fi
+
+if [ "$ERROR" -eq 0 ] ; then
+ echo "SUCCESS."
+else
+ echo "*** WARNING - FAIL ***"
+fi
+
+if [ "$TEMP_DIR" = "" ] ; then
+ rm -rf "$tmpdir" || exit 1
+fi
+
+echo "Done."
diff --git a/Staging/README.md b/Staging/README.md
index 77aa9f6fd31..57f4fab444f 100755
--- a/Staging/README.md
+++ b/Staging/README.md
@@ -1,8 +1,11 @@
Staging drivers considered experimental and not production ready.
-## OpenHfsPlus
-This driver implements HFS+ support with bless extensions.
-
## AudioDxe
Improved audio driver (currently only Intel HD audio).
HDMI or other digital outputs don't work.
+
+## EnableGop
+Standalone firmware-embeddable driver for non-native GPU support on EFI-era Mac Pro and iMac.
+
+## OpenHfsPlus
+This driver implements HFS+ support with bless extensions.
diff --git a/User/Include/UserBootServices.h b/User/Include/UserBootServices.h
index 6d3a067e17c..8f204e5447e 100644
--- a/User/Include/UserBootServices.h
+++ b/User/Include/UserBootServices.h
@@ -24,6 +24,12 @@ DummyRaiseTPL (
IN EFI_TPL NewTpl
);
+VOID
+EFIAPI
+DummyRestoreTPL (
+ IN EFI_TPL NewTpl
+ );
+
EFI_STATUS
EFIAPI
DummyLocateProtocol (
@@ -48,6 +54,14 @@ DummyInstallConfigurationTable (
IN VOID *Table
);
+EFI_STATUS
+EFIAPI
+DummyCalculateCrc32 (
+ IN VOID *Data,
+ IN UINTN DataSize,
+ OUT UINT32 *CrcOut
+ );
+
EFI_STATUS
EFIAPI
NullTextOutputString (
@@ -55,4 +69,11 @@ NullTextOutputString (
IN CHAR16 *String
);
+EFI_STATUS
+EFIAPI
+DummyGetTime (
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities
+ );
+
#endif // OC_USER_BOOT_SERVICES_H
diff --git a/User/Include/UserPcd.h b/User/Include/UserPcd.h
index 2bce935ec0e..4cd44538485 100644
--- a/User/Include/UserPcd.h
+++ b/User/Include/UserPcd.h
@@ -42,6 +42,7 @@
extern UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize;
extern BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport;
extern UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask;
+extern UINT8 _gPcd_FixedAtBuild_PcdDebugRaisePropertyMask;
extern UINT8 _gPcd_FixedAtBuild_PcdDebugClearMemoryValue;
extern UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel;
extern UINT32 _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel;
@@ -61,11 +62,13 @@ extern BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderSupportDebug;
extern BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderRemoveXForWX;
extern UINT8 _gPcd_FixedAtBuild_PcdUefiVariableDefaultLang[4];
extern UINT8 _gPcd_FixedAtBuild_PcdUefiVariableDefaultPlatformLang[6];
+extern BOOLEAN _gPcd_FeatureFlag_PcdFatReadOnlyMode;
extern UINT32 _gPcd_BinaryPatch_PcdSerialRegisterStride;
#define _PCD_GET_MODE_32_PcdUefiLibMaxPrintBufferSize _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize
#define _PCD_GET_MODE_BOOL_PcdUgaConsumeSupport _gPcd_FixedAtBuild_PcdUgaConsumeSupport
#define _PCD_GET_MODE_8_PcdDebugPropertyMask _gPcd_FixedAtBuild_PcdDebugPropertyMask
+#define _PCD_GET_MODE_8_PcdDebugRaisePropertyMask _gPcd_FixedAtBuild_PcdDebugRaisePropertyMask
#define _PCD_GET_MODE_8_PcdDebugClearMemoryValue _gPcd_FixedAtBuild_PcdDebugClearMemoryValue
#define _PCD_GET_MODE_32_PcdFixedDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel
#define _PCD_GET_MODE_32_PcdDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel
@@ -80,6 +83,7 @@ extern UINT32 _gPcd_BinaryPatch_PcdSerialRegisterStride;
#define _PCD_GET_MODE_PTR_PcdUefiVariableDefaultLang _gPcd_FixedAtBuild_PcdUefiVariableDefaultLang
#define _PCD_GET_MODE_PTR_PcdUefiVariableDefaultPlatformLang _gPcd_FixedAtBuild_PcdUefiVariableDefaultPlatformLang
#define _PCD_GET_MODE_BOOL_PcdValidateOrderedCollection ((BOOLEAN)0U)
+#define _PCD_GET_MODE_BOOL_PcdFatReadOnlyMode _gPcd_FeatureFlag_PcdFatReadOnlyMode
#define _PCD_GET_MODE_32_PcdSerialRegisterStride _gPcd_BinaryPatch_PcdSerialRegisterStride
//
// This will not be of any effect at userspace.
diff --git a/User/Include/UserUnicodeCollation.h b/User/Include/UserUnicodeCollation.h
new file mode 100644
index 00000000000..565b4ab25a5
--- /dev/null
+++ b/User/Include/UserUnicodeCollation.h
@@ -0,0 +1,146 @@
+/** @file
+ Copyright (c) 2023, Savva Mitrofanov. All rights reserved.
+ SPDX-License-Identifier: BSD-3-Clause
+**/
+
+#ifndef OC_USER_UNICODE_COLLATION_H
+#define OC_USER_UNICODE_COLLATION_H
+
+#include
+#include
+
+extern EFI_UNICODE_COLLATION_PROTOCOL gInternalUnicode2Eng;
+
+VOID
+OcUnicodeCollationInitializeMappingTables (
+ VOID
+ );
+
+/**
+ Performs a case-insensitive comparison of two Null-terminated strings.
+
+ @param This Protocol instance pointer.
+ @param Str1 A pointer to a Null-terminated string.
+ @param Str2 A pointer to a Null-terminated string.
+
+ @retval 0 Str1 is equivalent to Str2
+ @retval > 0 Str1 is lexically greater than Str2
+ @retval < 0 Str1 is lexically less than Str2
+
+**/
+INTN
+EngStriColl (
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,
+ IN CHAR16 *Str1,
+ IN CHAR16 *Str2
+ );
+
+/**
+ Converts all the characters in a Null-terminated string to
+ lower case characters.
+
+ @param This Protocol instance pointer.
+ @param Str A pointer to a Null-terminated string.
+
+**/
+VOID
+EFIAPI
+EngStrLwr (
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,
+ IN OUT CHAR16 *Str
+ );
+
+/**
+ Converts all the characters in a Null-terminated string to upper
+ case characters.
+
+ @param This Protocol instance pointer.
+ @param Str A pointer to a Null-terminated string.
+
+**/
+VOID
+EFIAPI
+EngStrUpr (
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,
+ IN OUT CHAR16 *Str
+ );
+
+/**
+ Performs a case-insensitive comparison of a Null-terminated
+ pattern string and a Null-terminated string.
+
+ @param This Protocol instance pointer.
+ @param String A pointer to a Null-terminated string.
+ @param Pattern A pointer to a Null-terminated pattern string.
+
+ @retval TRUE Pattern was found in String.
+ @retval FALSE Pattern was not found in String.
+
+**/
+BOOLEAN
+EFIAPI
+EngMetaiMatch (
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,
+ IN CHAR16 *String,
+ IN CHAR16 *Pattern
+ );
+
+/**
+ Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string.
+
+ @param This Protocol instance pointer.
+ @param FatSize The size of the string Fat in bytes.
+ @param Fat A pointer to a Null-terminated string that contains an 8.3 file
+ name using an 8-bit OEM character set.
+ @param String A pointer to a Null-terminated string. The string must
+ be preallocated to hold FatSize characters.
+
+**/
+VOID
+EFIAPI
+EngFatToStr (
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,
+ IN UINTN FatSize,
+ IN CHAR8 *Fat,
+ OUT CHAR16 *String
+ );
+
+/**
+ Converts a Null-terminated string to legal characters in a FAT
+ filename using an OEM character set.
+
+ @param This Protocol instance pointer.
+ @param String A pointer to a Null-terminated string. The string must
+ be preallocated to hold FatSize characters.
+ @param FatSize The size of the string Fat in bytes.
+ @param Fat A pointer to a Null-terminated string that contains an 8.3 file
+ name using an OEM character set.
+
+ @retval TRUE Fat is a Long File Name
+ @retval FALSE Fat is an 8.3 file name
+
+**/
+BOOLEAN
+EFIAPI
+EngStrToFat (
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,
+ IN CHAR16 *String,
+ IN UINTN FatSize,
+ OUT CHAR8 *Fat
+ );
+
+/**
+ Userspace English unicode collation protocol implementation.
+
+ This function initializes unicode character mapping and then install Unicode
+ Collation protocol on given interface.
+
+ @param[in] Interface Interface into which protocol should be installed
+
+**/
+VOID
+UserUnicodeCollationInstallProtocol (
+ OUT EFI_UNICODE_COLLATION_PROTOCOL **Interface
+ );
+
+#endif // OC_USER_UNICODE_COLLATION_H
diff --git a/User/Library/UserBaseMemoryLib.c b/User/Library/UserBaseMemoryLib.c
index 0d674be3dca..5ca47ab62b6 100644
--- a/User/Library/UserBaseMemoryLib.c
+++ b/User/Library/UserBaseMemoryLib.c
@@ -383,7 +383,7 @@ FreePages (
abort ();
}
- FreePool (Buffer);
+ free (Buffer);
}
GUID *
diff --git a/User/Library/UserBootServices.c b/User/Library/UserBootServices.c
index be3db80ee5b..e0cfd84189b 100644
--- a/User/Library/UserBootServices.c
+++ b/User/Library/UserBootServices.c
@@ -7,12 +7,15 @@
#include
#include
+#include
EFI_BOOT_SERVICES mBootServices = {
.RaiseTPL = DummyRaiseTPL,
+ .RestoreTPL = DummyRestoreTPL,
.LocateProtocol = DummyLocateProtocol,
.AllocatePages = DummyAllocatePages,
- .InstallConfigurationTable = DummyInstallConfigurationTable
+ .InstallConfigurationTable = DummyInstallConfigurationTable,
+ .CalculateCrc32 = DummyCalculateCrc32
};
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL mConOut = {
@@ -25,7 +28,8 @@ EFI_SYSTEM_TABLE mSystemTable = {
};
EFI_RUNTIME_SERVICES mRuntimeServices = {
- .Hdr = { 0 },
+ .Hdr = { 0 },
+ .GetTime = DummyGetTime,
};
EFI_SYSTEM_TABLE *gST = &mSystemTable;
@@ -47,11 +51,18 @@ DummyRaiseTPL (
IN EFI_TPL NewTpl
)
{
- ASSERT (FALSE);
-
return 0;
}
+VOID
+EFIAPI
+DummyRestoreTPL (
+ IN EFI_TPL NewTpl
+ )
+{
+ return;
+}
+
EFI_STATUS
EFIAPI
DummyLocateProtocol (
@@ -216,6 +227,22 @@ DummyInstallConfigurationTable (
return EFI_SUCCESS;
}
+EFI_STATUS
+EFIAPI
+DummyCalculateCrc32 (
+ IN VOID *Data,
+ IN UINTN DataSize,
+ OUT UINT32 *CrcOut
+ )
+{
+ if ((Data == NULL) || (DataSize == 0) || (CrcOut == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *CrcOut = CalculateCrc32 (Data, DataSize);
+ return EFI_SUCCESS;
+}
+
EFI_STATUS
EFIAPI
NullTextOutputString (
@@ -236,3 +263,50 @@ NullTextOutputString (
return EFI_SUCCESS;
}
+
+EFI_STATUS
+EFIAPI
+DummyGetTime (
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities
+ )
+{
+ time_t EpochTime;
+ struct tm *TimeInfo;
+
+ if (Time == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ EpochTime = time (NULL);
+ TimeInfo = localtime (&EpochTime);
+
+ if (TimeInfo == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE;
+ Time->Daylight = 0;
+ Time->Second = (UINT8)TimeInfo->tm_sec;
+ Time->Minute = (UINT8)TimeInfo->tm_min;
+ Time->Hour = (UINT8)TimeInfo->tm_hour;
+ Time->Day = (UINT8)TimeInfo->tm_mday;
+ //
+ // The EFI_TIME Month field count months from 1 to 12,
+ // while tm_mon counts from 0 to 11
+ //
+ Time->Month = (UINT8)(TimeInfo->tm_mon + 1);
+ //
+ // According ISO/IEC 9899:1999 7.23.1 the tm_year field
+ // contains number of years since 1900
+ //
+ Time->Year = (UINT16)(TimeInfo->tm_year + 1900);
+
+ if (Capabilities) {
+ Capabilities->Accuracy = 0;
+ Capabilities->Resolution = 1;
+ Capabilities->SetsToZero = FALSE;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/User/Library/UserPcd.c b/User/Library/UserPcd.c
index 0f450aa7446..f80def73505 100644
--- a/User/Library/UserPcd.c
+++ b/User/Library/UserPcd.c
@@ -12,6 +12,7 @@
DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
| DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
| DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED )
+#define _PCD_VALUE_PcdDebugRaisePropertyMask DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED
#define _PCD_VALUE_PcdDebugClearMemoryValue 0xAFU
#define _PCD_VALUE_PcdFixedDebugPrintErrorLevel 0x80000002U
#define _PCD_VALUE_PcdDebugPrintErrorLevel 0x80000002U
@@ -21,10 +22,12 @@
#define _PCD_VALUE_PcdVerifyNodeInList ((BOOLEAN)0U)
#define _PCD_VALUE_PcdCpuNumberOfReservedVariableMtrrs 0x2U
#define _PCD_VALUE_PcdMaximumDevicePathNodeCount 0U
+#define _PCD_VALUE_PcdFatReadOnlyMode ((BOOLEAN)1U)
UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize = _PCD_VALUE_PcdUefiLibMaxPrintBufferSize;
BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport = _PCD_VALUE_PcdUgaConsumeSupport;
UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask = _PCD_VALUE_PcdDebugPropertyMask;
+UINT8 _gPcd_FixedAtBuild_PcdDebugRaisePropertyMask = _PCD_VALUE_PcdDebugRaisePropertyMask;
UINT8 _gPcd_FixedAtBuild_PcdDebugClearMemoryValue = _PCD_VALUE_PcdDebugClearMemoryValue;
UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel = _PCD_VALUE_PcdFixedDebugPrintErrorLevel;
UINT32 _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel = _PCD_VALUE_PcdDebugPrintErrorLevel;
@@ -42,4 +45,5 @@ BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderForceLoadDebug = FALSE;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderTolerantLoad = TRUE;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderSupportDebug = FALSE;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderRemoveXForWX = FALSE;
+BOOLEAN _gPcd_FeatureFlag_PcdFatReadOnlyMode = _PCD_VALUE_PcdFatReadOnlyMode;
UINT32 _gPcd_BinaryPatch_PcdSerialRegisterStride = 0;
diff --git a/User/Library/UserUnicodeCollation.c b/User/Library/UserUnicodeCollation.c
new file mode 100644
index 00000000000..1cb1f5e0396
--- /dev/null
+++ b/User/Library/UserUnicodeCollation.c
@@ -0,0 +1,20 @@
+/** @file
+ Copyright (c) 2023, Savva Mitrofanov. All rights reserved.
+ SPDX-License-Identifier: BSD-3-Clause
+**/
+
+#include
+#include
+
+UINT8 _gPcd_FixedAtBuild_PcdUefiVariableDefaultLang[4] = { 101, 110, 103, 0 };
+UINT8 _gPcd_FixedAtBuild_PcdUefiVariableDefaultPlatformLang[6] = { 101, 110, 45, 85, 83, 0 };
+
+VOID
+UserUnicodeCollationInstallProtocol (
+ OUT EFI_UNICODE_COLLATION_PROTOCOL **Interface
+ )
+{
+ OcUnicodeCollationInitializeMappingTables ();
+
+ *Interface = &gInternalUnicode2Eng;
+}
diff --git a/User/Makefile b/User/Makefile
index f9945813729..cf809ea089b 100644
--- a/User/Makefile
+++ b/User/Makefile
@@ -167,7 +167,7 @@ ifneq ($(STANDALONE),1)
#
# Customised/Simplified implementations at userspace level.
#
- OBJS += UserBaseMemoryLib.o UserBootServices.o UserGlobalVar.o UserMath.o UserMisc.o UserPcd.o UserOcDummy.o
+ OBJS += UserBaseMemoryLib.o UserBootServices.o UserGlobalVar.o UserMath.o UserMisc.o UserPcd.o UserUnicodeCollation.o UserOcDummy.o
#
# OcGuardLib targets.
#
@@ -195,7 +195,7 @@ ifneq ($(STANDALONE),1)
#
# OcMachoLib targets.
#
- OBJS += CxxSymbols.o Fat.o Header.o Macho32.o Macho64.o Relocations.o Symbols.o
+ OBJS += CxxSymbols.o MachoFat.o Header.o Macho32.o Macho64.o Relocations.o Symbols.o
#
# OcAppleKeysLib targets.
#
@@ -213,6 +213,10 @@ ifneq ($(STANDALONE),1)
#
OBJS += KernelVersion.o
#
+ # OcUnicodeCollationEngLib targets.
+ #
+ OBJS += OcUnicodeCollationEngCommon.o
+ #
# OcVariableLib targets.
#
OBJS += OcVariableLib.o
@@ -247,6 +251,7 @@ ifneq ($(STANDALONE),1)
$(OC_USER)/Library/OcCpuLib/Ia32:$\
$(OC_USER)/Library/OcMiscLib:$\
$(OC_USER)/Library/OcAppleKernelLib:$\
+ $(OC_USER)/Library/OcUnicodeCollationEngLib:$\
$(OC_USER)/Library/OcVariableLib
endif
diff --git a/Utilities/TestExt4Dxe/TestExt4Dxe.c b/Utilities/TestExt4Dxe/TestExt4Dxe.c
index 068c9bd849b..77c79b01c3b 100644
--- a/Utilities/TestExt4Dxe/TestExt4Dxe.c
+++ b/Utilities/TestExt4Dxe/TestExt4Dxe.c
@@ -7,16 +7,10 @@
#include
#include
#include
+#include
#include
#define OPEN_FILE_MODES_COUNT 3
-#define MAP_TABLE_SIZE 0x100
-#define CHAR_FAT_VALID 0x01
-
-#define TO_UPPER(a) (CHAR16) ((a) <= 0xFF ? mEngUpperMap[a] : (a))
-
-UINT8 _gPcd_FixedAtBuild_PcdUefiVariableDefaultLang[4] = { 101, 110, 103, 0 };
-UINT8 _gPcd_FixedAtBuild_PcdUefiVariableDefaultPlatformLang[6] = { 101, 110, 45, 85, 83, 0 };
STATIC UINTN mFuzzOffset;
STATIC UINTN mFuzzSize;
@@ -26,104 +20,6 @@ STATIC EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *mEfiSfsInterface;
STATIC UINT64 mOpenFileModes[OPEN_FILE_MODES_COUNT] = { EFI_FILE_MODE_READ, EFI_FILE_MODE_WRITE, EFI_FILE_MODE_CREATE };
-CHAR8 mEngUpperMap[MAP_TABLE_SIZE];
-CHAR8 mEngLowerMap[MAP_TABLE_SIZE];
-CHAR8 mEngInfoMap[MAP_TABLE_SIZE];
-
-CHAR8 mOtherChars[] = {
- '0',
- '1',
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8',
- '9',
- '\\',
- '.',
- '_',
- '^',
- '$',
- '~',
- '!',
- '#',
- '%',
- '&',
- '-',
- '{',
- '}',
- '(',
- ')',
- '@',
- '`',
- '\'',
- '\0'
-};
-
-VOID
-UnicodeCollationInitializeMappingTables (
- VOID
- )
-{
- UINTN Index;
- UINTN Index2;
-
- //
- // Initialize mapping tables for the supported languages
- //
- for (Index = 0; Index < MAP_TABLE_SIZE; Index++) {
- mEngUpperMap[Index] = (CHAR8)Index;
- mEngLowerMap[Index] = (CHAR8)Index;
- mEngInfoMap[Index] = 0;
-
- if (((Index >= 'a') && (Index <= 'z')) || ((Index >= 0xe0) && (Index <= 0xf6)) || ((Index >= 0xf8) && (Index <= 0xfe))) {
- Index2 = Index - 0x20;
- mEngUpperMap[Index] = (CHAR8)Index2;
- mEngLowerMap[Index2] = (CHAR8)Index;
-
- mEngInfoMap[Index] |= CHAR_FAT_VALID;
- mEngInfoMap[Index2] |= CHAR_FAT_VALID;
- }
- }
-
- for (Index = 0; mOtherChars[Index] != 0; Index++) {
- Index2 = mOtherChars[Index];
- mEngInfoMap[Index2] |= CHAR_FAT_VALID;
- }
-}
-
-/**
- Performs a case-insensitive comparison of two Null-terminated strings.
-
- @param This Protocol instance pointer.
- @param Str1 A pointer to a Null-terminated string.
- @param Str2 A pointer to a Null-terminated string.
-
- @retval 0 Str1 is equivalent to Str2
- @retval > 0 Str1 is lexically greater than Str2
- @retval < 0 Str1 is lexically less than Str2
-
-**/
-INTN
-StriColl (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- )
-{
- while (*Str1 != 0) {
- if (TO_UPPER (*Str1) != TO_UPPER (*Str2)) {
- break;
- }
-
- Str1 += 1;
- Str2 += 1;
- }
-
- return TO_UPPER (*Str1) - TO_UPPER (*Str2);
-}
-
/**
Initialises Unicode collation, which is needed for case-insensitive string comparisons
within the driver (a good example of an application of this is filename comparison).
@@ -138,7 +34,7 @@ Ext4InitialiseUnicodeCollation (
EFI_HANDLE DriverHandle
)
{
- UnicodeCollationInitializeMappingTables ();
+ OcUnicodeCollationInitializeMappingTables ();
return EFI_SUCCESS;
}
@@ -159,7 +55,7 @@ Ext4StrCmpInsensitive (
IN CHAR16 *Str2
)
{
- return StriColl (Str1, Str2);
+ return EngStriColl (NULL, Str1, Str2);
}
EFI_STATUS
diff --git a/Utilities/TestFatDxe/Makefile b/Utilities/TestFatDxe/Makefile
new file mode 100644
index 00000000000..70fe02abcd1
--- /dev/null
+++ b/Utilities/TestFatDxe/Makefile
@@ -0,0 +1,22 @@
+## @file
+# Copyright (c) 2023, Savva Mitrofanov. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+##
+
+PROJECT = TestFatDxe
+PRODUCT = $(PROJECT)$(INFIX)$(SUFFIX)
+OBJS = $(PROJECT).o
+OBJS += DirectoryCache.o DiskCache.o FileName.o Hash.o
+OBJS += DirectoryManage.o ReadWrite.o OpenVolume.o Open.o
+OBJS += Misc.o Init.o Info.o FileSpace.o Flush.o Delete.o Data.o
+OBJS += UnicodeCollation.o
+
+include ../../User/Makefile
+
+CFLAGS += -I$(UDK_PATH)/FatPkg/EnhancedFatDxe
+
+ifeq ($(MEMORY_MUTATIONS),1)
+ CFLAGS += -DMEMORY_MUTATIONS
+endif
+
+VPATH += $(UDK_PATH)/FatPkg/EnhancedFatDxe:$
diff --git a/Utilities/TestFatDxe/TestFatDxe.c b/Utilities/TestFatDxe/TestFatDxe.c
new file mode 100644
index 00000000000..7f28dd10849
--- /dev/null
+++ b/Utilities/TestFatDxe/TestFatDxe.c
@@ -0,0 +1,504 @@
+/** @file
+ Copyright (c) 2023, Savva Mitrofanov. All rights reserved.
+ SPDX-License-Identifier: BSD-3-Clause
+**/
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+extern EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationInterface;
+
+STATIC EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *mEfiSfsInterface;
+
+UINTN mFuzzOffset;
+UINTN mFuzzSize;
+CONST UINT8 *mFuzzPointer;
+
+EFI_STATUS
+EFIAPI
+FuzzBlockIoFlushBlocks (
+ IN EFI_BLOCK_IO_PROTOCOL *This
+ )
+{
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+FuzzReadDisk (
+ IN EFI_DISK_IO_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Offset,
+ IN UINTN BufferSize,
+ OUT VOID *Buffer
+ )
+{
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((mFuzzSize - mFuzzOffset) < BufferSize) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ CopyMem (Buffer, mFuzzPointer, BufferSize);
+ mFuzzPointer += BufferSize;
+ mFuzzOffset += BufferSize;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+WrapInstallMultipleProtocolInterfaces (
+ IN OUT EFI_HANDLE *Handle,
+ ...
+ )
+{
+ VA_LIST Args;
+ EFI_STATUS Status;
+ EFI_GUID *Protocol;
+ VOID *Interface;
+
+ if (Handle == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ VA_START (Args, Handle);
+ for (Status = EFI_SUCCESS; !EFI_ERROR (Status);) {
+ //
+ // If protocol is NULL, then it's the end of the list
+ //
+ Protocol = VA_ARG (Args, EFI_GUID *);
+ if (Protocol == NULL) {
+ break;
+ }
+
+ Interface = VA_ARG (Args, VOID *);
+
+ //
+ // If this is Sfs protocol then save interface into global state
+ //
+ if (CompareGuid (Protocol, &gEfiSimpleFileSystemProtocolGuid)) {
+ mEfiSfsInterface = Interface;
+ }
+ }
+
+ VA_END (Args);
+
+ return Status;
+}
+
+VOID
+FreeAll (
+ IN CHAR16 *FileName,
+ IN FAT_VOLUME *Volume,
+ IN EFI_FILE_PROTOCOL *RootDirInstance
+ )
+{
+ FreePool (FileName);
+
+ //
+ // Closes root directory
+ //
+ if (RootDirInstance != NULL) {
+ FatClose (RootDirInstance);
+ }
+
+ //
+ // Abandon volume structure
+ //
+ if (Volume != NULL) {
+ if (Volume->DiskIo != NULL) {
+ FreePool (Volume->DiskIo);
+ }
+
+ if (Volume->BlockIo != NULL) {
+ if (Volume->BlockIo->Media != NULL) {
+ FreePool (Volume->BlockIo->Media);
+ }
+
+ FreePool (Volume->BlockIo);
+ }
+
+ if (Volume->Root != NULL) {
+ FatSetVolumeError (
+ Volume->Root,
+ EFI_NO_MEDIA
+ );
+ }
+
+ Volume->Valid = FALSE;
+
+ FatCleanupVolume (Volume, NULL, EFI_SUCCESS, NULL);
+ }
+}
+
+#ifdef MEMORY_MUTATIONS
+STATIC
+VOID
+ConfigureMemoryAllocations (
+ IN CONST UINT8 *Data,
+ IN UINTN Size
+ )
+{
+ UINT32 Off;
+
+ mPoolAllocationIndex = 0;
+ mPageAllocationIndex = 0;
+
+ //
+ // Limit single pool allocation size to 3GB
+ //
+ SetPoolAllocationSizeLimit (BASE_1GB | BASE_2GB);
+
+ Off = sizeof (UINT64);
+ if (Size >= Off) {
+ CopyMem (&mPoolAllocationMask, &Data[Size - Off], sizeof (UINT64));
+ } else {
+ mPoolAllocationMask = MAX_UINT64;
+ }
+
+ Off += sizeof (UINT64);
+ if (Size >= Off) {
+ CopyMem (&mPageAllocationMask, &Data[Size - Off], sizeof (UINT64));
+ } else {
+ mPageAllocationMask = MAX_UINT64;
+ }
+}
+
+#endif
+
+STATIC
+INT32
+TestFatDxe (
+ CONST UINT8 *FuzzData,
+ UINTN FuzzSize
+ )
+{
+ EFI_STATUS Status;
+ EFI_FILE_PROTOCOL *VolumeRootDir;
+ UINTN BufferSize;
+ VOID *Buffer;
+ EFI_FILE_PROTOCOL *NewHandle;
+ CHAR16 *FileName;
+ VOID *Info;
+ UINTN Len;
+ UINT64 Position;
+ EFI_DISK_IO_PROTOCOL *DiskIo;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ FAT_VOLUME *Volume;
+ FAT_IFILE *FileInstance;
+ UINT64 FileSize;
+
+ EFI_HANDLE DeviceHandle;
+
+ BufferSize = 100;
+
+ mFuzzOffset = 0;
+ mFuzzSize = FuzzSize;
+ mFuzzPointer = FuzzData;
+ mEfiSfsInterface = NULL;
+ Volume = NULL;
+ VolumeRootDir = NULL;
+ Position = 0;
+
+ DeviceHandle = (EFI_HANDLE)0xDEADDEADULL;
+
+ //
+ // Construct File Name
+ //
+ FileName = AllocateZeroPool (BufferSize);
+ if (FileName == NULL) {
+ return 0;
+ }
+
+ ASAN_CHECK_MEMORY_REGION (FileName, BufferSize);
+
+ if ((mFuzzSize - mFuzzOffset) < BufferSize) {
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ CopyMem (FileName, mFuzzPointer, BufferSize - 2);
+ mFuzzPointer += BufferSize - 2;
+ mFuzzOffset += BufferSize - 2;
+
+ //
+ // Construct BlockIo and DiskIo interfaces
+ //
+ DiskIo = AllocateZeroPool (sizeof (EFI_DISK_IO_PROTOCOL));
+ if (DiskIo == NULL) {
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ ASAN_CHECK_MEMORY_REGION (DiskIo, sizeof (EFI_DISK_IO_PROTOCOL));
+
+ DiskIo->ReadDisk = FuzzReadDisk;
+
+ BlockIo = AllocateZeroPool (sizeof (EFI_BLOCK_IO_PROTOCOL));
+ if (BlockIo == NULL) {
+ FreePool (DiskIo);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ ASAN_CHECK_MEMORY_REGION (BlockIo, sizeof (EFI_BLOCK_IO_PROTOCOL));
+
+ BlockIo->Media = AllocateZeroPool (sizeof (EFI_BLOCK_IO_MEDIA));
+ if (BlockIo->Media == NULL) {
+ FreePool (DiskIo);
+ FreePool (BlockIo);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ ASAN_CHECK_MEMORY_REGION (BlockIo->Media, sizeof (EFI_BLOCK_IO_MEDIA));
+
+ BlockIo->FlushBlocks = FuzzBlockIoFlushBlocks;
+
+ //
+ // Allocate volume
+ //
+ Status = FatAllocateVolume (DeviceHandle, DiskIo, NULL, BlockIo);
+
+ if (EFI_ERROR (Status)) {
+ FreePool (BlockIo->Media);
+ FreePool (BlockIo);
+ FreePool (DiskIo);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ //
+ // Open volume root dir
+ //
+ Status = FatOpenVolume (mEfiSfsInterface, &VolumeRootDir);
+
+ if (EFI_ERROR (Status)) {
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ Volume = VOLUME_FROM_VOL_INTERFACE (mEfiSfsInterface);
+
+ //
+ // Open File
+ //
+ Status = FatOpen (VolumeRootDir, &NewHandle, FileName, EFI_FILE_MODE_READ, 0);
+ if (Status == EFI_SUCCESS) {
+ Buffer = NULL;
+ BufferSize = 0;
+ Status = FatRead (NewHandle, &BufferSize, Buffer);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Buffer = AllocateZeroPool (BufferSize);
+ if (Buffer == NULL) {
+ FatClose (NewHandle);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ ASAN_CHECK_MEMORY_REGION (Buffer, BufferSize);
+
+ FatRead (NewHandle, &BufferSize, Buffer);
+
+ FatWrite (NewHandle, &BufferSize, Buffer);
+
+ FatFlush (NewHandle);
+
+ FreePool (Buffer);
+ }
+
+ //
+ // Set/Get file info
+ //
+ Len = 0;
+ Info = NULL;
+ Status = FatGetInfo (NewHandle, &gEfiFileInfoGuid, &Len, Info);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Info = AllocateZeroPool (Len);
+ if (Info == NULL) {
+ FatClose (NewHandle);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ Status = FatGetInfo (NewHandle, &gEfiFileInfoGuid, &Len, Info);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Try to set this info back
+ //
+ FatSetInfo (NewHandle, &gEfiFileInfoGuid, Len, Info);
+ FreePool (Info);
+ }
+ }
+
+ Len = 0;
+ Info = NULL;
+ Status = FatGetInfo (NewHandle, &gEfiFileSystemInfoGuid, &Len, Info);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Info = AllocateZeroPool (Len);
+ if (Info == NULL) {
+ FatClose (NewHandle);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ Status = FatGetInfo (NewHandle, &gEfiFileSystemInfoGuid, &Len, Info);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Try to set this info back
+ //
+ FatSetInfo (NewHandle, &gEfiFileSystemInfoGuid, Len, Info);
+ FreePool (Info);
+ }
+ }
+
+ Len = 0;
+ Info = NULL;
+ Status = FatGetInfo (NewHandle, &gEfiFileSystemVolumeLabelInfoIdGuid, &Len, Info);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Info = AllocateZeroPool (Len);
+ if (Info == NULL) {
+ FatClose (NewHandle);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ Status = FatGetInfo (NewHandle, &gEfiFileSystemVolumeLabelInfoIdGuid, &Len, Info);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Try to set this info back
+ //
+ FatSetInfo (NewHandle, &gEfiFileSystemVolumeLabelInfoIdGuid, Len, Info);
+ FreePool (Info);
+ }
+ }
+
+ //
+ // Test position functions
+ //
+ FatGetPosition (NewHandle, &Position);
+ FatSetPosition (NewHandle, Position);
+
+ //
+ // Trying to reach the end of file and read/write it
+ //
+ Position = (UINT64)-1;
+ Status = FatSetPosition (NewHandle, Position);
+ if (!EFI_ERROR (Status)) {
+ Buffer = NULL;
+ BufferSize = 0;
+ Status = FatRead (NewHandle, &BufferSize, Buffer);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Buffer = AllocateZeroPool (BufferSize);
+ if (Buffer == NULL) {
+ FatClose (NewHandle);
+ FreeAll (FileName, Volume, VolumeRootDir);
+ return 0;
+ }
+
+ ASAN_CHECK_MEMORY_REGION (Buffer, BufferSize);
+
+ FatRead (NewHandle, &BufferSize, Buffer);
+
+ FatWrite (NewHandle, &BufferSize, Buffer);
+
+ FatFlush (NewHandle);
+
+ FreePool (Buffer);
+ }
+ }
+
+ //
+ // Trying to reach out of bound of FileSize
+ //
+ FileInstance = IFILE_FROM_FHAND (NewHandle);
+ FileSize = FileInstance->OFile->FileSize;
+ if (FileSize < (UINT64)-1 - 1) {
+ Position = FileSize + 1;
+ Status = FatSetPosition (NewHandle, Position);
+ if (!EFI_ERROR (Status)) {
+ Buffer = NULL;
+ BufferSize = 0;
+ Status = FatRead (NewHandle, &BufferSize, Buffer);
+
+ ASSERT (Status == EFI_DEVICE_ERROR);
+ }
+ }
+
+ FatDelete (NewHandle);
+ }
+
+ FreeAll (FileName, Volume, VolumeRootDir);
+
+ return 0;
+}
+
+INT32
+LLVMFuzzerTestOneInput (
+ CONST UINT8 *FuzzData,
+ UINTN FuzzSize
+ )
+{
+ VOID *NewData;
+
+ if (FuzzSize == 0) {
+ return 0;
+ }
+
+ // Set up unicode collation protocol
+ UserUnicodeCollationInstallProtocol (&mUnicodeCollationInterface);
+
+ //
+ // Override InstallMultipleProtocolInterfaces with custom wrapper
+ //
+ gBS->InstallMultipleProtocolInterfaces = WrapInstallMultipleProtocolInterfaces;
+
+ #ifdef MEMORY_MUTATIONS
+ ConfigureMemoryAllocations (FuzzData, FuzzSize);
+ #else
+ SetPoolAllocationSizeLimit (BASE_1GB | BASE_2GB);
+ #endif
+
+ NewData = AllocatePool (FuzzSize);
+ if (NewData != NULL) {
+ CopyMem (NewData, FuzzData, FuzzSize);
+ TestFatDxe (NewData, FuzzSize);
+ FreePool (NewData);
+ }
+
+ DEBUG ((
+ DEBUG_POOL | DEBUG_PAGE,
+ "UMEM: Allocated %u pools %u pages\n",
+ (UINT32)mPoolAllocations,
+ (UINT32)mPageAllocations
+ ));
+
+ return 0;
+}
+
+int
+ENTRY_POINT (
+ int argc,
+ char **argv
+ )
+{
+ uint32_t f;
+ uint8_t *b;
+
+ if ((b = UserReadFile ((argc > 1) ? argv[1] : "in.bin", &f)) == NULL) {
+ DEBUG ((DEBUG_ERROR, "Read fail\n"));
+ return -1;
+ }
+
+ LLVMFuzzerTestOneInput (b, f);
+ FreePool (b);
+ return 0;
+}
diff --git a/Utilities/TestNtfsDxe/TestNtfsDxe.c b/Utilities/TestNtfsDxe/TestNtfsDxe.c
index 3d9f3aac241..f70ac34c373 100644
--- a/Utilities/TestNtfsDxe/TestNtfsDxe.c
+++ b/Utilities/TestNtfsDxe/TestNtfsDxe.c
@@ -202,6 +202,11 @@ LLVMFuzzerTestOneInput (
Status = FileGetInfo (NewHandle, &gEfiFileInfoGuid, &Len, Info);
if (Status == EFI_BUFFER_TOO_SMALL) {
Info = AllocateZeroPool (Len);
+ if (Info == NULL) {
+ FreeAll (FileName, Instance);
+ return 0;
+ }
+
FileGetInfo (NewHandle, &gEfiFileInfoGuid, &Len, Info);
FreePool (Info);
}
@@ -210,6 +215,11 @@ LLVMFuzzerTestOneInput (
Status = FileGetInfo (NewHandle, &gEfiFileSystemInfoGuid, &Len, Info);
if (Status == EFI_BUFFER_TOO_SMALL) {
Info = AllocateZeroPool (Len);
+ if (Info == NULL) {
+ FreeAll (FileName, Instance);
+ return 0;
+ }
+
FileGetInfo (NewHandle, &gEfiFileSystemInfoGuid, &Len, Info);
FreePool (Info);
}
@@ -218,6 +228,11 @@ LLVMFuzzerTestOneInput (
Status = FileGetInfo (NewHandle, &gEfiFileSystemVolumeLabelInfoIdGuid, &Len, Info);
if (Status == EFI_BUFFER_TOO_SMALL) {
Info = AllocateZeroPool (Len);
+ if (Info == NULL) {
+ FreeAll (FileName, Instance);
+ return 0;
+ }
+
FileGetInfo (NewHandle, &gEfiFileSystemVolumeLabelInfoIdGuid, &Len, Info);
FreePool (Info);
}
diff --git a/Utilities/macrecovery/boards.json b/Utilities/macrecovery/boards.json
index 433a6409662..0b33be31436 100644
--- a/Utilities/macrecovery/boards.json
+++ b/Utilities/macrecovery/boards.json
@@ -1,31 +1,31 @@
{
"Mac-EE2EBD4B90B839A8": "latest",
- "Mac-BE0E8AC46FE800CC": "11.7.2",
- "Mac-9AE82516C7C6B903": "12.6.2",
+ "Mac-BE0E8AC46FE800CC": "11.7.4",
+ "Mac-9AE82516C7C6B903": "12.6.3",
"Mac-942452F5819B1C1B": "10.13.6",
"Mac-942C5DF58193131B": "10.13.6",
"Mac-C08A6BB70A942AC2": "10.13.6",
"Mac-742912EFDBEE19B3": "10.13.6",
"Mac-66F35F19FE2A0D05": "10.15.7",
"Mac-2E6FAB96566FE58C": "10.15.7",
- "Mac-35C1E88140C3E6CF": "11.7.2",
- "Mac-7DF21CB3ED6977E5": "11.7.2",
- "Mac-9F18E312C5C2BF0B": "12.6.2",
- "Mac-937CB26E2E02BB01": "12.6.2",
+ "Mac-35C1E88140C3E6CF": "11.7.4",
+ "Mac-7DF21CB3ED6977E5": "11.7.4",
+ "Mac-9F18E312C5C2BF0B": "12.6.3",
+ "Mac-937CB26E2E02BB01": "12.6.3",
"Mac-827FAC58A8FDFA22": "latest",
"Mac-226CB3C6A851A671": "latest",
"Mac-0CFF9C7C2B63DF8D": "latest",
"Mac-C3EC7CD22292981F": "10.15.7",
"Mac-AFD8A9D944EA4843": "10.15.7",
- "Mac-189A3D4F975D5FFC": "11.7.2",
- "Mac-3CBD00234E554E41": "11.7.2",
- "Mac-2BD1B31983FE1663": "11.7.2",
- "Mac-06F11FD93F0323C5": "12.6.2",
- "Mac-06F11F11946D27C5": "12.6.2",
- "Mac-E43C1C25D4880AD6": "12.6.2",
- "Mac-473D31EABEB93F9B": "12.6.2",
- "Mac-66E35819EE2D0D05": "12.6.2",
- "Mac-A5C67F76ED83108C": "12.6.2",
+ "Mac-189A3D4F975D5FFC": "11.7.4",
+ "Mac-3CBD00234E554E41": "11.7.4",
+ "Mac-2BD1B31983FE1663": "11.7.4",
+ "Mac-06F11FD93F0323C5": "12.6.3",
+ "Mac-06F11F11946D27C5": "12.6.3",
+ "Mac-E43C1C25D4880AD6": "12.6.3",
+ "Mac-473D31EABEB93F9B": "12.6.3",
+ "Mac-66E35819EE2D0D05": "12.6.3",
+ "Mac-A5C67F76ED83108C": "12.6.3",
"Mac-B4831CEBD52A0C4C": "latest",
"Mac-CAD6701F7CEA0921": "latest",
"Mac-551B86E5744E2388": "latest",
@@ -43,7 +43,7 @@
"Mac-942459F5819B171B": "10.13.6",
"Mac-4B7AC7E43945597E": "10.15.7",
"Mac-6F01561E16C75D06": "10.15.7",
- "Mac-F60DEB81FF30ACF6": "12.6.2",
+ "Mac-F60DEB81FF30ACF6": "12.6.3",
"Mac-27AD2F918AE68F61": "latest",
"Mac-F2208EC8": "10.13.6",
"Mac-8ED6AF5B48C039E1": "10.13.6",
@@ -51,7 +51,7 @@
"Mac-7BA5B2794B2CDB12": "10.13.6",
"Mac-031AEE4D24BFF0B1": "10.15.7",
"Mac-F65AE981FFA204ED": "10.15.7",
- "Mac-35C5E08120C7EEAF": "12.6.2",
+ "Mac-35C5E08120C7EEAF": "12.6.3",
"Mac-7BA5B2DFE22DDD8C": "latest",
"Mac-942B5BF58194151B": "10.13.6",
"Mac-942B59F58194171B": "10.13.6",
@@ -61,13 +61,13 @@
"Mac-031B6874CF7F642A": "10.15.7",
"Mac-27ADBB7B4CEE8E61": "10.15.7",
"Mac-77EB7D7DAF985301": "10.15.7",
- "Mac-81E3E92DD6088272": "11.7.2",
- "Mac-42FD25EABCABB274": "11.7.2",
- "Mac-A369DDC4E67F1C45": "12.6.2",
- "Mac-FFE5EF870D7BA81A": "12.6.2",
- "Mac-DB15BD556843C820": "12.6.2",
- "Mac-65CE76090165799A": "12.6.2",
- "Mac-B809C3757DA9BB8D": "12.6.2",
+ "Mac-81E3E92DD6088272": "11.7.4",
+ "Mac-42FD25EABCABB274": "11.7.4",
+ "Mac-A369DDC4E67F1C45": "12.6.3",
+ "Mac-FFE5EF870D7BA81A": "12.6.3",
+ "Mac-DB15BD556843C820": "12.6.3",
+ "Mac-65CE76090165799A": "12.6.3",
+ "Mac-B809C3757DA9BB8D": "12.6.3",
"Mac-4B682C642B45593E": "latest",
"Mac-77F17D7DA9285301": "latest",
"Mac-BE088AF8C5EB4FA2": "latest",
diff --git a/Utilities/ocvalidate/KextInfo.c b/Utilities/ocvalidate/KextInfo.c
index 04579c32246..4864096ac23 100644
--- a/Utilities/ocvalidate/KextInfo.c
+++ b/Utilities/ocvalidate/KextInfo.c
@@ -73,6 +73,7 @@ KEXT_INFO mKextInfo[] = {
{ "CPUFriendDataProvider.kext", "", "Contents/Info.plist" },
{ "CryptexFixup.kext", "Contents/MacOS/CryptexFixup", "Contents/Info.plist" },
{ "DebugEnhancer.kext", "Contents/MacOS/DebugEnhancer", "Contents/Info.plist" },
+ { "EmeraldSDHC.kext", "Contents/MacOS/EmeraldSDHC", "Contents/Info.plist" },
{ "HibernationFixup.kext", "Contents/MacOS/HibernationFixup", "Contents/Info.plist" },
{ "NVMeFix.kext", "Contents/MacOS/NVMeFix", "Contents/Info.plist" },
{ "RestrictEvents.kext", "Contents/MacOS/RestrictEvents", "Contents/Info.plist" },
diff --git a/build_oc.tool b/build_oc.tool
index 43955930719..b236170a810 100755
--- a/build_oc.tool
+++ b/build_oc.tool
@@ -26,6 +26,7 @@ buildutil() {
"TestMacho"
"TestMp3"
"TestExt4Dxe"
+ "TestFatDxe"
"TestNtfsDxe"
"TestPeCoff"
"TestProcessKernel"
@@ -135,6 +136,7 @@ package() {
"CsrUtil.efi"
"GopStop.efi"
"KeyTester.efi"
+ "ListPartitions.efi"
"MmapDump.efi"
"ResetSystem.efi"
"RtcRw.efi"
@@ -249,6 +251,42 @@ package() {
fi
done
+ # Copy Mac Pro GOP firmware driver.
+ mkdir -p "${dstdir}/Utilities/EnableGop" || exit 1
+ ENABLE_GOP_GUID="3FBA58B1-F8C0-41BC-ACD8-253043A3A17F"
+ ffsNames=(
+ "EnableGop"
+ "EnableGopDirect"
+ )
+ for ffsName in "${ffsNames[@]}"; do
+ cp "FV/Ffs/${ENABLE_GOP_GUID}${ffsName}/${ENABLE_GOP_GUID}.ffs" "${dstdir}/Utilities/EnableGop/${ffsName}.ffs" || exit 1
+ done
+ gopDrivers=(
+ "EnableGop.efi"
+ "EnableGopDirect.efi"
+ )
+ for file in "${gopDrivers[@]}"; do
+ cp "X64/${file}" "${dstdir}/Utilities/EnableGop"/ || exit 1
+ done
+ helpFiles=(
+ "README.md"
+ "UEFITool_Inserted_Screenshot.png"
+ "vBiosInsert.sh"
+ )
+ for file in "${helpFiles[@]}"; do
+ cp "${selfdir}/Staging/EnableGop/${file}" "${dstdir}/Utilities/EnableGop"/ || exit 1
+ done
+
+ # Provide EDK-II BaseTools.
+ mkdir "${dstdir}/Utilities/BaseTools" || exit 1
+ if [ "$(unamer)" = "Windows" ]; then
+ cp "${selfdir}/UDK/BaseTools/Bin/Win32/EfiRom.exe" "${dstdir}/Utilities/BaseTools" || exit 1
+ cp "${selfdir}/UDK/BaseTools/Bin/Win32/GenFfs.exe" "${dstdir}/Utilities/BaseTools" || exit 1
+ else
+ cp "${selfdir}/UDK/BaseTools/Source/C/bin/EfiRom" "${dstdir}/Utilities/BaseTools" || exit 1
+ cp "${selfdir}/UDK/BaseTools/Source/C/bin/GenFfs" "${dstdir}/Utilities/BaseTools" || exit 1
+ fi
+
utils=(
"ACPIe"
"acdtinfo"