config_tools: add pio serial port bdf to config.h

Add bdf info of pio serial port to config.h.

Tracked-On: #8235
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao junjie.mao@intel.com
This commit is contained in:
Yuanyuan Zhao 2022-09-30 09:59:33 +08:00 committed by acrnsi-robot
parent f9e16db9e1
commit b16aae48d0
2 changed files with 35 additions and 20 deletions

View File

@ -205,32 +205,24 @@
<xsl:with-param name="key" select="'SERIAL_PIO_BASE'" />
<xsl:with-param name="value" select="$base" />
</xsl:call-template>
<xsl:if test="$bdf != ''">
<xsl:call-template name="boolean-by-key-value">
<xsl:with-param name="key" select="'SERIAL_PCI'" />
<xsl:with-param name="value" select="'y'" />
</xsl:call-template>
<xsl:variable name="serial_bdf" select="acrn:binary-bdf($bdf)" />
<xsl:call-template name="integer-by-key-value">
<xsl:with-param name="key" select="'SERIAL_PCI_BDF'" />
<xsl:with-param name="value" select="$serial_bdf" />
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:when test="($type = 'mmio') and ($bdf != '')">
<xsl:call-template name="boolean-by-key-value">
<xsl:with-param name="key" select="'SERIAL_PCI'" />
<xsl:with-param name="value" select="'y'" />
</xsl:call-template>
<xsl:variable name="bus" select="substring-before($bdf, ':')" />
<xsl:variable name="device" select="substring-before(substring-after($bdf, ':'), '.')" />
<xsl:variable name="function" select="substring-after($bdf, '.')" />
<xsl:variable name="serial_bdf">
<xsl:text>0b</xsl:text>
<xsl:call-template name="hex-to-bin">
<xsl:with-param name="s" select="$bus" />
<xsl:with-param name="width" select="4" />
</xsl:call-template>
<xsl:call-template name="hex-to-bin">
<xsl:with-param name="s" select="$device" />
<xsl:with-param name="width" select="1" />
</xsl:call-template>
<xsl:call-template name="hex-to-bin">
<xsl:with-param name="s" select="$function" />
<xsl:with-param name="width" select="3" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="serial_bdf" select="acrn:binary-bdf($bdf)" />
<xsl:call-template name="integer-by-key-value">
<xsl:with-param name="key" select="'SERIAL_PCI_BDF'" />
<xsl:with-param name="value" select="$serial_bdf" />

View File

@ -544,6 +544,29 @@
<func:result select="$unique_mapping" />
</func:function>
<func:function name="acrn:binary-bdf">
<xsl:param name="bdf" />
<xsl:variable name="bus" select="substring-before($bdf, ':')" />
<xsl:variable name="device" select="substring-before(substring-after($bdf, ':'), '.')" />
<xsl:variable name="function" select="substring-after($bdf, '.')" />
<xsl:variable name="serial_bdf">
<xsl:text>0b</xsl:text>
<xsl:call-template name="hex-to-bin">
<xsl:with-param name="s" select="$bus" />
<xsl:with-param name="width" select="4" />
</xsl:call-template>
<xsl:call-template name="hex-to-bin">
<xsl:with-param name="s" select="$device" />
<xsl:with-param name="width" select="1" />
</xsl:call-template>
<xsl:call-template name="hex-to-bin">
<xsl:with-param name="s" select="$function" />
<xsl:with-param name="width" select="3" />
</xsl:call-template>
</xsl:variable>
<func:result select="$serial_bdf" />
</func:function>
<func:function name="acrn:get-vbdf">
<xsl:param name="vmid" />
<xsl:param name="name" />