diff --git a/components/fs/fat/event.c b/components/fs/fat/event.c
index 3ffaff2c..3fbbfddc 100644
--- a/components/fs/fat/event.c
+++ b/components/fs/fat/event.c
@@ -28,20 +28,20 @@ blk_queue_handle_t *blk_queue_handle = &blk_queue_handle_memory;
fs_queue_t *fs_command_queue;
fs_queue_t *fs_completion_queue;
-blk_req_queue_t *blk_request;
-blk_resp_queue_t *blk_response;
+blk_req_queue_t *blk_req_queue;
+blk_resp_queue_t *blk_resp_queue;
// Config pointed to the SDDF_blk config
-blk_storage_info_t *blk_config;
+blk_storage_info_t *blk_storage_info;
uint64_t worker_thread_stack_one;
uint64_t worker_thread_stack_two;
uint64_t worker_thread_stack_three;
uint64_t worker_thread_stack_four;
-char *client_data_addr;
+char *fs_share;
-char *blk_data_region;
+char *blk_data;
// Flag for determine if there are blk_requests pushed by the file system
// It is used to determine whether to notify the blk device driver
@@ -124,7 +124,7 @@ _Static_assert(BLK_QUEUE_CAPACITY_CLI_FAT >= FAT_WORKER_THREAD_NUM,
void init(void) {
// Init the block device queue
// Have to make sure who initialize this SDDF queue
- blk_queue_init(blk_queue_handle, blk_request, blk_response, BLK_QUEUE_CAPACITY_CLI_FAT);
+ blk_queue_init(blk_queue_handle, blk_req_queue, blk_resp_queue, BLK_QUEUE_CAPACITY_CLI_FAT);
/*
This part of the code is for setting up the thread pool by
assign stacks and size of the stack to the pool
diff --git a/components/fs/fat/io.c b/components/fs/fat/io.c
index 77f62510..9b474218 100644
--- a/components/fs/fat/io.c
+++ b/components/fs/fat/io.c
@@ -22,9 +22,9 @@ extern bool blk_request_pushed;
// This is the offset of the data buffer shared between file system and blk device driver
extern uint64_t fs_metadata;
-extern blk_storage_info_t *blk_config;
+extern blk_storage_info_t *blk_storage_info;
-extern char *blk_data_region;
+extern char *blk_data;
/*
* This def restrict the maximum cluster size that the fatfs can have
@@ -54,32 +54,32 @@ DSTATUS disk_initialize (
}
// Check whether the block device is ready or not
- if (!blk_config->ready) {
+ if (!blk_storage_is_ready(blk_storage_info)) {
return RES_NOTRDY;
}
// The sector size should be a mutiple of 512, BLK_TRANSFER_SIZE % SECTOR_SIZE should be 0
// BLK_TRANSFER_SIZE % SECTOR_SIZE should be a power of 2
- assert(blk_config->sector_size % 512 == 0 && "Sector size must be a multiple of 512");
- assert(blk_config->sector_size <= BLK_TRANSFER_SIZE && "BLK_TRANSFER_SIZE must be the same or larger than sector size");
- assert(IS_POWER_OF_2(BLK_TRANSFER_SIZE / blk_config->sector_size) && "BLK_TRANSFER_SIZE / SECTOR_SIZE must be a power of 2");
+ assert(blk_storage_info->sector_size % 512 == 0 && "Sector size must be a multiple of 512");
+ assert(blk_storage_info->sector_size <= BLK_TRANSFER_SIZE && "BLK_TRANSFER_SIZE must be the same or larger than sector size");
+ assert(IS_POWER_OF_2(BLK_TRANSFER_SIZE / blk_storage_info->sector_size) && "BLK_TRANSFER_SIZE / SECTOR_SIZE must be a power of 2");
LOG_FATFS("Block Storage Information:\n");
LOG_FATFS("--------------------------\n");
- LOG_FATFS("Serial Number: %s\n", blk_config->serial_number);
- LOG_FATFS("Read-Only: %s\n", blk_config->read_only ? "Yes" : "No");
- LOG_FATFS("Ready: %s\n", blk_config->ready ? "Yes" : "No");
- LOG_FATFS("Sector Size: %u bytes\n", blk_config->sector_size);
+ LOG_FATFS("Serial Number: %s\n", blk_storage_info->serial_number);
+ LOG_FATFS("Read-Only: %s\n", blk_storage_info->read_only ? "Yes" : "No");
+ LOG_FATFS("Ready: %s\n", blk_storage_info->ready ? "Yes" : "No");
+ LOG_FATFS("Sector Size: %u bytes\n", blk_storage_info->sector_size);
LOG_FATFS("Optimal Block Size: %u units (%u bytes)\n",
- blk_config->block_size, blk_config->block_size * BLK_TRANSFER_SIZE);
- LOG_FATFS("Queue Depth: %u\n", blk_config->queue_depth);
+ blk_storage_info->block_size, blk_storage_info->block_size * BLK_TRANSFER_SIZE);
+ LOG_FATFS("Queue Depth: %u\n", blk_storage_info->queue_depth);
LOG_FATFS("Geometry:\n");
- LOG_FATFS(" Cylinders: %u\n", blk_config->cylinders);
- LOG_FATFS(" Heads: %u\n", blk_config->heads);
- LOG_FATFS(" Blocks: %u\n", blk_config->blocks);
+ LOG_FATFS(" Cylinders: %u\n", blk_storage_info->cylinders);
+ LOG_FATFS(" Heads: %u\n", blk_storage_info->heads);
+ LOG_FATFS(" Blocks: %u\n", blk_storage_info->blocks);
LOG_FATFS("Total Capacity: %llu units (%llu bytes)\n",
- (unsigned long long)blk_config->capacity,
- (unsigned long long)(blk_config->capacity * BLK_TRANSFER_SIZE));
+ (unsigned long long)blk_storage_info->capacity,
+ (unsigned long long)(blk_storage_info->capacity * BLK_TRANSFER_SIZE));
LOG_FATFS("--------------------------\n");
return RES_OK;
}
@@ -95,7 +95,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff) {
DRESULT res;
if (cmd == GET_SECTOR_SIZE) {
WORD *size = buff;
- *size = blk_config->sector_size;
+ *size = blk_storage_info->sector_size;
res = RES_OK;
}
if (cmd == CTRL_SYNC) {
@@ -120,7 +120,7 @@ DRESULT disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count) {
// Accroding the protocol, all the read/write addr passed to the blk_virt should be page aligned
// Substract the handle with one as the worker thread ID starts at 1, not 0
uint64_t read_data_offset = thread_blk_addr[handle - 1];
- uint16_t sector_size = blk_config->sector_size;
+ uint16_t sector_size = blk_storage_info->sector_size;
// This is the same as BLK_TRANSFER_SIZE / sector_size
uint16_t sector_per_transfer = DIV_POWER_OF_2(BLK_TRANSFER_SIZE, sector_size);
uint32_t sddf_sector = DIV_POWER_OF_2(sector, sector_per_transfer);
@@ -150,7 +150,7 @@ DRESULT disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count) {
wait_for_blk_resp();
res = (DRESULT)(uintptr_t)microkit_cothread_my_arg();
- memcpy(buff, blk_data_region + read_data_offset + sector_size * MOD_POWER_OF_2(sector, sector_per_transfer), sector_size * count);
+ memcpy(buff, blk_data + read_data_offset + sector_size * MOD_POWER_OF_2(sector, sector_per_transfer), sector_size * count);
return res;
}
@@ -159,11 +159,11 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count) {
int handle = microkit_cothread_my_handle();
// Substract the handle with one as the worker thread ID starts at 1, not 0
uint64_t write_data_offset = thread_blk_addr[handle - 1];
- uint16_t sector_size = blk_config->sector_size;
+ uint16_t sector_size = blk_storage_info->sector_size;
if (sector_size == BLK_TRANSFER_SIZE) {
assert(MUL_POWER_OF_2(count, BLK_TRANSFER_SIZE) <= MAX_CLUSTER_SIZE);
- memcpy(blk_data_region + write_data_offset, buff, sector_size * count);
+ memcpy(blk_data + write_data_offset, buff, sector_size * count);
int err = blk_enqueue_req(blk_queue_handle, BLK_REQ_WRITE, write_data_offset, sector, count,handle);
assert(!err);
}
@@ -190,7 +190,7 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count) {
// When there is no unaligned sector, we do not need to send a read request
if (unaligned_head_sector == 0 && unaligned_tail_sector == 0) {
- memcpy(blk_data_region + write_data_offset, buff, sector_size * count);
+ memcpy(blk_data + write_data_offset, buff, sector_size * count);
int err = blk_enqueue_req(blk_queue_handle, BLK_REQ_WRITE, write_data_offset, sddf_sector, sddf_count,handle);
assert(!err);
}
@@ -204,7 +204,7 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count) {
if (res != RES_OK) {
return res;
}
- memcpy(blk_data_region + write_data_offset + sector_size * MOD_POWER_OF_2(sector, sector_per_transfer), buff, sector_size * count);
+ memcpy(blk_data + write_data_offset + sector_size * MOD_POWER_OF_2(sector, sector_per_transfer), buff, sector_size * count);
err = blk_enqueue_req(blk_queue_handle, BLK_REQ_WRITE, write_data_offset, sddf_sector, sddf_count,handle);
assert(!err);
}
diff --git a/components/fs/fat/op.c b/components/fs/fat/op.c
index 05b56420..a205bba9 100644
--- a/components/fs/fat/op.c
+++ b/components/fs/fat/op.c
@@ -30,8 +30,8 @@ FIL files[FAT_MAX_OPENED_FILENUM];
descriptor_status dir_status[FAT_MAX_OPENED_DIRNUM];
DIR dirs[FAT_MAX_OPENED_DIRNUM];
-// Data buffer offset
-extern char *client_data_addr;
+/* Data shared with client */
+extern char *fs_share;
// Sanity check functions
// Checking if the memory region that provided by request is within valid memory region
@@ -69,7 +69,7 @@ static FRESULT validate_and_copy_path(uint64_t path, uint64_t len, char* memory)
return FR_INVALID_PARAMETER;
}
// Copy the string to our private memory
- memcpy(memory, client_data_addr + path, len);
+ memcpy(memory, fs_share + path, len);
// Return error if the string is not NULL terminated
memory[len] = '\0';
@@ -227,7 +227,7 @@ void handle_file_write(void) {
args->status = FS_STATUS_INVALID_FD;
return;
}
- void* data = client_data_addr + buffer;
+ void* data = fs_share + buffer;
FIL* file = &(files[fd]);
@@ -275,7 +275,7 @@ void handle_file_read(void) {
return;
}
- void* data = client_data_addr + buffer;
+ void* data = fs_share + buffer;
// Maybe add validation check of file descriptor here
FIL* file = &(files[fd]);
@@ -349,7 +349,7 @@ void handle_stat(void) {
return;
}
- fs_stat_t* file_stat = (fs_stat_t *)(client_data_addr + output_buffer);
+ fs_stat_t* file_stat = (fs_stat_t *)(fs_share + output_buffer);
LOG_FATFS("fat_stat:asking for filename: %s\n", filepath);
@@ -584,7 +584,7 @@ void handle_dir_read(void) {
return;
}
- void* name = client_data_addr + buffer;
+ void* name = fs_share + buffer;
FILINFO fno;
RET = f_readdir(&dirs[fd], &fno);
diff --git a/examples/fileio/Makefile b/examples/fileio/Makefile
index ab1b8041..53cb4a0d 100644
--- a/examples/fileio/Makefile
+++ b/examples/fileio/Makefile
@@ -35,7 +35,6 @@ ${BUILD_DIR}/Makefile: fileio.mk
cp fileio.mk $@
submodules:
- git submodule update --init $(LIONSOS)/dep/libvmm
git submodule update --init $(LIONSOS)/dep/libnfs
git submodule update --init $(LIONSOS)/dep/micropython
git submodule update --init $(LIONSOS)/dep/musllibc
diff --git a/examples/fileio/board/maaxboard/fileio.system b/examples/fileio/board/maaxboard/fileio.system
index 98a3fb8f..2dfdf2ba 100644
--- a/examples/fileio/board/maaxboard/fileio.system
+++ b/examples/fileio/board/maaxboard/fileio.system
@@ -180,7 +180,7 @@
-
+
@@ -205,7 +205,7 @@
-
+
@@ -218,13 +218,13 @@
-
+
-
-
-
+
+
+
-
+
diff --git a/examples/fileio/board/qemu_virt_aarch64/fileio.system b/examples/fileio/board/qemu_virt_aarch64/fileio.system
index a8157ce2..a11f0df2 100644
--- a/examples/fileio/board/qemu_virt_aarch64/fileio.system
+++ b/examples/fileio/board/qemu_virt_aarch64/fileio.system
@@ -177,7 +177,7 @@
-
+
@@ -201,13 +201,13 @@
-
+
-
+
@@ -220,13 +220,13 @@
-
+
-
-
-
+
+
+
-
+
diff --git a/examples/fileio/fileio.mk b/examples/fileio/fileio.mk
index bca90517..f99046c4 100644
--- a/examples/fileio/fileio.mk
+++ b/examples/fileio/fileio.mk
@@ -49,13 +49,6 @@ DTC := dtc
BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)
PLATFORM := meson
SDDF := $(LIONSOS)/dep/sddf
-LIBVMM_DIR := $(LIONSOS)/dep/libvmm
-
-VMM_IMAGE_DIR := ${FILEIO_DIR}/src/vmm/images
-LINUX := 90c4247bcd24cbca1a3db4b7489a835ce87a486e-linux
-INITRD := 08c10529dc2806559d5c4b7175686a8206e10494-rootfs.cpio.gz
-DTS := $(VMM_IMAGE_DIR)/linux.dts
-DTB := linux.dtb
LWIP := $(SDDF)/network/ipstacks/lwip/src
FAT := $(LIONSOS)/components/fs/fat
@@ -98,7 +91,6 @@ BLK_DRIVER := $(SDDF)/drivers/blk/${BLK_DRIV_DIR}
BLK_COMPONENTS := $(SDDF)/blk/components
include ${SDDF}/util/util.mk
-include ${LIBVMM_DIR}/vmm.mk
include ${SDDF}/drivers/timer/${TIMER_DRIV_DIR}/timer_driver.mk
include ${SDDF}/drivers/network/${NET_DRIV_DIR}/eth_driver.mk
include ${SDDF}/drivers/serial/${UART_DRIV_DIR}/uart_driver.mk