[LinuxBIOS] [v3][PATCH] Add execute in place to lar

Marc Jones marc.jones at amd.com
Thu Jul 19 17:03:31 CEST 2007



ron minnich wrote:
> Acked-by: Ronald G. Minnich <rminnich at gmail.com>
> 
> 

r458

Thanks,
Marc




> On 7/18/07, Marc Jones <marc.jones at amd.com> wrote:
>> :)
>> Marc
>>
>> -- 
>> Marc Jones
>> Senior Software Engineer
>> (970) 226-9684 Office
>> mailto:Marc.Jones at amd.com
>> http://www.amd.com/embeddedprocessors
>>
>> Add execute in place to lar. Allows code to be run from the ROM.
>>
>> Signed-off-by: Marc Jones <marc.jones at amd.com>
>>
>> Index: LinuxBIOSv3/include/lar.h
>> ===================================================================
>> --- LinuxBIOSv3.orig/include/lar.h      2007-07-18 10:37:02.000000000 
>> -0600
>> +++ LinuxBIOSv3/include/lar.h   2007-07-17 13:29:12.000000000 -0600
>> @@ -76,5 +76,6 @@
>>  int find_file(struct mem_file *archive, char *filename, struct 
>> mem_file *result);
>>  int copy_file(struct mem_file *archive, char *filename, void *where);
>>  int run_file(struct mem_file *archive, char *filename, void *where);
>> +int execute_in_place(struct mem_file *archive, char *filename);
>>
>>  #endif /* LAR_H */
>> Index: LinuxBIOSv3/lib/lar.c
>> ===================================================================
>> --- LinuxBIOSv3.orig/lib/lar.c  2007-07-18 10:37:12.000000000 -0600
>> +++ LinuxBIOSv3/lib/lar.c       2007-07-17 13:26:55.000000000 -0600
>> @@ -3,6 +3,7 @@
>>   *
>>   * Copyright (C) 2006-2007 coresystems GmbH
>>   * (Written by Stefan Reinauer <stepan at coresystems.de> for 
>> coresystems GmbH)
>> + * Copyright (C) 2007 Advanced Micro Devices, Inc.
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>>   * it under the terms of the GNU General Public License as published by
>> @@ -103,16 +104,41 @@
>>         return 1;
>>  }
>>
>> +
>> +/**
>> + * Find the file in the LAR header, copy it to the desired location,
>> + * and execute it. A location of 0xFFFFFFFF means execute in place 
>> (XIP).
>> + */
>>  int run_file(struct mem_file *archive, char *filename, void *where)
>>  {
>>         int (*v) (void);
>> +       struct mem_file result;
>>
>> -       if (copy_file(archive, filename, where)) {
>> -               printk(BIOS_INFO, "LAR: Run file %s failed: No such 
>> file.\n",
>> -                      filename);
>> -               return 1;
>> +       if ((u32) where != 0xFFFFFFFF) {
>> +               if (copy_file(archive, filename, where)) {
>> +                       printk(BIOS_INFO,
>> +                             "LAR: Run file %s failed: No such file.\n",
>> +                              filename);
>> +                       return 1;
>> +               }
>> +       } else { /* XIP */
>> +               if (find_file(archive, filename, &result)) {
>> +                       printk(BIOS_INFO,
>> +                              "LAR: Run file %s failed: No such 
>> file.\n",
>> +                              filename);
>> +                       return 1;
>> +               }
>> +               where = result.start;
>>         }
>>
>>         v = where;
>>         return v();
>>  }
>> +
>> +/**
>> + * Call run_file() to execute in place.
>> + */
>> +int execute_in_place(struct mem_file *archive, char *filename)
>> +{
>> +       return run_file(archive, filename, (void *) 0xFFFFFFFF);
>> +}
>> \ No newline at end of file
>>
>> -- 
>> linuxbios mailing list
>> linuxbios at linuxbios.org
>> http://www.linuxbios.org/mailman/listinfo/linuxbios
>>
> 
> 

-- 
Marc Jones
Senior Software Engineer
(970) 226-9684 Office
mailto:Marc.Jones at amd.com
http://www.amd.com/embeddedprocessors






More information about the coreboot mailing list