Imported Upstream version 3.10
[debian/elilo] / ia64 / sysdeps.h
1 /*
2  *  Copyright (C) 2001-2003 Hewlett-Packard Co.
3  *      Contributed by Stephane Eranian <eranian@hpl.hp.com>
4  *
5  * This file is part of the ELILO, the EFI Linux boot loader.
6  *
7  *  ELILO is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  ELILO is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with ELILO; see the file COPYING.  If not, write to the Free
19  *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20  *  02111-1307, USA.
21  *
22  * Please check out the elilo.txt for complete documentation on how
23  * to use this program.
24  */
25
26 /*
27  * This file is used to define all the IA64-specific data structures, functions, 
28  * and constants used by the generic ELILO. 
29  *
30  * For things specific to this platform use private.h instead
31  */
32 #ifndef __ELILO_SYSDEPS_IA64_H__
33 #define __ELILO_SYSDEPS_IA64_H__
34
35 #define ELILO_ARCH      "IA-64" /* ASCII string ! */
36
37 /* in respective assembly files */
38 extern VOID Memset(VOID *, INTN, UINTN);
39 extern VOID Memcpy(VOID *, VOID *, UINTN);
40
41 extern VOID sysdep_register_options(VOID);
42
43 /*
44  * This version must match the one in the kernel
45  */
46 typedef struct ia64_boot_params {
47         /*
48          * The following three pointers MUST point to memory that is marked
49          * as EfiRuntimeServicesData so that the kernel doesn't think the
50          * underlying memory is free.
51          */
52         UINTN command_line;             /* physical address of command line arguments */
53         UINTN efi_systab;               /* physical address of EFI system table */
54         UINTN efi_memmap;               /* physical address of EFI memory map */
55         UINTN efi_memmap_size;          /* size of EFI memory map */
56         UINTN efi_memdesc_size; /* size of an EFI memory map descriptor */
57         UINT32 efi_memdesc_version;     /* descriptor version */
58         struct {
59                 UINT16 num_cols;        /* number of columns on console output device */
60                 UINT16 num_rows;        /* number of rows on console output device */
61                 UINT16 orig_x;          /* cursor's x position */
62                 UINT16 orig_y;          /* cursor's y position */
63         } console_info;
64         UINTN fpswa;                    /* physical address of fpswa interface */
65         UINTN initrd_start;             /* virtual address where the initial ramdisk begins */
66         UINTN initrd_size;              /* how big is the initial ramdisk */
67
68         UINTN vmcode_start;             /* virtual address where the boot time vmcode begins */
69         UINTN vmcode_size;              /* how big is the boot module */
70         UINTN loader_addr;              /* start address of boot loader */
71         UINTN loader_size;              /* size of loader code & data */
72
73 } boot_params_t;
74
75 typedef struct sys_img_options {
76         UINT8 dummy;                    /* forces non-zero offset for first field */
77         UINT8 allow_relocation;         /* allow kernel relocation on allocation error */
78 } sys_img_options_t;
79
80 /*
81  * How to jump to kernel code
82  */
83 static inline void
84 start_kernel(VOID *kentry, VOID *bp)
85 {
86         asm volatile ("mov r28=%1; br.sptk.few %0" :: "b"(kentry),"r"(bp));
87 }
88
89 static inline UINT64
90 __ia64_swab64 (UINT64 x)
91 {
92         UINT64 result;
93
94         asm volatile ("mux1 %0=%1,@rev" : "=r" (result) : "r" (x));
95         return result;
96 }
97
98 static inline UINT32
99 __ia64_swab32 (UINT32 x)
100 {
101         return __ia64_swab64(x) >> 32;
102 }
103
104 static inline UINT16
105 __ia64_swab16(UINT16 x)
106 {
107         return __ia64_swab64(x) >> 48;
108 }
109
110 #endif /* __ELILO_SYSDEPS_IA64_H__ */