199767f8919635c4928607450d9e0abb932109ceToomas Soome/*-
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (C) 2000 Benno Rice.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include "openfirm.h"
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Note: Must match the 'struct devdesc' in bootstrap.h */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct ofw_devdesc {
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct devsw *d_dev;
199767f8919635c4928607450d9e0abb932109ceToomas Soome int d_type;
199767f8919635c4928607450d9e0abb932109ceToomas Soome int d_unit;
199767f8919635c4928607450d9e0abb932109ceToomas Soome ihandle_t d_handle;
199767f8919635c4928607450d9e0abb932109ceToomas Soome union {
199767f8919635c4928607450d9e0abb932109ceToomas Soome char d_path[256];
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t pool_guid;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t root_guid;
199767f8919635c4928607450d9e0abb932109ceToomas Soome };
199767f8919635c4928607450d9e0abb932109ceToomas Soome };
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern int ofw_getdev(void **vdev, const char *devspec, const char **path);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern ev_sethook_t ofw_setcurrdev;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct devsw ofwdisk;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct netif_driver ofwnet;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint ofwn_getunit(const char *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t ofw_copyin(const void *src, vm_offset_t dest, const size_t len);
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t ofw_copyout(const vm_offset_t src, void *dest, const size_t len);
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t ofw_readin(const int fd, vm_offset_t dest, const size_t len);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern int ofw_boot(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern int ofw_autoload(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid ofw_memmap(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid *ofw_alloc_heap(unsigned int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid ofw_release_heap(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct preloaded_file;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct file_format;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint ofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint ofw_elf_exec(struct preloaded_file *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format ofw_elf;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef __powerpc__
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format ofw_elf64;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern void reboot(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct ofw_reg
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome cell_t base;
199767f8919635c4928607450d9e0abb932109ceToomas Soome cell_t size;
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct ofw_reg2
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome cell_t base_hi;
199767f8919635c4928607450d9e0abb932109ceToomas Soome cell_t base_lo;
199767f8919635c4928607450d9e0abb932109ceToomas Soome cell_t size;
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern int (*openfirmware)(void *);