Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
0004  */
0005 /*
0006  * Broadcom Common Firmware Environment (CFE)
0007  *
0008  * This file contains declarations for doing callbacks to
0009  * cfe from an application.  It should be the only header
0010  * needed by the application to use this library
0011  *
0012  * Authors:  Mitch Lichtenberg, Chris Demetriou
0013  */
0014 #ifndef CFE_API_H
0015 #define CFE_API_H
0016 
0017 #include <linux/types.h>
0018 #include <linux/string.h>
0019 
0020 typedef long intptr_t;
0021 
0022 
0023 /*
0024  * Constants
0025  */
0026 
0027 /* Seal indicating CFE's presence, passed to user program. */
0028 #define CFE_EPTSEAL 0x43464531
0029 
0030 #define CFE_MI_RESERVED 0   /* memory is reserved, do not use */
0031 #define CFE_MI_AVAILABLE 1  /* memory is available */
0032 
0033 #define CFE_FLG_WARMSTART     0x00000001
0034 #define CFE_FLG_FULL_ARENA    0x00000001
0035 #define CFE_FLG_ENV_PERMANENT 0x00000001
0036 
0037 #define CFE_CPU_CMD_START 1
0038 #define CFE_CPU_CMD_STOP 0
0039 
0040 #define CFE_STDHANDLE_CONSOLE   0
0041 
0042 #define CFE_DEV_NETWORK     1
0043 #define CFE_DEV_DISK        2
0044 #define CFE_DEV_FLASH       3
0045 #define CFE_DEV_SERIAL      4
0046 #define CFE_DEV_CPU     5
0047 #define CFE_DEV_NVRAM       6
0048 #define CFE_DEV_CLOCK       7
0049 #define CFE_DEV_OTHER       8
0050 #define CFE_DEV_MASK        0x0F
0051 
0052 #define CFE_CACHE_FLUSH_D   1
0053 #define CFE_CACHE_INVAL_I   2
0054 #define CFE_CACHE_INVAL_D   4
0055 #define CFE_CACHE_INVAL_L2  8
0056 
0057 #define CFE_FWI_64BIT       0x00000001
0058 #define CFE_FWI_32BIT       0x00000002
0059 #define CFE_FWI_RELOC       0x00000004
0060 #define CFE_FWI_UNCACHED    0x00000008
0061 #define CFE_FWI_MULTICPU    0x00000010
0062 #define CFE_FWI_FUNCSIM     0x00000020
0063 #define CFE_FWI_RTLSIM      0x00000040
0064 
0065 typedef struct {
0066     int64_t fwi_version;        /* major, minor, eco version */
0067     int64_t fwi_totalmem;       /* total installed mem */
0068     int64_t fwi_flags;      /* various flags */
0069     int64_t fwi_boardid;        /* board ID */
0070     int64_t fwi_bootarea_va;    /* VA of boot area */
0071     int64_t fwi_bootarea_pa;    /* PA of boot area */
0072     int64_t fwi_bootarea_size;  /* size of boot area */
0073 } cfe_fwinfo_t;
0074 
0075 
0076 /*
0077  * Defines and prototypes for functions which take no arguments.
0078  */
0079 int64_t cfe_getticks(void);
0080 
0081 /*
0082  * Defines and prototypes for the rest of the functions.
0083  */
0084 int cfe_close(int handle);
0085 int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1);
0086 int cfe_cpu_stop(int cpu);
0087 int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
0088 int cfe_enummem(int idx, int flags, uint64_t * start, uint64_t * length,
0089         uint64_t * type);
0090 int cfe_exit(int warm, int status);
0091 int cfe_flushcache(int flg);
0092 int cfe_getdevinfo(char *name);
0093 int cfe_getenv(char *name, char *dest, int destlen);
0094 int cfe_getfwinfo(cfe_fwinfo_t * info);
0095 int cfe_getstdhandle(int flg);
0096 int cfe_init(uint64_t handle, uint64_t ept);
0097 int cfe_inpstat(int handle);
0098 int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
0099           int length, int *retlen, uint64_t offset);
0100 int cfe_open(char *name);
0101 int cfe_read(int handle, unsigned char *buffer, int length);
0102 int cfe_readblk(int handle, int64_t offset, unsigned char *buffer,
0103         int length);
0104 int cfe_setenv(char *name, char *val);
0105 int cfe_write(int handle, const char *buffer, int length);
0106 int cfe_writeblk(int handle, int64_t offset, const char *buffer,
0107          int length);
0108 extern unsigned long cfe_seal;
0109 __printf(1, 2) void cfe_die(char *fmt, ...);
0110 
0111 #endif              /* CFE_API_H */