Imported Upstream version 3.4
[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 loader_addr;              /* start address of boot loader */
69         UINTN loader_size;              /* size of loader code & data */
70 } boot_params_t;
71
72 typedef struct sys_img_options {
73         UINT8 dummy;                    /* forces non-zero offset for first field */
74         UINT8 allow_relocation;         /* allow kernel relocation on allocation error */
75 } sys_img_options_t;
76
77 /*
78  * How to jump to kernel code
79  */
80 static inline void
81 start_kernel(VOID *kentry, VOID *bp)
82 {
83         asm volatile ("mov r28=%1; br.sptk.few %0" :: "b"(kentry),"r"(bp));
84 }
85
86 static inline const UINT64
87 __ia64_swab64 (UINT64 x)
88 {
89         UINT64 result;
90
91         asm volatile ("mux1 %0=%1,@rev" : "=r" (result) : "r" (x));
92         return result;
93 }
94
95 static inline const UINT32
96 __ia64_swab32 (UINT32 x)
97 {
98         return __ia64_swab64(x) >> 32;
99 }
100
101 static inline const UINT16
102 __ia64_swab16(UINT16 x)
103 {
104         return __ia64_swab64(x) >> 48;
105 }
106
107 #endif /* __ELILO_SYSDEPS_IA64_H__ */