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