Files
acrn-hypervisor/misc/config_tools/schema/checks/vuart_config.xsd
Chenli Wei ddefcccb26 misc: add processing for Console vUART is None
The current code assume there was one Console vUART all the time, and
there is an issue when the Console vUART is None.

This patch add the case of "None" and add assert to check no serial
console config.

Tracked-On: #6690
Signed-off-by: Chenli Wei chenli.wei@intel.com
2022-06-29 13:53:42 +08:00

53 lines
2.8 KiB
XML

<?xml version="1.0"?>
<!-- Copyright (C) 2022 Intel Corporation. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<xs:schema xml:id="root"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:acrn="https://projectacrn.org">
<xs:assert test="every $vuart_connection in /acrn-config//vuart_connection satisfies
every $vm_name in $vuart_connection/endpoint/vm_name/text() satisfies
count($vuart_connection/endpoint[./vm_name/text()=$vm_name]) = 1">
<xs:annotation acrn:severity="error" acrn:report-on="$vuart_connection/endpoint">
<xs:documentation>The vUART configuration of VM "{$vm_name}" may not connect to itself.</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $io_port in /acrn-config//endpoint/io_port satisfies
count(//endpoint[./vm_name=$io_port/ancestor::endpoint/vm_name and io_port=$io_port]) = 1">
<xs:annotation acrn:severity="error" acrn:report-on="$io_port">
<xs:documentation>VM "{$io_port/ancestor::endpoint/vm_name}" may not duplicate use of port "{$io_port}."</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $console_port in /acrn-config//console_vuart satisfies
if ($console_port = 'COM Port 1')
then count(//endpoint[./vm_name=$console_port/ancestor::vm/name and io_port='0x3F8']) &lt; 1
else if ($console_port = 'COM Port 2')
then count(//endpoint[./vm_name=$console_port/ancestor::vm/name and io_port='0x2F8']) &lt; 1
else if ($console_port = 'COM Port 3')
then count(//endpoint[./vm_name=$console_port/ancestor::vm/name and io_port='0x3E8']) &lt; 1
else if ($console_port = 'COM Port 4')
then count(//endpoint[./vm_name=$console_port/ancestor::vm/name and io_port='0x2E8']) &lt; 1
else true()">
<xs:annotation acrn:severity="error" acrn:report-on="$console_port">
<xs:documentation>VM "{$console_port/ancestor::vm/name}" may not duplicate use of console "{$console_port}."</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $NAME in /acrn-config//vuart_connection//endpoint//vm_name satisfies
not(/acrn-config//vuart_connection//endpoint//vm_name = '')">
<xs:annotation acrn:severity="error" acrn:report-on="$NAME">
<xs:documentation>VM name in "{$NAME/ancestor::vuart_connection/name}" must be set </xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="not (//BUILD_TYPE = 'debug' and //SERIAL_CONSOLE = 'None')">
<xs:annotation acrn:severity="error" acrn:report-on="//BUILD_TYPE">
<xs:documentation>You can't use debug Build type when there is no serial console config</xs:documentation>
</xs:annotation>
</xs:assert>
</xs:schema>