[coreboot] [PATCH] v3: print current and wanted LZMA scratchpad size

Myles Watson mylesgw at gmail.com
Fri May 23 21:25:35 CEST 2008


On Fri, May 23, 2008 at 1:22 PM, Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006 at gmx.net> wrote:
> Print current and wanted LZMA scratchpad size in the decompression
> routine. That allows people to either adjust compression parameters
> or scratchpad size.
> Having a similar check during build time would be nice.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>
> Index: LinuxBIOSv3-tmp/lib/lzma.c
> ===================================================================
> --- LinuxBIOSv3-tmp/lib/lzma.c  (Revision 682)
> +++ LinuxBIOSv3-tmp/lib/lzma.c  (Arbeitskopie)
> @@ -14,6 +14,7 @@
>  #include "string.h"
>  #include "console.h"
>
> +#define LZMA_SCRATCHPAD_SIZE 15980

What's the reason for 15980?  What's the downside to increasing it further?

Thanks,
Myles

>  unsigned long ulzma(u8 *src, u8 *dst)
>  {
> @@ -24,7 +25,7 @@
>        int res;
>        CLzmaDecoderState state;
>        SizeT mallocneeds;
> -       unsigned char scratchpad[15980];
> +       unsigned char scratchpad[LZMA_SCRATCHPAD_SIZE];
>
>        memcpy(properties, src, LZMA_PROPERTIES_SIZE);
>        outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE);
> @@ -32,8 +33,9 @@
>                printk(BIOS_WARNING, "Incorrect stream properties\n");
>        }
>        mallocneeds = (LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
> -       if (mallocneeds > 15980) {
> -               printk(BIOS_WARNING, "Decoder scratchpad too small!\n");
> +       if (mallocneeds > LZMA_SCRATCHPAD_SIZE) {
> +               printk(BIOS_WARNING,("Decoder scratchpad too small, have %i, need %i!\n",
> +                               LZMA_SCRATCHPAD_SIZE, mallocneeds);
>        }
>        state.Probs = (CProb *)scratchpad;
>        res = LzmaDecode(&state, src + LZMA_PROPERTIES_SIZE + 8, (SizeT)0xffffffff, &inProcessed,
>
>
>
> --
> coreboot mailing list
> coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot
>




More information about the coreboot mailing list