/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*-
* Copyright (C) 2000 Benno Rice.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
#include <stand.h>
#include "openfirm.h"
int (*openfirmware)(void *);
int real_mode = 0;
/* Initialiser */
void
{
OF_exit();
if (memory == -1)
if (memory == -1)
OF_exit();
}
OF_exit();
/*
* Check if we run in real mode. If so, we do not need to map
* memory later on.
*/
real_mode = 1;
}
/*
* Generic functions
*/
/* Test to see if a service exists. */
int
{
static struct {
} args = {
(cell_t)"test",
1,
1,
};
return (-1);
}
/* Return firmware millisecond count. */
int
{
static struct {
} args = {
(cell_t)"milliseconds",
0,
1,
};
openfirmware(&args);
}
/*
* Device tree functions
*/
/* Return the next sibling of this node or 0. */
{
static struct {
} args = {
(cell_t)"peer",
1,
1,
};
return (-1);
}
/* Return the first child of this node or 0. */
{
static struct {
} args = {
(cell_t)"child",
1,
1,
};
return (-1);
}
/* Return the parent of this node or 0. */
{
static struct {
} args = {
(cell_t)"parent",
1,
1,
};
return (-1);
}
/* Return the package handle that corresponds to an instance handle. */
{
static struct {
} args = {
(cell_t)"instance-to-package",
1,
1,
};
return (-1);
}
/* Get the length of a property of a package. */
int
{
static struct {
} args = {
(cell_t)"getproplen",
2,
1,
};
return (-1);
}
/* Get the value of a property of a package. */
int
{
static struct {
} args = {
(cell_t)"getprop",
4,
1,
};
return (-1);
}
/* Get the next property of a package. */
int
{
static struct {
} args = {
(cell_t)"nextprop",
3,
1,
};
return (-1);
}
/* Set the value of a property of a package. */
/* XXX Has a bug on FirePower */
int
{
static struct {
} args = {
(cell_t)"setprop",
4,
1,
};
return (-1);
}
/* Convert a device specifier to a fully qualified pathname. */
int
{
static struct {
} args = {
(cell_t)"canon",
3,
1,
};
return (-1);
}
/* Return a package handle for the specified device. */
{
static struct {
} args = {
(cell_t)"finddevice",
1,
1,
};
return (-1);
}
/* Return the fully qualified pathname corresponding to an instance. */
int
{
static struct {
} args = {
(cell_t)"instance-to-path",
3,
1,
};
return (-1);
}
/* Return the fully qualified pathname corresponding to a package. */
int
{
static struct {
} args = {
(cell_t)"package-to-path",
3,
1,
};
return (-1);
}
/* Call the method in the scope of a given instance. */
int
{
static struct {
} args = {
(cell_t)"call-method",
2,
1,
};
int n;
if (nargs > 6)
return (-1);
return (-1);
--n > 0;)
return (0);
}
/*
* Device I/O functions
*/
/* Open an instance for a device. */
{
static struct {
} args = {
(cell_t)"open",
1,
1,
};
return (-1);
}
}
/* Close an instance. */
void
{
static struct {
} args = {
(cell_t)"close",
1,
};
openfirmware(&args);
}
/* Read from an instance. */
int
{
static struct {
} args = {
(cell_t)"read",
3,
1,
};
#if defined(OPENFIRM_DEBUG)
printf("OF_read: called with instance=%08x, addr=%p, len=%d\n",
#endif
return (-1);
#if defined(OPENFIRM_DEBUG)
printf("OF_read: returning instance=%d, addr=%p, len=%d, actual=%d\n",
#endif
}
/* Write to an instance. */
int
{
static struct {
} args = {
(cell_t)"write",
3,
1,
};
return (-1);
}
/* Seek to a position. */
int
{
static struct {
} args = {
(cell_t)"seek",
3,
1,
};
return (-1);
}
/*
* Memory functions
*/
/* Claim an area of memory. */
void *
{
static struct {
} args = {
(cell_t)"claim",
3,
1,
};
return ((void *)-1);
}
/* Release an area of memory. */
void
{
static struct {
} args = {
(cell_t)"release",
2,
};
openfirmware(&args);
}
/*
* Control transfer functions
*/
/* Reset the system and call "boot <bootspec>". */
void
{
static struct {
} args = {
(cell_t)"boot",
1,
};
openfirmware(&args);
for (;;) /* just in case */
;
}
/* Suspend and drop back to the Open Firmware interface. */
void
OF_enter()
{
static struct {
} args = {
(cell_t)"enter",
};
openfirmware(&args);
/* We may come back. */
}
/* Shut down and drop back to the Open Firmware interface. */
void
OF_exit()
{
static struct {
} args = {
(cell_t)"exit",
};
openfirmware(&args);
for (;;) /* just in case */
;
}
void
{
static struct {
} args = {
(cell_t)"quiesce",
};
openfirmware(&args);
}
/* Free <size> bytes starting at <virt>, then call <entry> with <arg>. */
#if 0
void
{
static struct {
} args = {
(cell_t)"chain",
5,
};
openfirmware(&args);
}
#else
void
{
/*
* This is a REALLY dirty hack till the firmware gets this going
*/
#if 0
if (size > 0)
#endif
}
#endif