From 92ce6ef7c79da67ddbc12f43fa6e5bdbd4968fc8 Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Thu, 25 Jul 2013 22:13:45 +0900 Subject: [PATCH] virtio: apply new initialization of nfc driver Signed-off-by: munkyu.im --- hw/virtio/virtio-pci.c | 43 ++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.h | 15 ++++++++++++ tizen/src/hw/maru_virtio_nfc.c | 10 ++++---- tizen/src/hw/maru_virtio_nfc.h | 2 +- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index d9fd427ebf..29a8b9a6e1 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1794,6 +1794,48 @@ static TypeInfo virtio_sensor_pci_info = { .class_init = virtio_sensor_pci_class_init, }; +/* virtio NFC */ + +static int virtio_nfc_pci_init(VirtIOPCIProxy *vpci_dev) +{ + VirtIONFCPCI *dev = VIRTIO_NFC_PCI(vpci_dev); + DeviceState *vdev = DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + if (qdev_init(vdev) < 0) { + return -1; + } + return 0; +} + +static void virtio_nfc_pci_class_init(ObjectClass *klass, void *data) +{ + VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); + PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); + + k->init = virtio_nfc_pci_init; + pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_NFC; + pcidev_k->revision = VIRTIO_PCI_ABI_VERSION; + pcidev_k->class_id = PCI_CLASS_OTHERS; +} + +static void virtio_nfc_pci_instance_init(Object *obj) +{ + VirtIONFCPCI *dev = VIRTIO_NFC_PCI(obj); + object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_NFC); + object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); +} + +static TypeInfo virtio_nfc_pci_info = { + .name = TYPE_VIRTIO_NFC_PCI, + .parent = TYPE_VIRTIO_PCI, + .instance_size = sizeof(VirtIONFCPCI), + .instance_init = virtio_nfc_pci_instance_init, + .class_init = virtio_nfc_pci_class_init, +}; + + #endif /* virtio-pci-bus */ @@ -1859,6 +1901,7 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_touchscreen_pci_info); type_register_static(&virtio_gl_pci_info); type_register_static(&virtio_sensor_pci_info); + type_register_static(&virtio_nfc_pci_info); #endif } diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 6c5104abab..e9a6d7943a 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -44,6 +44,7 @@ #include "../tizen/src/hw/maru_virtio_touchscreen.h" #include "../tizen/src/hw/virtio-gl.h" #include "../tizen/src/hw/maru_virtio_sensor.h" +#include "../tizen/src/hw/maru_virtio_nfc.h" #endif typedef struct VirtIOPCIProxy VirtIOPCIProxy; @@ -63,6 +64,7 @@ typedef struct VirtIOESMPCI VirtIOESMPCI; typedef struct VirtIOHWKeyPCI VirtIOHWKeyPCI; typedef struct VirtIOKeyboardPCI VirtIOKeyboardPCI; typedef struct VirtIOSENSORPCI VirtIOSENSORPCI; +typedef struct VirtIONFCPCI VirtIONFCPCI; #endif /* virtio-pci-bus */ @@ -308,6 +310,19 @@ struct VirtIOSENSORPCI { VirtIOPCIProxy parent_obj; VirtIOSENSOR vdev; }; + +/* + * virtio-nfc-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_NFC_PCI "virtio-nfc-pci" +#define VIRTIO_NFC_PCI(obj) \ + OBJECT_CHECK(VirtIONFCPCI, (obj), TYPE_VIRTIO_NFC_PCI) + +struct VirtIONFCPCI { + VirtIOPCIProxy parent_obj; + VirtIONFC vdev; +}; + #endif /* Virtio ABI version, if we increment this, we break the guest driver. */ diff --git a/tizen/src/hw/maru_virtio_nfc.c b/tizen/src/hw/maru_virtio_nfc.c index 059877d127..9321e088d0 100755 --- a/tizen/src/hw/maru_virtio_nfc.c +++ b/tizen/src/hw/maru_virtio_nfc.c @@ -4,7 +4,7 @@ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved * * Contact: - * DaiYoung Kim + * Munkyu Im * YeongKyoon Lee * * This program is free software; you can redistribute it and/or @@ -85,13 +85,13 @@ static QTAILQ_HEAD(MsgInfoSendHead , MsgInfo) nfc_send_msg_queue = // -typedef struct EvdiBuf { +typedef struct NFCBuf { VirtQueueElement elem; - QTAILQ_ENTRY(EvdiBuf) next; -} EvdiBuf; + QTAILQ_ENTRY(NFCBuf) next; +} NFCBuf; -static QTAILQ_HEAD(EvdiMsgHead , EvdiBuf) nfc_in_queue = +static QTAILQ_HEAD(NFCMsgHead , NFCBuf) nfc_in_queue = QTAILQ_HEAD_INITIALIZER(nfc_in_queue); static int count = 0; diff --git a/tizen/src/hw/maru_virtio_nfc.h b/tizen/src/hw/maru_virtio_nfc.h index 5e784009c0..69eb2f8093 100755 --- a/tizen/src/hw/maru_virtio_nfc.h +++ b/tizen/src/hw/maru_virtio_nfc.h @@ -4,7 +4,7 @@ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved * * Contact: - * DaiYoung Kim + * Munkyu Im * YeongKyoon Lee * * This program is free software; you can redistribute it and/or -- 2.34.1