virtio: refactor to have a handler per queue.
* enable to iterate on available entries in one interrupt call. * negociate -> negotiate, (void *) -> (void* ), thanks axel and philippe! Change-Id: Ie2d290797abcbf4c0f3cb5bfff71d091bb800fa6
This commit is contained in:
@@ -53,9 +53,9 @@ typedef void* virtio_device;
|
||||
// queue cookie, issued by virtio bus manager
|
||||
typedef void* virtio_queue;
|
||||
// callback function for requests
|
||||
typedef void (*virtio_callback_func)(void* driverCookie, void *cookie);
|
||||
typedef void (*virtio_callback_func)(void* driverCookie, void* cookie);
|
||||
// callback function for interrupts
|
||||
typedef void (*virtio_intr_func)(void *cookie);
|
||||
typedef void (*virtio_intr_func)(void* cookie);
|
||||
|
||||
#define VIRTIO_DEVICE_MODULE_NAME "bus_managers/virtio/device/v1"
|
||||
|
||||
@@ -93,8 +93,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
driver_module_info info;
|
||||
|
||||
status_t (*negociate_features)(virtio_device cookie, uint32 supported,
|
||||
uint32* negociated, const char* (*get_feature_name)(uint32));
|
||||
status_t (*negotiate_features)(virtio_device cookie, uint32 supported,
|
||||
uint32* negotiated, const char* (*get_feature_name)(uint32));
|
||||
|
||||
status_t (*read_device_config)(virtio_device cookie, uint8 offset,
|
||||
void* buffer, size_t bufferSize);
|
||||
@@ -102,20 +102,22 @@ typedef struct {
|
||||
const void* buffer, size_t bufferSize);
|
||||
|
||||
status_t (*alloc_queues)(virtio_device cookie, size_t count,
|
||||
virtio_queue *queues);
|
||||
virtio_queue* queues);
|
||||
|
||||
status_t (*setup_interrupt)(virtio_device cookie,
|
||||
virtio_intr_func config_handler, void* driverCookie);
|
||||
|
||||
status_t (*queue_setup_interrupt)(virtio_queue queue,
|
||||
virtio_callback_func handler, void* cookie);
|
||||
|
||||
status_t (*queue_request)(virtio_queue queue,
|
||||
const physical_entry *readEntry,
|
||||
const physical_entry *writtenEntry, virtio_callback_func callback,
|
||||
void *callbackCookie);
|
||||
const physical_entry* readEntry,
|
||||
const physical_entry* writtenEntry, void* cookie);
|
||||
|
||||
status_t (*queue_request_v)(virtio_queue queue,
|
||||
const physical_entry* vector,
|
||||
size_t readVectorCount, size_t writtenVectorCount,
|
||||
virtio_callback_func callback, void *callbackCookie);
|
||||
void* cookie);
|
||||
|
||||
bool (*queue_is_full)(virtio_queue queue);
|
||||
|
||||
@@ -123,6 +125,8 @@ typedef struct {
|
||||
|
||||
uint16 (*queue_size)(virtio_queue queue);
|
||||
|
||||
void* (*queue_dequeue)(virtio_queue queue, uint16* _size);
|
||||
|
||||
} virtio_device_interface;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user