1*4549e789STom Rini /* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ 2e7a85f26SRafal Jaworowski /* 3e7a85f26SRafal Jaworowski * (C) Copyright 2007-2008 Semihalf 4e7a85f26SRafal Jaworowski * 5e7a85f26SRafal Jaworowski * Written by: Rafal Jaworowski <raj@semihalf.com> 6e7a85f26SRafal Jaworowski */ 7e7a85f26SRafal Jaworowski 8500856ebSRafal Jaworowski #ifndef _API_PUBLIC_H_ 9500856ebSRafal Jaworowski #define _API_PUBLIC_H_ 10500856ebSRafal Jaworowski 11500856ebSRafal Jaworowski #define API_EINVAL 1 /* invalid argument(s) */ 12500856ebSRafal Jaworowski #define API_ENODEV 2 /* no device */ 13500856ebSRafal Jaworowski #define API_ENOMEM 3 /* no memory */ 14500856ebSRafal Jaworowski #define API_EBUSY 4 /* busy, occupied etc. */ 15500856ebSRafal Jaworowski #define API_EIO 5 /* I/O error */ 16923aa481SRafal Jaworowski #define API_ESYSC 6 /* syscall error */ 17500856ebSRafal Jaworowski 18500856ebSRafal Jaworowski typedef int (*scp_t)(int, int *, ...); 19500856ebSRafal Jaworowski 20500856ebSRafal Jaworowski #define API_SIG_VERSION 1 21500856ebSRafal Jaworowski #define API_SIG_MAGIC "UBootAPI" 22500856ebSRafal Jaworowski #define API_SIG_MAGLEN 8 23500856ebSRafal Jaworowski 24500856ebSRafal Jaworowski struct api_signature { 25500856ebSRafal Jaworowski char magic[API_SIG_MAGLEN]; /* magic string */ 26500856ebSRafal Jaworowski uint16_t version; /* API version */ 27500856ebSRafal Jaworowski uint32_t checksum; /* checksum of this sig struct */ 28500856ebSRafal Jaworowski scp_t syscall; /* entry point to the API */ 29500856ebSRafal Jaworowski }; 30500856ebSRafal Jaworowski 31500856ebSRafal Jaworowski enum { 32500856ebSRafal Jaworowski API_RSVD = 0, 33500856ebSRafal Jaworowski API_GETC, 34500856ebSRafal Jaworowski API_PUTC, 35500856ebSRafal Jaworowski API_TSTC, 36500856ebSRafal Jaworowski API_PUTS, 37500856ebSRafal Jaworowski API_RESET, 38500856ebSRafal Jaworowski API_GET_SYS_INFO, 39500856ebSRafal Jaworowski API_UDELAY, 40500856ebSRafal Jaworowski API_GET_TIMER, 41500856ebSRafal Jaworowski API_DEV_ENUM, 42500856ebSRafal Jaworowski API_DEV_OPEN, 43500856ebSRafal Jaworowski API_DEV_CLOSE, 44500856ebSRafal Jaworowski API_DEV_READ, 45500856ebSRafal Jaworowski API_DEV_WRITE, 46500856ebSRafal Jaworowski API_ENV_ENUM, 47500856ebSRafal Jaworowski API_ENV_GET, 48500856ebSRafal Jaworowski API_ENV_SET, 49a2a5729fSChe-Liang Chiou API_DISPLAY_GET_INFO, 50a2a5729fSChe-Liang Chiou API_DISPLAY_DRAW_BITMAP, 51a2a5729fSChe-Liang Chiou API_DISPLAY_CLEAR, 52500856ebSRafal Jaworowski API_MAXCALL 53500856ebSRafal Jaworowski }; 54500856ebSRafal Jaworowski 55500856ebSRafal Jaworowski #define MR_ATTR_FLASH 0x0001 56500856ebSRafal Jaworowski #define MR_ATTR_DRAM 0x0002 57500856ebSRafal Jaworowski #define MR_ATTR_SRAM 0x0003 58500856ebSRafal Jaworowski 59500856ebSRafal Jaworowski struct mem_region { 60500856ebSRafal Jaworowski unsigned long start; 61500856ebSRafal Jaworowski unsigned long size; 62500856ebSRafal Jaworowski int flags; 63500856ebSRafal Jaworowski }; 64500856ebSRafal Jaworowski 65500856ebSRafal Jaworowski struct sys_info { 66500856ebSRafal Jaworowski unsigned long clk_bus; 67500856ebSRafal Jaworowski unsigned long clk_cpu; 68500856ebSRafal Jaworowski unsigned long bar; 69500856ebSRafal Jaworowski struct mem_region *mr; 70500856ebSRafal Jaworowski int mr_no; /* number of memory regions */ 71500856ebSRafal Jaworowski }; 72500856ebSRafal Jaworowski 736d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #undef CONFIG_SYS_64BIT_LBA 746d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #ifdef CONFIG_SYS_64BIT_LBA 75500856ebSRafal Jaworowski typedef u_int64_t lbasize_t; 76500856ebSRafal Jaworowski #else 77500856ebSRafal Jaworowski typedef unsigned long lbasize_t; 78500856ebSRafal Jaworowski #endif 79500856ebSRafal Jaworowski typedef unsigned long lbastart_t; 80500856ebSRafal Jaworowski 81500856ebSRafal Jaworowski #define DEV_TYP_NONE 0x0000 82500856ebSRafal Jaworowski #define DEV_TYP_NET 0x0001 83500856ebSRafal Jaworowski 84500856ebSRafal Jaworowski #define DEV_TYP_STOR 0x0002 85500856ebSRafal Jaworowski #define DT_STOR_IDE 0x0010 86500856ebSRafal Jaworowski #define DT_STOR_SCSI 0x0020 87500856ebSRafal Jaworowski #define DT_STOR_USB 0x0040 88500856ebSRafal Jaworowski #define DT_STOR_MMC 0x0080 89f2302d44SStefan Roese #define DT_STOR_SATA 0x0100 90500856ebSRafal Jaworowski 91500856ebSRafal Jaworowski #define DEV_STA_CLOSED 0x0000 /* invalid, closed */ 92500856ebSRafal Jaworowski #define DEV_STA_OPEN 0x0001 /* open i.e. active */ 93500856ebSRafal Jaworowski 94500856ebSRafal Jaworowski struct device_info { 95500856ebSRafal Jaworowski int type; 96500856ebSRafal Jaworowski void *cookie; 97500856ebSRafal Jaworowski 98500856ebSRafal Jaworowski union { 99500856ebSRafal Jaworowski struct { 100500856ebSRafal Jaworowski lbasize_t block_count; /* no of blocks */ 101500856ebSRafal Jaworowski unsigned long block_size; /* size of one block */ 102500856ebSRafal Jaworowski } storage; 103500856ebSRafal Jaworowski 104500856ebSRafal Jaworowski struct { 105500856ebSRafal Jaworowski unsigned char hwaddr[6]; 106500856ebSRafal Jaworowski } net; 107500856ebSRafal Jaworowski } info; 108500856ebSRafal Jaworowski #define di_stor info.storage 109500856ebSRafal Jaworowski #define di_net info.net 110500856ebSRafal Jaworowski 111500856ebSRafal Jaworowski int state; 112500856ebSRafal Jaworowski }; 113500856ebSRafal Jaworowski 114a2a5729fSChe-Liang Chiou #define DISPLAY_TYPE_LCD 0x0001 115a2a5729fSChe-Liang Chiou #define DISPLAY_TYPE_VIDEO 0x0002 116a2a5729fSChe-Liang Chiou 117a2a5729fSChe-Liang Chiou struct display_info { 118a2a5729fSChe-Liang Chiou int type; 119a2a5729fSChe-Liang Chiou /* screen size in pixels */ 120a2a5729fSChe-Liang Chiou int pixel_width; 121a2a5729fSChe-Liang Chiou int pixel_height; 122a2a5729fSChe-Liang Chiou /* screen size in rows and columns of text */ 123a2a5729fSChe-Liang Chiou int screen_rows; 124a2a5729fSChe-Liang Chiou int screen_cols; 125a2a5729fSChe-Liang Chiou }; 126a2a5729fSChe-Liang Chiou 127500856ebSRafal Jaworowski #endif /* _API_PUBLIC_H_ */ 128