diff --git a/Docs/Configuration.pdf b/Docs/Configuration.pdf index a87e8339..275263b7 100644 Binary files a/Docs/Configuration.pdf and b/Docs/Configuration.pdf differ diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex index 61984ce6..6e806743 100755 --- a/Docs/Configuration.tex +++ b/Docs/Configuration.tex @@ -1737,6 +1737,22 @@ To view their current state, use the \texttt{pmset -g} command in Terminal. for 4 MB, and so on up to \texttt{19} for 512 GB. Apple macOS supports 1 GB maximum, which is \texttt{10}. Use \texttt{-1} to disable this quirk. + Consider a GPU with 2 BARs: + \begin{itemize} + \tightlist + \item \texttt{BAR0} supports sizes from 256 MB to 8 GB. Its value is 4 GB. + \item \texttt{BAR1} supports sizes from 1 MB to 256 MB. Its value is 256 MB. + \end{itemize} + + \emph{Example 1}: Setting \texttt{ResizeAppleGpuBars} to 1 GB will change + \texttt{BAR0} to 1 GB and leave \texttt{BAR1} unchanged. + \\ + \emph{Example 2}: Setting \texttt{ResizeAppleGpuBars} to 1 MB will change + \texttt{BAR0} to 256 MB and \texttt{BAR0} to 1 MB. + \\ + \emph{Example 3}: Setting \texttt{ResizeAppleGpuBars} to 16 GB will make no + changes. + \emph{Note}: See \texttt{ResizeGpuBars} quirk for general GPU PCI BAR size configuration and more details about the technology. @@ -7701,6 +7717,22 @@ with the boot menu. and maximum available (\texttt{ON}). This quirk allows to fine-tune this value for testing and development purposes. + Consider a GPU with 2 BARs: + \begin{itemize} + \tightlist + \item \texttt{BAR0} supports sizes from 256 MB to 8 GB. Its value is 4 GB. + \item \texttt{BAR1} supports sizes from 1 MB to 256 MB. Its value is 256 MB. + \end{itemize} + + \emph{Example 1}: Setting \texttt{ResizeGpuBars} to 1 GB will change + \texttt{BAR0} to 1 GB and leave \texttt{BAR1} unchanged. + \\ + \emph{Example 2}: Setting \texttt{ResizeGpuBars} to 1 MB will change + \texttt{BAR0} to 256 MB and \texttt{BAR0} to 1 MB. + \\ + \emph{Example 3}: Setting \texttt{ResizeGpuBars} to 16 GB will change + \texttt{BAR0} to 8 GB and leave \texttt{BAR1} unchanged. + \emph{Note 1}: This quirk shall not be used to workaround macOS limitation to address BARs over 1 GB. \texttt{ResizeAppleGpuBars} should be used instead. diff --git a/Docs/Differences/Differences.pdf b/Docs/Differences/Differences.pdf index 964c459c..9b7f5aed 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 3b6f16f4..c8332dd0 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 Oct 11 00:01:52 2021 -%DIF ADD ../Configuration.tex Mon Oct 11 04:50:40 2021 +%DIF ADD ../Configuration.tex Tue Oct 12 02:10:19 2021 \usepackage{lmodern} \usepackage{amssymb,amsmath} @@ -1799,6 +1799,23 @@ To view their current state, use the \texttt{pmset -g} command in Terminal. 1 GB maximum, which is }\texttt{\DIFadd{10}}\DIFadd{. Use }\texttt{\DIFadd{-1}} \DIFadd{to disable this quirk. } + \DIFadd{Consider a GPU with 2 BARs: + }\begin{itemize} + \tightlist + \item \texttt{\DIFadd{BAR0}} \DIFadd{supports sizes from 256 MB to 8 GB. Its value is 4 GB. + }\item \texttt{\DIFadd{BAR1}} \DIFadd{supports sizes from 1 MB to 256 MB. Its value is 256 MB. + }\end{itemize} + + \emph{\DIFadd{Example 1}}\DIFadd{: Setting }\texttt{\DIFadd{ResizeAppleGpuBars}} \DIFadd{to 1 GB will change + }\texttt{\DIFadd{BAR0}} \DIFadd{to 1 GB and leave }\texttt{\DIFadd{BAR1}} \DIFadd{unchanged. + }\\ + \emph{\DIFadd{Example 2}}\DIFadd{: Setting }\texttt{\DIFadd{ResizeAppleGpuBars}} \DIFadd{to 1 MB will change + }\texttt{\DIFadd{BAR0}} \DIFadd{to 256 MB and }\texttt{\DIFadd{BAR0}} \DIFadd{to 1 MB. + }\\ + \emph{\DIFadd{Example 3}}\DIFadd{: Setting }\texttt{\DIFadd{ResizeAppleGpuBars}} \DIFadd{to 16 GB will make no + changes. +} + \emph{\DIFadd{Note}}\DIFadd{: See }\texttt{\DIFadd{ResizeGpuBars}} \DIFadd{quirk for general GPU PCI BAR size configuration and more details about the technology. } @@ -7890,6 +7907,23 @@ with }\DIFaddend the \DIFdelbegin \DIFdel{user will need to specify the correct value for testing and development purposes. } + \DIFadd{Consider a GPU with 2 BARs: + }\begin{itemize} + \tightlist + \item \texttt{\DIFadd{BAR0}} \DIFadd{supports sizes from 256 MB to 8 GB. Its value is 4 GB. + }\item \texttt{\DIFadd{BAR1}} \DIFadd{supports sizes from 1 MB to 256 MB. Its value is 256 MB. + }\end{itemize} + + \emph{\DIFadd{Example 1}}\DIFadd{: Setting }\texttt{\DIFadd{ResizeGpuBars}} \DIFadd{to 1 GB will change + }\texttt{\DIFadd{BAR0}} \DIFadd{to 1 GB and leave }\texttt{\DIFadd{BAR1}} \DIFadd{unchanged. + }\\ + \emph{\DIFadd{Example 2}}\DIFadd{: Setting }\texttt{\DIFadd{ResizeGpuBars}} \DIFadd{to 1 MB will change + }\texttt{\DIFadd{BAR0}} \DIFadd{to 256 MB and }\texttt{\DIFadd{BAR0}} \DIFadd{to 1 MB. + }\\ + \emph{\DIFadd{Example 3}}\DIFadd{: Setting }\texttt{\DIFadd{ResizeGpuBars}} \DIFadd{to 16 GB will change + }\texttt{\DIFadd{BAR0}} \DIFadd{to 8 GB and leave }\texttt{\DIFadd{BAR1}} \DIFadd{unchanged. +} + \emph{\DIFadd{Note 1}}\DIFadd{: This quirk shall not be used to workaround macOS limitation to address BARs over 1 GB. }\texttt{\DIFadd{ResizeAppleGpuBars}} \DIFadd{should be used instead. } diff --git a/Docs/Errata/Errata.pdf b/Docs/Errata/Errata.pdf index 3eed8c82..c5b97e26 100644 Binary files a/Docs/Errata/Errata.pdf and b/Docs/Errata/Errata.pdf differ diff --git a/Library/OcDeviceMiscLib/SetResizableBar.c b/Library/OcDeviceMiscLib/SetResizableBar.c index 12e1c818..6809bb3f 100644 --- a/Library/OcDeviceMiscLib/SetResizableBar.c +++ b/Library/OcDeviceMiscLib/SetResizableBar.c @@ -213,7 +213,15 @@ SetResizableBarOnDevice ( NewCapabilities &= PCI_BAR_CAP_LIMIT (Entries[Index].ResizableBarControl.Bits.BarSize); } - Bit = HighBitSet64 (NewCapabilities); + // + // If requested BAR size is too low, choose the lowest available BAR size. + // + if (NewCapabilities == 0 + && Entries[Index].ResizableBarControl.Bits.BarSize > Size) { + Bit = LowBitSet64 (Capabilities); + } else { + Bit = HighBitSet64 (NewCapabilities); + } DEBUG (( DEBUG_INFO,