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
27164010Smarcel#include <sys/cdefs.h>
28164010Smarcel__FBSDID("$FreeBSD$");
29164010Smarcel
30164010Smarcel#include <stand.h>
31164010Smarcel
32164010Smarcel#include <libia64.h>
33164010Smarcel
34164010Smarcel#include "libski.h"
35164010Smarcel
36164010Smarcelextern void acpi_stub_init(void);
37164010Smarcelextern void efi_stub_init(struct bootinfo *);
38164010Smarcelextern void sal_stub_init(void);
39164010Smarcel
40219691Smarcelvm_paddr_t
41219691Smarcelia64_platform_alloc(vm_offset_t va, vm_size_t sz __unused)
42164010Smarcel{
43219691Smarcel	vm_paddr_t pa;
44164010Smarcel
45219691Smarcel	if (va == 0)
46220283Smarcel		pa = 2 * 1024 * 1024;
47219691Smarcel	else
48220283Smarcel		pa = (va - IA64_PBVM_BASE) + (32 * 1024 * 1024);
49219691Smarcel
50219691Smarcel	return (pa);
51164010Smarcel}
52164010Smarcel
53219691Smarcelvoid
54219691Smarcelia64_platform_free(vm_offset_t va __unused, vm_paddr_t pa __unused,
55219691Smarcel    vm_size_t sz __unused)
56219691Smarcel{
57219691Smarcel}
58219691Smarcel
59164010Smarcelint
60219691Smarcelia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res)
61164010Smarcel{
62164010Smarcel	static struct bootinfo bootinfo;
63164010Smarcel
64164010Smarcel	efi_stub_init(bi);
65164010Smarcel	sal_stub_init();
66164010Smarcel	acpi_stub_init();
67164010Smarcel
68220283Smarcel	if (IS_LEGACY_KERNEL())
69220283Smarcel		*res = &bootinfo;
70220283Smarcel
71164010Smarcel	return (0);
72164010Smarcel}
73164010Smarcel
74164010Smarcelint
75219691Smarcelia64_platform_enter(const char *kernel)
76164010Smarcel{
77164010Smarcel
78164010Smarcel	while (*kernel == '/')
79164010Smarcel		kernel++;
80219691Smarcel	ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS);
81164010Smarcel	return (0);
82164010Smarcel}
83