2 * (C) Copyright 2007-2008 Semihalf
4 * Written by: Rafal Jaworowski <raj@semihalf.com>
6 * This file is dual licensed; you can use it under the terms of
7 * either the GPL, or the BSD license, at your option.
11 * This file is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This file is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
39 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
40 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
43 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
45 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
48 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 #ifndef _API_PUBLIC_H_
53 #define _API_PUBLIC_H_
55 #define API_EINVAL 1 /* invalid argument(s) */
56 #define API_ENODEV 2 /* no device */
57 #define API_ENOMEM 3 /* no memory */
58 #define API_EBUSY 4 /* busy, occupied etc. */
59 #define API_EIO 5 /* I/O error */
61 typedef int (*scp_t
)(int, int *, ...);
63 #define API_SIG_VERSION 1
64 #define API_SIG_MAGIC "UBootAPI"
65 #define API_SIG_MAGLEN 8
67 struct api_signature
{
68 char magic
[API_SIG_MAGLEN
]; /* magic string */
69 uint16_t version
; /* API version */
70 uint32_t checksum
; /* checksum of this sig struct */
71 scp_t syscall
; /* entry point to the API */
95 #define MR_ATTR_FLASH 0x0001
96 #define MR_ATTR_DRAM 0x0002
97 #define MR_ATTR_SRAM 0x0003
106 unsigned long clk_bus
;
107 unsigned long clk_cpu
;
109 struct mem_region
*mr
;
110 int mr_no
; /* number of memory regions */
115 typedef u_int64_t lbasize_t
;
117 typedef unsigned long lbasize_t
;
119 typedef unsigned long lbastart_t
;
121 #define DEV_TYP_NONE 0x0000
122 #define DEV_TYP_NET 0x0001
124 #define DEV_TYP_STOR 0x0002
125 #define DT_STOR_IDE 0x0010
126 #define DT_STOR_SCSI 0x0020
127 #define DT_STOR_USB 0x0040
128 #define DT_STOR_MMC 0x0080
130 #define DEV_STA_CLOSED 0x0000 /* invalid, closed */
131 #define DEV_STA_OPEN 0x0001 /* open i.e. active */
139 lbasize_t block_count
; /* no of blocks */
140 unsigned long block_size
; /* size of one block */
144 unsigned char hwaddr
[6];
147 #define di_stor info.storage
148 #define di_net info.net
153 #endif /* _API_PUBLIC_H_ */