1164010Smarcel/*-
2164010Smarcel * Copyright (c) 2006 Marcel Moolenaar
3164010Smarcel * All rights reserved.
4164010Smarcel *
5164010Smarcel * Redistribution and use in source and binary forms, with or without
6164010Smarcel * modification, are permitted provided that the following conditions
7164010Smarcel * are met:
8164010Smarcel *
9164010Smarcel * 1. Redistributions of source code must retain the above copyright
10164010Smarcel *    notice, this list of conditions and the following disclaimer.
11164010Smarcel * 2. Redistributions in binary form must reproduce the above copyright
12164010Smarcel *    notice, this list of conditions and the following disclaimer in the
13164010Smarcel *    documentation and/or other materials provided with the distribution.
14164010Smarcel *
15164010Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16164010Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17164010Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18164010Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19164010Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20164010Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21164010Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22164010Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23164010Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24164010Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25164010Smarcel *
26164010Smarcel * $FreeBSD$
27164010Smarcel */
28164010Smarcel
29164010Smarcel#ifndef _LIBIA64_H_
30164010Smarcel#define	_LIBIA64_H_
31164010Smarcel
32164010Smarcel#include <bootstrap.h>
33164010Smarcel#include <ia64/include/bootinfo.h>
34220313Smarcel#include <machine/vmparam.h>
35164010Smarcel
36220313Smarcel#define	IS_LEGACY_KERNEL()	(ia64_legacy_kernel)
37219691Smarcel
38164010Smarcel/*
39164010Smarcel * Portability functions provided by the loader
40164010Smarcel * implementation specific to the platform.
41164010Smarcel */
42219691Smarcelvm_paddr_t ia64_platform_alloc(vm_offset_t, vm_size_t);
43219691Smarcelvoid ia64_platform_free(vm_offset_t, vm_paddr_t, vm_size_t);
44219691Smarcelint ia64_platform_bootinfo(struct bootinfo *, struct bootinfo **);
45219691Smarcelint ia64_platform_enter(const char *);
46164010Smarcel
47164010Smarcel/*
48164010Smarcel * Functions and variables provided by the ia64 common code
49164010Smarcel * and shared by all loader implementations.
50164010Smarcel */
51220313Smarcelextern u_int ia64_legacy_kernel;
52220313Smarcel
53219691Smarcelextern uint64_t *ia64_pgtbl;
54219691Smarcelextern uint32_t ia64_pgtblsz;
55164010Smarcel
56219691Smarcelint ia64_autoload(void);
57219691Smarcelint ia64_bootinfo(struct preloaded_file *, struct bootinfo **);
58220313Smarceluint64_t ia64_loadaddr(u_int, void *, uint64_t);
59220313Smarcel#ifdef __elfN
60220313Smarcelvoid ia64_loadseg(Elf_Ehdr *, Elf_Phdr *, uint64_t);
61220313Smarcel#else
62220313Smarcelvoid ia64_loadseg(void *, void *, uint64_t);
63220313Smarcel#endif
64164010Smarcel
65219691Smarcelssize_t ia64_copyin(const void *, vm_offset_t, size_t);
66219691Smarcelssize_t ia64_copyout(vm_offset_t, void *, size_t);
67222798Smarcelvoid ia64_sync_icache(vm_offset_t, size_t);
68219691Smarcelssize_t ia64_readin(int, vm_offset_t, size_t);
69220313Smarcelvoid *ia64_va2pa(vm_offset_t, size_t *);
70164010Smarcel
71219691Smarcelchar *ia64_fmtdev(struct devdesc *);
72219691Smarcelint ia64_getdev(void **, const char *, const char **);
73219691Smarcelint ia64_setcurrdev(struct env_var *, int, const void *);
74164010Smarcel
75164010Smarcel#endif /* !_LIBIA64_H_ */
76