skimd.c revision 164010
11558Srgrimes/*-
21558Srgrimes * Copyright (c) 2006 Marcel Moolenaar
31558Srgrimes * All rights reserved.
41558Srgrimes *
51558Srgrimes * Redistribution and use in source and binary forms, with or without
61558Srgrimes * modification, are permitted provided that the following conditions
71558Srgrimes * are met:
81558Srgrimes *
91558Srgrimes * 1. Redistributions of source code must retain the above copyright
101558Srgrimes *    notice, this list of conditions and the following disclaimer.
111558Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
121558Srgrimes *    notice, this list of conditions and the following disclaimer in the
131558Srgrimes *    documentation and/or other materials provided with the distribution.
141558Srgrimes *
151558Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
161558Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171558Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
181558Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191558Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
201558Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211558Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
221558Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
231558Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
241558Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251558Srgrimes */
261558Srgrimes
271558Srgrimes#include <sys/cdefs.h>
281558Srgrimes__FBSDID("$FreeBSD: head/sys/boot/ia64/ski/skimd.c 164010 2006-11-05 22:03:04Z marcel $");
291558Srgrimes
301558Srgrimes#include <stand.h>
311558Srgrimes
321558Srgrimes#include <libia64.h>
331558Srgrimes
341558Srgrimes#include "libski.h"
3541477Sjulian
3623675Speter#define	PHYS_START	(4L*1024*1024*1024)
3741477Sjulian#define	PHYS_SIZE	(64L*1024*1024 - 4L*1024)
3841477Sjulian
3950476Speterextern void acpi_stub_init(void);
401558Srgrimesextern void efi_stub_init(struct bootinfo *);
411558Srgrimesextern void sal_stub_init(void);
421558Srgrimes
4341474Sjulianuint64_t
4423675Speterldr_alloc(vm_offset_t va)
451558Srgrimes{
461558Srgrimes
471558Srgrimes	if (va >= PHYS_SIZE)
4823796Sbde		return (0);
4923675Speter	return (va + PHYS_START);
501558Srgrimes}
5123675Speter
521558Srgrimesint
531558Srgrimesldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
541558Srgrimes{
551558Srgrimes	static struct bootinfo bootinfo;
561558Srgrimes
571558Srgrimes	efi_stub_init(bi);
581558Srgrimes	sal_stub_init();
591558Srgrimes	acpi_stub_init();
601558Srgrimes
611558Srgrimes	*bi_addr = (uint64_t)(&bootinfo);
621558Srgrimes	bootinfo = *bi;
631558Srgrimes	return (0);
641558Srgrimes}
651558Srgrimes
6623675Speterint
6723675Speterldr_enter(const char *kernel)
6823675Speter{
6923675Speter
7023675Speter	while (*kernel == '/')
7123675Speter		kernel++;
7223675Speter        ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS);
7323675Speter	return (0);
741558Srgrimes}
751558Srgrimes