mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-08 12:19:06 +00:00
HV: vuart: move the vuart code to dm directory
As there is a requirement for conmunication between VMs on uart port, but for Pre-launched VM, the only way is to create vuart for each VM and connect them at hypervisor side. So, the vuart code should be moved from /debug to /dm so that they can also be used in release version. For the console related code, as no need to support in release version, so leave them at debug directory. Tracked-On: #2987 Signed-off-by: Conghui Chen <conghui.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
00ebe8630f
commit
513c9f8744
93
hypervisor/include/dm/vuart.h
Normal file
93
hypervisor/include/dm/vuart.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*-
|
||||
* Copyright (c) 2013 Neel Natu <neel@freebsd.org>
|
||||
* Copyright (c) 2018 Intel Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef VUART_H
|
||||
#define VUART_H
|
||||
#include <types.h>
|
||||
#include <spinlock.h>
|
||||
#include <vm_config.h>
|
||||
|
||||
#define RX_BUF_SIZE 256U
|
||||
#define TX_BUF_SIZE 8192U
|
||||
#define INVAILD_VUART_IDX 0xFFU
|
||||
|
||||
#define COM1_BASE 0x3F8U
|
||||
#define COM2_BASE 0x2F8U
|
||||
#define COM3_BASE 0x3E8U
|
||||
#define COM4_BASE 0x2E8U
|
||||
#define INVALID_COM_BASE 0U
|
||||
|
||||
#define COM1_IRQ 4U
|
||||
#define COM2_IRQ 3U
|
||||
#define COM3_IRQ 6U
|
||||
#define COM4_IRQ 7U
|
||||
|
||||
struct fifo {
|
||||
char *buf;
|
||||
uint32_t rindex; /* index to read from */
|
||||
uint32_t windex; /* index to write to */
|
||||
uint32_t num; /* number of characters in the fifo */
|
||||
uint32_t size; /* size of the fifo */
|
||||
};
|
||||
|
||||
struct acrn_vuart {
|
||||
uint8_t data; /* Data register (R/W) */
|
||||
uint8_t ier; /* Interrupt enable register (R/W) */
|
||||
uint8_t lcr; /* Line control register (R/W) */
|
||||
uint8_t mcr; /* Modem control register (R/W) */
|
||||
uint8_t lsr; /* Line status register (R/W) */
|
||||
uint8_t msr; /* Modem status register (R/W) */
|
||||
uint8_t fcr; /* FIFO control register (W) */
|
||||
uint8_t scr; /* Scratch register (R/W) */
|
||||
uint8_t dll; /* Baudrate divisor latch LSB */
|
||||
uint8_t dlh; /* Baudrate divisor latch MSB */
|
||||
|
||||
struct fifo rxfifo;
|
||||
struct fifo txfifo;
|
||||
uint16_t port_base;
|
||||
uint32_t irq;
|
||||
char vuart_rx_buf[RX_BUF_SIZE];
|
||||
char vuart_tx_buf[TX_BUF_SIZE];
|
||||
bool thre_int_pending; /* THRE interrupt pending */
|
||||
bool active;
|
||||
struct acrn_vuart *target_vu; /* Pointer to target vuart */
|
||||
struct acrn_vm *vm;
|
||||
spinlock_t lock; /* protects all softc elements */
|
||||
};
|
||||
|
||||
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
|
||||
void vuart_init(struct acrn_vm *vm, struct vuart_config *vu_config);
|
||||
void vuart_deinit(struct acrn_vm *vm);
|
||||
struct acrn_vuart *vuart_console_active(void);
|
||||
void vuart_console_tx_chars(struct acrn_vuart *vu);
|
||||
void vuart_console_rx_chars(struct acrn_vuart *vu);
|
||||
|
||||
bool is_vuart_intx(struct acrn_vm *vm, uint32_t intx_pin);
|
||||
void vuart_set_property(const char *vuart_info);
|
||||
#endif /* VUART_H */
|
Reference in New Issue
Block a user