xref: /illumos-kvm-cmd/target-ia64/firmware.h (revision 68396ea9)
1 /*
2  * firmwar.h: Firmware build logic head file
3  *
4  * Copyright (c) 2007, Intel Corporation.
5  * Zhang Xiantao <xiantao.zhang@intel.com>
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU General Public License,
9  * version 2, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18  * Place - Suite 330, Boston, MA 02111-1307 USA.
19  */
20 #ifndef __FIRM_WARE_H
21 #define  __FIRM_WARE_
22 #include "cpu.h"
23 
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <fcntl.h>
27 
28 #include <zlib.h>
29 
30 #define GFW_SIZE                (16UL<<20)
31 #define GFW_START               ((4UL<<30) - GFW_SIZE)
32 
33 #define HOB_SIGNATURE           0x3436474953424f48        // "HOBSIG64"
34 #define GFW_HOB_START           ((4UL<<30) - (14UL<<20))    // 4G - 14M
35 #define GFW_HOB_SIZE            (1UL<<20)                 // 1M
36 #define HOB_OFFSET              (GFW_HOB_START-GFW_START)
37 
38 #define Hob_Output(s)           fprintf(stderr, s)
39 
40 #define NVRAM_START  (GFW_START + NVRAM_OFFSET)
41 #define NVRAM_OFFSET (10 * (1UL << 20))
42 #define NVRAM_SIZE   (64 * (1UL << 10))
43 #define NVRAM_VALID_SIG  0x4650494e45584948 /* "HIXENIPF" */
44 #define VALIDATE_NVRAM_FD(x) ((1UL<<(sizeof(x)*8 - 1)) | x)
45 #define IS_VALID_NVRAM_FD(x) ((uint64_t)x >> (sizeof(x)*8 - 1))
46 #define READ_FROM_NVRAM 0
47 #define WRITE_TO_NVRAM 1
48 
49 struct nvram_save_addr {
50     unsigned long addr;
51     unsigned long signature;
52 };
53 
54 extern const char *nvram;
55 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
56                               unsigned long nvram_addr);
57 extern uint8_t *read_image(const char *filename, unsigned long *size);
58 
59 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
60 extern int kvm_ia64_nvram_init(unsigned long type);
61 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
62 #endif //__FIRM_WARE_
63