/*
* Copyright 2000, 2001, 2002
* Broadcom Corporation. All rights reserved.
*
* This software is furnished under license and may be used and copied only
* in accordance with the following terms and conditions. Subject to these
* conditions, you may download, copy, install, use, modify and distribute
* modified or unmodified copies of this software in source and/or binary
* form. No title or ownership is transferred hereby.
*
* 1) Any source code used, modified or distributed must reproduce and
* retain this copyright notice and list of conditions as they appear in
* the source file.
*
* 2) No right is granted to use any trade name, trademark, or logo of
* Broadcom Corporation. The "Broadcom Corporation" name may not be
* used to endorse or promote products derived from this software
* without the prior written permission of Broadcom Corporation.
*
* 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
* FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
* LIABLE FOR 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), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* *********************************************************************
*
* Broadcom Common Firmware Environment (CFE)
*
* Device function prototypes File: cfe_api.h
*
* This file contains declarations for doing callbacks to
* cfe from an application. It should be the only header
* needed by the application to use this library
*
* Authors: Mitch Lichtenberg, Chris Demetriou
*
********************************************************************* */
#ifndef CFE_API_H
#define CFE_API_H
/*
* Apply customizations here for different OSes. These need to:
* * typedef uint64_t, int64_t, intptr_t, uintptr_t.
* * define cfe_strlen() if use of an existing function is desired.
* * define CFE_API_IMPL_NAMESPACE if API functions are to use
* names in the implementation namespace.
* Also, optionally, if the build environment does not do so automatically,
* CFE_API_* can be defined here as desired.
*/
/* Begin customization. */
#include <sys/stdint.h> /* All of the typedefs. */
#include <sys/systm.h> /* strlen() prototype. */
#define CFE_API_ALL
#define cfe_strlen(x) strlen(x)
/* End customization. */
typedef struct {
int64_t fwi_version; /* major, minor, eco version */
int64_t fwi_totalmem; /* total installed mem */
int64_t fwi_flags; /* various flags */
int64_t fwi_boardid; /* board ID */
int64_t fwi_bootarea_va; /* VA of boot area */
int64_t fwi_bootarea_pa; /* PA of boot area */
int64_t fwi_bootarea_size; /* size of boot area */
} cfe_fwinfo_t;
/*
* cfe_strlen is handled specially: If already defined, it has been
* overridden in this environment with a standard strlen-like function.
*/
#ifdef cfe_strlen
# define CFE_API_STRLEN_CUSTOM
#else
# ifdef CFE_API_IMPL_NAMESPACE
# define cfe_strlen(a) __cfe_strlen(a)
# endif
int cfe_strlen(char *name);
#endif
/*
* Defines and prototypes for functions which take no arguments.
*/
#ifdef CFE_API_IMPL_NAMESPACE
int64_t __cfe_getticks(void);
#define cfe_getticks() __cfe_getticks()
#else
int64_t cfe_getticks(void);
#endif
int cfe_close(int handle);
int cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1);
int cfe_cpu_stop(int cpu);
int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
int cfe_enummem(int idx, int flags, uint64_t *start, uint64_t *length,
uint64_t *type);
int cfe_exit(int warm,int status);
int cfe_flushcache(int flg);
int cfe_getdevinfo(char *name);
int cfe_getenv(char *name, char *dest, int destlen);
int cfe_getfwinfo(cfe_fwinfo_t *info);
int cfe_getstdhandle(int flg);
int cfe_init(uint64_t handle,uint64_t ept);
int cfe_inpstat(int handle);
int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
int length, int *retlen, uint64_t offset);
int cfe_open(char *name);
int cfe_read(int handle, unsigned char *buffer, int length);
int cfe_readblk(int handle, int64_t offset, unsigned char *buffer, int length);
int cfe_setenv(char *name, char *val);
int cfe_write(int handle, unsigned char *buffer, int length);
int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer,
int length);