colibri_imx6: fix video stdout in default environment
[oweals/u-boot.git] / include / ext_common.h
index 4cd2aa7b5accfd43d467427e47db685ff7d50b40..bc3324172a082abb34faff16f025cb0fd335df8a 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * (C) Copyright 2011 - 2012 Samsung Electronics
  * EXT4 filesystem implementation in Uboot by
  * based on code from grub2 fs/ext2.c and fs/fshelp.c by
  * GRUB  --  GRand Unified Bootloader
  * Copyright (C) 2003, 2004  Free Software Foundation, Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef __EXT_COMMON__
 #define __EXT_COMMON__
-#include <command.h>
+
+struct cmd_tbl;
+
 #define SECTOR_SIZE            0x200
+#define LOG2_SECTOR_SIZE       9
 
 /* Magic value used to identify an ext2 filesystem.  */
 #define        EXT2_MAGIC                      0xEF53
@@ -52,8 +54,6 @@
 #define LOG2_BLOCK_SIZE(data)     (le32_to_cpu            \
                                    (data->sblock.log2_block_size) \
                                    + EXT2_MIN_BLOCK_LOG_SIZE)
-#define INODE_SIZE_FILESYSTEM(data)    (le16_to_cpu \
-                       (data->sblock.inode_size))
 
 #define EXT2_FT_DIR    2
 #define SUCCESS        1
@@ -101,6 +101,33 @@ struct ext2_sblock {
        char volume_name[16];
        char last_mounted_on[64];
        __le32 compression_info;
+       uint8_t prealloc_blocks;
+       uint8_t prealloc_dir_blocks;
+       __le16 reserved_gdt_blocks;
+       uint8_t journal_uuid[16];
+       __le32 journal_inode;
+       __le32 journal_dev;
+       __le32 last_orphan;
+       __le32 hash_seed[4];
+       uint8_t default_hash_version;
+       uint8_t journal_backup_type;
+       __le16 descriptor_size;
+       __le32 default_mount_options;
+       __le32 first_meta_block_group;
+       __le32 mkfs_time;
+       __le32 journal_blocks[17];
+       __le32 total_blocks_high;
+       __le32 reserved_blocks_high;
+       __le32 free_blocks_high;
+       __le16 min_extra_inode_size;
+       __le16 want_extra_inode_size;
+       __le32 flags;
+       __le16 raid_stride;
+       __le16 mmp_interval;
+       __le64 mmp_block;
+       __le32 raid_stripe_width;
+       uint8_t log2_groups_per_flex;
+       uint8_t checksum_type;
 };
 
 struct ext2_block_group {
@@ -111,9 +138,23 @@ struct ext2_block_group {
        __le16 free_inodes;     /* Free inodes count */
        __le16 used_dir_cnt;    /* Directories count */
        __le16 bg_flags;
-       __le32 bg_reserved[2];
+       __le32 bg_exclude_bitmap;
+       __le16 bg_block_id_csum;
+       __le16 bg_inode_id_csum;
        __le16 bg_itable_unused; /* Unused inodes count */
-       __le16 bg_checksum;     /* crc16(s_uuid+grouo_num+group_desc)*/
+       __le16 bg_checksum;     /* crc16(s_uuid+group_num+group_desc)*/
+       /* following fields only exist if descriptor size is 64 */
+       __le32 block_id_high;
+       __le32 inode_id_high;
+       __le32 inode_table_id_high;
+       __le16 free_blocks_high;
+       __le16 free_inodes_high;
+       __le16 used_dir_cnt_high;
+       __le16 bg_itable_unused_high;
+       __le32 bg_exclude_bitmap_high;
+       __le16 bg_block_id_csum_high;
+       __le16 bg_inode_id_csum_high;
+       __le32 bg_reserved;
 };
 
 /* The ext2 inode. */
@@ -127,7 +168,7 @@ struct ext2_inode {
        __le32 dtime;
        __le16 gid;
        __le16 nlinks;
-       __le32 blockcnt;        /* Blocks of 512 bytes!! */
+       __le32 blockcnt;        /* Blocks of either 512 or block_size bytes */
        __le32 flags;
        __le32 osd1;
        union {
@@ -138,10 +179,11 @@ struct ext2_inode {
                        __le32 triple_indir_block;
                } blocks;
                char symlink[60];
+               char inline_data[60];
        } b;
        __le32 version;
        __le32 acl;
-       __le32 dir_acl;
+       __le32 size_high;       /* previously dir_acl, but never used */
        __le32 fragment_addr;
        __le32 osd2[3];
 };
@@ -170,11 +212,11 @@ struct ext2_data {
 
 extern lbaint_t part_offset;
 
-int do_ext2ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,
-                                       char *const argv[]);
-int do_ext4_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
-                               char *const argv[]);
+int do_ext2ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext4_load(struct cmd_tbl *cmdtp, int flag, int argc,
+                char *const argv[]);
+int do_ext4_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext4_write(struct cmd_tbl *cmdtp, int flag, int argc,
+                 char *const argv[]);
 #endif