mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 16:59:28 +08:00
vitrio-pci.c: add virtio-pci transport support for Nuttx
1. only support pci modern device; 2. need the pci controller support MSI/MSI-X; It has been verified based on virtio-rng and virtio-net. Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com> Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
#include <nuttx/pci/pci_qemu_test.h>
|
#include <nuttx/pci/pci_qemu_test.h>
|
||||||
#include <nuttx/rptun/rptun_ivshmem.h>
|
#include <nuttx/rptun/rptun_ivshmem.h>
|
||||||
#include <nuttx/rpmsg/rpmsg_virtio_ivshmem.h>
|
#include <nuttx/rpmsg/rpmsg_virtio_ivshmem.h>
|
||||||
|
#include <nuttx/virtio/virtio-pci.h>
|
||||||
|
|
||||||
#include "pci_drivers.h"
|
#include "pci_drivers.h"
|
||||||
|
|
||||||
@@ -103,6 +104,16 @@ int pci_register_drivers(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialization virtio pci driver */
|
||||||
|
|
||||||
|
#ifdef CONFIG_DRIVERS_VIRTIO_PCI
|
||||||
|
ret = register_virtio_pci_driver();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
pcierr("register_virtio_pci_driver failed, ret=%d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
UNUSED(ret);
|
UNUSED(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ if(CONFIG_DRIVERS_VIRTIO_MMIO)
|
|||||||
list(APPEND SRCS virtio-mmio.c)
|
list(APPEND SRCS virtio-mmio.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_DRIVERS_VIRTIO_PCI)
|
||||||
|
list(APPEND SRCS virtio-pci.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_DRIVERS_VIRTIO_BLK)
|
if(CONFIG_DRIVERS_VIRTIO_BLK)
|
||||||
list(APPEND SRCS virtio-blk.c)
|
list(APPEND SRCS virtio-blk.c)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ config DRIVERS_VIRTIO_MMIO_QUEUE_LEN
|
|||||||
If this value equals to 0, use the max queue length get from
|
If this value equals to 0, use the max queue length get from
|
||||||
mmio register.
|
mmio register.
|
||||||
|
|
||||||
|
config DRIVERS_VIRTIO_PCI
|
||||||
|
bool "Virtio PCI Device Support"
|
||||||
|
default n
|
||||||
|
|
||||||
config DRIVERS_VIRTIO_BLK
|
config DRIVERS_VIRTIO_BLK
|
||||||
bool "Virtio block support"
|
bool "Virtio block support"
|
||||||
depends on !DISABLE_MOUNTPOINT
|
depends on !DISABLE_MOUNTPOINT
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ ifeq ($(CONFIG_DRIVERS_VIRTIO_MMIO),y)
|
|||||||
CSRCS += virtio-mmio.c
|
CSRCS += virtio-mmio.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DRIVERS_VIRTIO_PCI),y)
|
||||||
|
CSRCS += virtio-pci.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DRIVERS_VIRTIO_BLK),y)
|
ifeq ($(CONFIG_DRIVERS_VIRTIO_BLK),y)
|
||||||
CSRCS += virtio-blk.c
|
CSRCS += virtio-blk.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/virtio/virtio-pci.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __INCLUDE_NUTTX_VIRTIO_VIRTIO_PCI_H
|
||||||
|
#define __INCLUDE_NUTTX_VIRTIO_VIRTIO_PCI_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DRIVERS_VIRTIO_PCI
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Type Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: register_virtio_pci_driver
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int register_virtio_pci_driver(void);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_DRIVERS_VIRTIO_PCI */
|
||||||
|
#endif /* __INCLUDE_NUTTX_VIRTIO_VIRTIO_PCI_H */
|
||||||
Reference in New Issue
Block a user