3 * This file is part of the Palacios Virtual Machine Monitor developed
4 * by the V3VEE Project with funding from the United States National
5 * Science Foundation and the Department of Energy.
7 * The V3VEE Project is a joint project between Northwestern University
8 * and the University of New Mexico. You can find out more at
11 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
12 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
13 * All rights reserved.
15 * Author: Jack Lange <jarusl@cs.northwestern.edu>
17 * This is free software. You are permitted to use,
18 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #ifndef __DEVICES_BLOCK_DEV_H__
22 #define __DEVICES_BLOCK_DEV_H__
28 #define ATAPI_BLOCK_SIZE 2048
29 #define HD_SECTOR_SIZE 512
33 uint64_t (*get_capacity)(void * private_data);
34 // Reads always operate on 2048 byte blocks
35 int (*read)(uint8_t * buf, int sector_count, uint64_t lba, void * private_data);
36 int (*write)(uint8_t * buf, int sector_count, uint64_t lba, void * private_data);
42 uint32_t (*get_capacity)(void * private_data);
43 // Reads always operate on 2048 byte blocks
44 int (*read)(uint8_t * buf, int block_count, uint64_t lba, void * private_data);
48 typedef enum {BLOCK_NONE, BLOCK_DISK, BLOCK_CDROM} v3_block_type_t;
52 static const char * block_dev_type_strs[] = {"NONE", "HARDDISK", "CDROM" };
54 static inline const char * v3_block_type_to_str(v3_block_type_t type) {
55 if (type > BLOCK_CDROM) {
58 return block_dev_type_strs[type];