dev: implement block device registration

This commit is contained in:
2023-07-08 15:55:43 +01:00
parent ce40a4f57d
commit d9b9c0d4e7
4 changed files with 58 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ struct tty_device;
#define INPUT_DEVICE_EVENT_QUEUE_SIZE 128
#define INPUT_DEVICE_MAX 4096
#define BLOCK_DEVICE_MAX 4096
#define FRAMEBUFFER_DEVICE_MAX 4096
#define BLOCK_DEVICE(dev) ((dev)->dev_type == DEV_TYPE_BLOCK ? &(dev)->blk : NULL)
@@ -80,6 +81,9 @@ struct framebuffer_device_ops {
struct block_device {
struct block_device_ops *b_ops;
unsigned int b_id;
unsigned int sector_size;
sectors_t capacity;
};
struct char_device {
@@ -161,6 +165,11 @@ struct driver {
struct driver_ops *drv_ops;
};
struct iovec {
void *io_buf;
size_t io_len;
};
extern kern_status_t device_init(void);
extern struct device *root_device(void);
extern struct device *misc_device(void);

View File

@@ -7,6 +7,7 @@
typedef uintptr_t phys_addr_t;
typedef uint64_t cycles_t;
typedef uint64_t sectors_t;
typedef unsigned int umode_t;