/*1* (C) Copyright 2007-2008 Semihalf2*3* Written by: Rafal Jaworowski <[email protected]>4*5* This file is dual licensed; you can use it under the terms of6* either the GPL, or the BSD license, at your option.7*8* I. GPL:9*10* This file is free software; you can redistribute it and/or11* modify it under the terms of the GNU General Public License as12* published by the Free Software Foundation; either version 2 of13* the License, or (at your option) any later version.14*15* This file is distributed in the hope that it will be useful,16* but WITHOUT ANY WARRANTY; without even the implied warranty of17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18* GNU General Public License for more details.19*20* You should have received a copy of the GNU General Public License21* along with this program; if not, write to the Free Software22* Foundation, Inc., 59 Temple Place, Suite 330, Boston,23* MA 02111-1307 USA24*25* Alternatively,26*27* II. BSD license:28*29* Redistribution and use in source and binary forms, with or without30* modification, are permitted provided that the following conditions31* are met:32* 1. Redistributions of source code must retain the above copyright33* notice, this list of conditions and the following disclaimer.34* 2. Redistributions in binary form must reproduce the above copyright35* notice, this list of conditions and the following disclaimer in the36* documentation and/or other materials provided with the distribution.37*38* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND39* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE40* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE41* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE42* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL43* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS44* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)45* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT46* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY47* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF48* SUCH DAMAGE.49*50* This file needs to be kept in sync with U-Boot reference:51* http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=include/api_public.h52*/5354#ifndef _API_PUBLIC_H_55#define _API_PUBLIC_H_5657#define API_EINVAL 1 /* invalid argument(s) */58#define API_ENODEV 2 /* no device */59#define API_ENOMEM 3 /* no memory */60#define API_EBUSY 4 /* busy, occupied etc. */61#define API_EIO 5 /* I/O error */62#define API_ESYSC 6 /* syscall error */6364typedef int (*scp_t)(int, int *, ...);6566#define API_SIG_VERSION 167#define API_SIG_MAGIC "UBootAPI"68#define API_SIG_MAGLEN 86970struct api_signature {71char magic[API_SIG_MAGLEN]; /* magic string */72uint16_t version; /* API version */73uint32_t checksum; /* checksum of this sig struct */74scp_t syscall; /* entry point to the API */75};7677enum {78API_RSVD = 0,79API_GETC,80API_PUTC,81API_TSTC,82API_PUTS,83API_RESET,84API_GET_SYS_INFO,85API_UDELAY,86API_GET_TIMER,87API_DEV_ENUM,88API_DEV_OPEN,89API_DEV_CLOSE,90API_DEV_READ,91API_DEV_WRITE,92API_ENV_ENUM,93API_ENV_GET,94API_ENV_SET,95API_MAXCALL96};9798#define MR_ATTR_FLASH 0x000199#define MR_ATTR_DRAM 0x0002100#define MR_ATTR_SRAM 0x0003101102struct mem_region {103unsigned long start;104unsigned long size;105int flags;106};107108struct sys_info {109unsigned long clk_bus;110unsigned long clk_cpu;111unsigned long bar;112struct mem_region *mr;113int mr_no; /* number of memory regions */114};115116#undef CFG_64BIT_LBA117#ifdef CFG_64BIT_LBA118typedef uint64_t lbasize_t;119#else120typedef unsigned long lbasize_t;121#endif122typedef unsigned long lbastart_t;123124#define DEV_TYP_NONE 0x0000125#define DEV_TYP_NET 0x0001126127#define DEV_TYP_STOR 0x0002128#define DT_STOR_IDE 0x0010129#define DT_STOR_SCSI 0x0020130#define DT_STOR_USB 0x0040131#define DT_STOR_MMC 0x0080132#define DT_STOR_SATA 0x0100133134#define DEV_STA_CLOSED 0x0000 /* invalid, closed */135#define DEV_STA_OPEN 0x0001 /* open i.e. active */136137struct device_info {138int type;139void *cookie;140141union {142struct {143lbasize_t block_count; /* no of blocks */144unsigned long block_size; /* size of one block */145} storage;146147struct {148unsigned char hwaddr[6];149} net;150} info;151#define di_stor info.storage152#define di_net info.net153154int state;155};156157#endif /* _API_PUBLIC_H_ */158159160