-#ifndef DEBUG_IDE
+#ifndef CONFIG_DEBUG_IDE
#undef PrintDebug
#define PrintDebug(fmt, args...)
#endif
static int hd_read(uint8_t * buf, int sector_count, uint64_t lba, void * private_data) {
struct vm_device * hd_dev = (struct vm_device *)private_data;
struct hd_state * hd = (struct hd_state *)(hd_dev->private_data);
- int offset = lba * IDE_SECTOR_SIZE;
- int length = sector_count * IDE_SECTOR_SIZE;
+ int offset = lba * HD_SECTOR_SIZE;
+ int length = sector_count * HD_SECTOR_SIZE;
// PrintDebug("Reading RAM HD at (LBA=%d) offset %d (length=%d)\n", (uint32_t)lba, offset, length);
static int hd_write(uint8_t * buf, int sector_count, uint64_t lba, void * private_data) {
struct vm_device * hd_dev = (struct vm_device *)private_data;
struct hd_state * hd = (struct hd_state *)(hd_dev->private_data);
- int offset = lba * IDE_SECTOR_SIZE;
- int length = sector_count * IDE_SECTOR_SIZE;
+ int offset = lba * HD_SECTOR_SIZE;
+ int length = sector_count * HD_SECTOR_SIZE;
memcpy((uint8_t *)(hd->disk_image + offset), buf, length);
struct vm_device * hd_dev = (struct vm_device *)private_data;
struct hd_state * hd = (struct hd_state *)(hd_dev->private_data);
PrintDebug("Querying RAM HD capacity (bytes=%d) (ret = %d)\n",
- hd->capacity, hd->capacity / IDE_SECTOR_SIZE);
- return hd->capacity / IDE_SECTOR_SIZE;
+ hd->capacity, hd->capacity / HD_SECTOR_SIZE);
+ return hd->capacity / HD_SECTOR_SIZE;
}
-static struct v3_ide_hd_ops hd_ops = {
+static struct v3_hd_ops hd_ops = {
.read = hd_read,
.write = hd_write,
.get_capacity = hd_get_capacity,
struct hd_state * hd = NULL;
struct ram_hd_cfg * cfg = (struct ram_hd_cfg *)cfg_data;
- if (cfg->size % IDE_SECTOR_SIZE) {
- PrintError("HD image must be an integral of sector size (IDE_SECTOR_SIZE=%d)\n", IDE_SECTOR_SIZE);
+ if (cfg->size % HD_SECTOR_SIZE) {
+ PrintError("HD image must be an integral of sector size (HD_SECTOR_SIZE=%d)\n", HD_SECTOR_SIZE);
return -1;
}