libpayload: Implement ffs()
[coreboot.git] / payloads / libpayload / include / lar.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2006 coresystems GmbH
5  * (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
6  *
7  * This file is dual-licensed. You can choose between:
8  *   - The GNU GPL, version 2, as published by the Free Software Foundation
9  *   - The revised BSD license (without advertising clause)
10  *
11  * ---------------------------------------------------------------------------
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; version 2 of the License.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
24  * ---------------------------------------------------------------------------
25  * Redistribution and use in source and binary forms, with or without
26  * modification, are permitted provided that the following conditions
27  * are met:
28  * 1. Redistributions of source code must retain the above copyright
29  *    notice, this list of conditions and the following disclaimer.
30  * 2. Redistributions in binary form must reproduce the above copyright
31  *    notice, this list of conditions and the following disclaimer in the
32  *    documentation and/or other materials provided with the distribution.
33  * 3. The name of the author may not be used to endorse or promote products
34  *    derived from this software without specific prior written permission.
35  *
36  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
37  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
40  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
42  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
44  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
45  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ---------------------------------------------------------------------------
48  */
49
50 #ifndef LAR_H
51 #define LAR_H
52
53 #include <arch/types.h>
54
55 #define LAR_MAGIC "LARCHIVE"
56 #define LAR_MAX_PATHLEN 1024
57
58 struct lar_header {
59         char magic[8];
60         u32 len;
61         u32 reallen;
62         u32 checksum;
63         u32 compchecksum;
64         u32 offset;
65         /* Compression:
66          * 0 = no compression
67          * 1 = lzma
68          * 2 = nrv2b
69          * 3 = zeroes
70          */
71         u32 compression;
72         u64 entry;
73         u64 loadaddress;
74 };
75
76 enum compalgo {
77         ALGO_NONE = 0,
78         ALGO_LZMA = 1,
79         ALGO_NRV2B = 2,
80         ALGO_ZEROES = 3,
81         /* invalid should always be the last entry. */
82         ALGO_INVALID
83 };
84
85 struct mem_file {
86         void *start;
87         int len;
88         u32 reallen;
89         u32 compression;
90         void *entry;
91         void *loadaddress;
92 };
93
94 #endif /* LAR_H */