blob: f5c89f3f13773199f5a971e5db11bce338c7f647 [file] [log] [blame]
Rafal Jaworowski9e1d16c2008-02-21 11:56:44 +01001/*
2 * (C) Copyright 2007-2008 Semihalf
3 *
4 * Written by: Rafal Jaworowski <raj@semihalf.com>
5 *
Wolfgang Denkff3fcbb2013-07-28 22:12:43 +02006 * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause
Rafal Jaworowski9e1d16c2008-02-21 11:56:44 +01007 */
8
Rafal Jaworowskia19be782008-01-09 19:39:36 +01009#ifndef _API_PUBLIC_H_
10#define _API_PUBLIC_H_
11
12#define API_EINVAL 1 /* invalid argument(s) */
13#define API_ENODEV 2 /* no device */
14#define API_ENOMEM 3 /* no memory */
15#define API_EBUSY 4 /* busy, occupied etc. */
16#define API_EIO 5 /* I/O error */
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010017#define API_ESYSC 6 /* syscall error */
Rafal Jaworowskia19be782008-01-09 19:39:36 +010018
19typedef int (*scp_t)(int, int *, ...);
20
21#define API_SIG_VERSION 1
22#define API_SIG_MAGIC "UBootAPI"
23#define API_SIG_MAGLEN 8
24
25struct api_signature {
26 char magic[API_SIG_MAGLEN]; /* magic string */
27 uint16_t version; /* API version */
28 uint32_t checksum; /* checksum of this sig struct */
29 scp_t syscall; /* entry point to the API */
30};
31
32enum {
33 API_RSVD = 0,
34 API_GETC,
35 API_PUTC,
36 API_TSTC,
37 API_PUTS,
38 API_RESET,
39 API_GET_SYS_INFO,
40 API_UDELAY,
41 API_GET_TIMER,
42 API_DEV_ENUM,
43 API_DEV_OPEN,
44 API_DEV_CLOSE,
45 API_DEV_READ,
46 API_DEV_WRITE,
47 API_ENV_ENUM,
48 API_ENV_GET,
49 API_ENV_SET,
Che-Liang Chiou0d460412011-10-20 23:04:22 +000050 API_DISPLAY_GET_INFO,
51 API_DISPLAY_DRAW_BITMAP,
52 API_DISPLAY_CLEAR,
Rafal Jaworowskia19be782008-01-09 19:39:36 +010053 API_MAXCALL
54};
55
56#define MR_ATTR_FLASH 0x0001
57#define MR_ATTR_DRAM 0x0002
58#define MR_ATTR_SRAM 0x0003
59
60struct mem_region {
61 unsigned long start;
62 unsigned long size;
63 int flags;
64};
65
66struct sys_info {
67 unsigned long clk_bus;
68 unsigned long clk_cpu;
69 unsigned long bar;
70 struct mem_region *mr;
71 int mr_no; /* number of memory regions */
72};
73
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020074#undef CONFIG_SYS_64BIT_LBA
75#ifdef CONFIG_SYS_64BIT_LBA
Rafal Jaworowskia19be782008-01-09 19:39:36 +010076typedef u_int64_t lbasize_t;
77#else
78typedef unsigned long lbasize_t;
79#endif
80typedef unsigned long lbastart_t;
81
82#define DEV_TYP_NONE 0x0000
83#define DEV_TYP_NET 0x0001
84
85#define DEV_TYP_STOR 0x0002
86#define DT_STOR_IDE 0x0010
87#define DT_STOR_SCSI 0x0020
88#define DT_STOR_USB 0x0040
89#define DT_STOR_MMC 0x0080
Stefan Roese37628252008-08-06 14:05:38 +020090#define DT_STOR_SATA 0x0100
Rafal Jaworowskia19be782008-01-09 19:39:36 +010091
92#define DEV_STA_CLOSED 0x0000 /* invalid, closed */
93#define DEV_STA_OPEN 0x0001 /* open i.e. active */
94
95struct device_info {
96 int type;
97 void *cookie;
98
99 union {
100 struct {
101 lbasize_t block_count; /* no of blocks */
102 unsigned long block_size; /* size of one block */
103 } storage;
104
105 struct {
106 unsigned char hwaddr[6];
107 } net;
108 } info;
109#define di_stor info.storage
110#define di_net info.net
111
112 int state;
113};
114
Che-Liang Chiou0d460412011-10-20 23:04:22 +0000115#define DISPLAY_TYPE_LCD 0x0001
116#define DISPLAY_TYPE_VIDEO 0x0002
117
118struct display_info {
119 int type;
120 /* screen size in pixels */
121 int pixel_width;
122 int pixel_height;
123 /* screen size in rows and columns of text */
124 int screen_rows;
125 int screen_cols;
126};
127
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100128#endif /* _API_PUBLIC_H_ */