1 /*
2  * Copyright (c) 2006-2020, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2020-08-19     lizhirui     first version
9  */
10 
11 #ifndef __BLK_DEVICE_H__
12 #define __BLK_DEVICE_H__
13 
14 #include <rtconfig.h>
15 #include <ext4_mbr.h>
16 
17 #define DEV_TYPE_UNKNOWN 0xff  /* not connected */
18 #define DEV_TYPE_HARDDISK 0x00 /* harddisk */
19 #define DEV_TYPE_TAPE 0x01     /* Tape */
20 #define DEV_TYPE_CDROM 0x05    /* CD-ROM */
21 #define DEV_TYPE_OPDISK 0x07   /* optical disk */
22 
23 struct blk_device
24 {
25     struct rt_device parent;
26     struct ahci_uc_priv *ahci_device;
27 
28     rt_uint8_t target;
29     rt_uint8_t lun;
30     rt_uint8_t type;
31 
32 #ifdef RT_USING_DFS_LWEXT4
33     struct ext4_mbr_bdevs ext4_partition;
34 #endif
35 
36     rt_bool_t lba48;
37     rt_uint64_t lba;
38     rt_uint64_t blksz;
39     rt_int32_t log2blksz;
40 
41     char product[21];
42     char revision[9];
43     char vendor[41];
44 };
45 
46 void blk_device_init(struct blk_device *blk_devices);
47 
48 #endif
49