1<?xml version='1.0' encoding='utf-8'?> 2 3<!-- Copyright (C) 2021-2022 Intel Corporation. --> 4<!-- SPDX-License-Identifier: BSD-3-Clause --> 5 6<xsl:stylesheet 7 version="1.0" 8 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 9 xmlns:dyn="http://exslt.org/dynamic" 10 xmlns:math="http://exslt.org/math" 11 xmlns:func="http://exslt.org/functions" 12 xmlns:str="http://exslt.org/strings" 13 xmlns:set="http://exslt.org/sets" 14 xmlns:exslt="http://exslt.org/common" 15 xmlns:acrn="http://projectacrn.org" 16 extension-element-prefixes="func"> 17 18 <xsl:variable name="digits" select="'0123456789abcdef'" /> 19 <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" /> 20 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> 21 22 <!-- C code common variables --> 23 <xsl:variable name="newline" select="'
'" /> 24 <xsl:variable name="tab" select="'	'" /> 25 <xsl:variable name="whitespaces" select="concat(' ', '
', $tab, $newline)" /> 26 <xsl:variable name="quot" select="'"'" /> 27 <xsl:variable name="end_of_initializer" select="concat(',', $newline)" /> 28 <xsl:variable name="end_of_array_initializer" select="concat('};', $newline)" /> 29 <xsl:variable name="else" select="concat('#else', $newline)" /> 30 <xsl:variable name="endif" select="concat('#endif', $newline)" /> 31 <xsl:variable name="license"> 32 <xsl:text>/*
</xsl:text> 33 <xsl:text> * Copyright (C) YEAR Intel Corporation.
</xsl:text> 34 <xsl:text> *
</xsl:text> 35 <xsl:text> * SPDX-License-Identifier: BSD-3-Clause
</xsl:text> 36 <xsl:text> */
</xsl:text> 37 <xsl:text>
</xsl:text> 38 </xsl:variable> 39 <!-- End of C code variables --> 40 41 <!-- Generic library auxiliaries--> 42 <!-- < Do not call auxiliaries directly externally and internally >--> 43 <!-- < Please call auxiliaries wrappers instead >--> 44 <func:function name="acrn:string-to-num-aux"> 45 <xsl:param name="v" /> 46 <xsl:param name="base" /> 47 <xsl:param name="acc" /> 48 <xsl:variable name="digit" select="string-length(substring-before($digits, translate(substring($v, 1, 1), $uppercase, $lowercase)))" /> 49 <xsl:choose> 50 <xsl:when test="string-length($v) = 1"> 51 <func:result select="($acc * $base) + $digit" /> 52 </xsl:when> 53 <xsl:otherwise> 54 <func:result select="acrn:string-to-num-aux(substring($v, 2), $base, ($acc * $base) + $digit)" /> 55 </xsl:otherwise> 56 </xsl:choose> 57 </func:function> 58 59 <func:function name="acrn:num-to-string-aux"> 60 <xsl:param name="v" /> 61 <xsl:param name="base" /> 62 <xsl:param name="acc" /> 63 <xsl:variable name="digit" select="substring($digits, ($v mod $base) + 1 , 1)" /> 64 <xsl:choose> 65 <xsl:when test="floor($v div $base) = 0"> 66 <func:result select="concat($digit, $acc)" /> 67 </xsl:when> 68 <xsl:otherwise> 69 <func:result select="acrn:num-to-string-aux(floor($v div $base), $base, concat($digit, $acc))" /> 70 </xsl:otherwise> 71 </xsl:choose> 72 </func:function> 73 <!-- End of generic library auxiliaries--> 74 75 <!-- Generic library routines--> 76 <func:function name="acrn:string-to-num"> 77 <xsl:param name="v" /> 78 <xsl:param name="base" /> 79 <func:result select="acrn:string-to-num-aux($v, $base, 0)" /> 80 </func:function> 81 82 <func:function name="acrn:num-to-string"> 83 <xsl:param name="v" /> 84 <xsl:param name="base" /> 85 <func:result select="acrn:num-to-string-aux($v, $base, '')" /> 86 </func:function> 87 88 <func:function name="acrn:convert-num-base"> 89 <xsl:param name="v" /> 90 <xsl:param name="base" /> 91 <xsl:param name="newbase" /> 92 <xsl:param name="num" select="acrn:string-to-num($v, $base)" /> 93 <func:result select="acrn:num-to-string($num, $newbase)" /> 94 </func:function> 95 96 <func:function name="acrn:repeat"> 97 <xsl:param name="string" /> 98 <xsl:param name="times" /> 99 <func:result> 100 <xsl:if test="$times > 0"> 101 <xsl:value-of select="$string" /> 102 <xsl:value-of select="acrn:repeat($string, $times - 1)" /> 103 </xsl:if> 104 </func:result> 105 </func:function> 106 107 <func:function name="acrn:vm_fill"> 108 109 <xsl:param name="cur"/> 110 <xsl:param name="end"/> 111 112 <func:result> 113 <xsl:text>,</xsl:text> 114 <xsl:value-of select="$newline"/> 115 <xsl:text>{</xsl:text> 116 <xsl:value-of select="acrn:comment(concat('Dynamic configured VM', $cur))"/> 117 <xsl:value-of select="$newline"/> 118 <xsl:text>CONFIG_POST_STD_VM,</xsl:text> 119 <xsl:value-of select="$newline"/> 120 <xsl:text>}</xsl:text> 121 <xsl:value-of select="$newline"/> 122 123 <xsl:if test="not($cur + 1 = $end)"> 124 <xsl:value-of select="acrn:vm_fill($cur + 1, $end)"/> 125 </xsl:if> 126 </func:result> 127 </func:function> 128 129 <func:function name="acrn:min"> 130 <xsl:param name="a" /> 131 <xsl:param name="b" /> 132 <xsl:choose> 133 <xsl:when test="$a < $b"> 134 <func:result select="$a" /> 135 </xsl:when> 136 <xsl:otherwise> 137 <func:result select="$b" /> 138 </xsl:otherwise> 139 </xsl:choose> 140 </func:function> 141 142 <func:function name="acrn:max"> 143 <xsl:param name="a" /> 144 <xsl:param name="b" /> 145 <xsl:choose> 146 <xsl:when test="$a > $b"> 147 <func:result select="$a" /> 148 </xsl:when> 149 <xsl:otherwise> 150 <func:result select="$b" /> 151 </xsl:otherwise> 152 </xsl:choose> 153 </func:function> 154 155 <func:function name="acrn:find-list-min"> 156 <xsl:param name="list" /> 157 <xsl:param name="delimiter" /> 158 <func:result> 159 <xsl:value-of select="math:min(str:split($list, $delimiter))" /> 160 </func:result> 161 </func:function> 162 163 <func:function name="acrn:string-join"> 164 <xsl:param name="content" /> 165 <xsl:param name="delimiter" /> 166 <xsl:param name="prefix" /> 167 <xsl:param name="suffix" /> 168 <func:result> 169 <xsl:for-each select="$content"> 170 <xsl:value-of select="concat($prefix, current(), $suffix)" /> 171 <xsl:if test="position() != last()"> 172 <xsl:value-of select="$delimiter" /> 173 </xsl:if> 174 </xsl:for-each> 175 </func:result> 176 </func:function> 177 <!-- End of generic library routines--> 178 179 <!-- C code templates--> 180 <func:function name="acrn:initializer"> 181 <xsl:param name="member" /> 182 <xsl:param name="value" /> 183 <xsl:param name="not_end" /> 184 <func:result> 185 <xsl:text>.</xsl:text> 186 <xsl:value-of select="$member" /> 187 <xsl:text> = </xsl:text> 188 <xsl:value-of select="$value" /> 189 <xsl:choose> 190 <xsl:when test="$not_end"> 191 <xsl:value-of select="$newline" /> 192 </xsl:when> 193 <xsl:otherwise> 194 <xsl:value-of select="$end_of_initializer" /> 195 </xsl:otherwise> 196 </xsl:choose> 197 </func:result> 198 </func:function> 199 200 <func:function name="acrn:include"> 201 <xsl:param name="header" /> 202 <func:result> 203 <xsl:text>#include <</xsl:text> 204 <xsl:value-of select="$header" /> 205 <xsl:text>>
</xsl:text> 206 </func:result> 207 </func:function> 208 209 <func:function name="acrn:define"> 210 <xsl:param name="name" /> 211 <xsl:param name="value" /> 212 <xsl:param name="suffix" /> 213 <xsl:variable name="whitespace" select="30 - string-length($name)" /> 214 <xsl:variable name="times"> 215 <xsl:choose> 216 <xsl:when test="$whitespace > 0"> 217 <xsl:value-of select="$whitespace" /> 218 </xsl:when> 219 <xsl:otherwise> 220 <xsl:value-of select="'1'" /> 221 </xsl:otherwise> 222 </xsl:choose> 223 </xsl:variable> 224 <func:result> 225 <xsl:text>#define </xsl:text> 226 <xsl:value-of select="$name" /> 227 <xsl:value-of select="acrn:repeat(' ', $times)" /> 228 <xsl:value-of select="$value" /> 229 <xsl:value-of select="$suffix" /> 230 <xsl:text>
</xsl:text> 231 </func:result> 232 </func:function> 233 234 <func:function name="acrn:extern"> 235 <xsl:param name="type" /> 236 <xsl:param name="name" /> 237 <xsl:param name="size" /> 238 <func:result> 239 <xsl:text>extern </xsl:text> 240 <xsl:value-of select="$type" /> 241 <xsl:text> </xsl:text> 242 <xsl:value-of select="$name" /> 243 <xsl:text>[</xsl:text> 244 <xsl:value-of select="$size" /> 245 <xsl:text>];</xsl:text> 246 <xsl:text>
</xsl:text> 247 </func:result> 248 </func:function> 249 250 <func:function name="acrn:array-initializer"> 251 <xsl:param name="type" /> 252 <xsl:param name="name" /> 253 <xsl:param name="size" /> 254 <func:result> 255 <xsl:value-of select="$type" /> 256 <xsl:text> </xsl:text> 257 <xsl:value-of select="$name" /> 258 <xsl:text>[</xsl:text> 259 <xsl:value-of select="$size" /> 260 <xsl:text>] = {</xsl:text> 261 <xsl:text>
</xsl:text> 262 </func:result> 263 </func:function> 264 265 <func:function name="acrn:ifdef"> 266 <xsl:param name="config" /> 267 <func:result> 268 <xsl:text>#ifdef </xsl:text> 269 <xsl:value-of select="$config" /> 270 <xsl:text>
</xsl:text> 271 </func:result> 272 </func:function> 273 274 <func:function name="acrn:include-guard"> 275 <xsl:param name="name" /> 276 <func:result> 277 <xsl:text>#ifndef </xsl:text> 278 <xsl:value-of select="$name" /> 279 <xsl:text>
</xsl:text> 280 <xsl:text>#define </xsl:text> 281 <xsl:value-of select="$name" /> 282 <xsl:text>
</xsl:text> 283 <xsl:text>
</xsl:text> 284 </func:result> 285 </func:function> 286 287 <func:function name="acrn:include-guard-end"> 288 <xsl:param name="name" /> 289 <func:result> 290 <xsl:text>
</xsl:text> 291 <xsl:text>#endif </xsl:text> 292 <xsl:value-of select="concat('/* ', $name, ' */')" /> 293 <xsl:text>
</xsl:text> 294 </func:result> 295 </func:function> 296 297 <func:function name="acrn:comment"> 298 <xsl:param name="content" /> 299 <func:result> 300 <xsl:text>/* </xsl:text> 301 <xsl:value-of select="$content" /> 302 <xsl:text> */</xsl:text> 303 </func:result> 304 </func:function> 305 <!-- End of C code templates--> 306 307 <func:function name="acrn:shmem-index"> 308 <xsl:param name="v" /> 309 <xsl:variable name="idx"> 310 <xsl:for-each select="//hv//IVSHMEM/IVSHMEM_REGION[PROVIDED_BY = 'Hypervisor']"> 311 <xsl:if test="NAME = $v"> 312 <xsl:value-of select="position() - 1" /> 313 </xsl:if> 314 </xsl:for-each> 315 </xsl:variable> 316 <func:result select="$idx" /> 317 </func:function> 318 319 <func:function name="acrn:pci-dev-num"> 320 <xsl:param name="vmid" /> 321 <xsl:for-each select="//config-data/acrn-config/vm[@id = $vmid]"> 322 <xsl:variable name="vmtype" select="./load_order" /> 323 <xsl:variable name="ivshmem"> 324 <xsl:choose> 325 <xsl:when test="count(//hv//IVSHMEM/IVSHMEM_REGION[PROVIDED_BY = 'Hypervisor']) > 0"> 326 <xsl:variable name="vm_name" select="./name" /> 327 <xsl:value-of select="count(//hv//IVSHMEM/IVSHMEM_REGION[PROVIDED_BY = 'Hypervisor']/IVSHMEM_VMS/IVSHMEM_VM/VM_NAME[text() = $vm_name])" /> 328 </xsl:when> 329 <xsl:otherwise> 330 <xsl:value-of select="0" /> 331 </xsl:otherwise> 332 </xsl:choose> 333 </xsl:variable> 334 335 <xsl:variable name="console_vuart" select="count(./console_vuart/base[text() = 'PCI_VUART'])" /> 336 <xsl:variable name="vm_name" select="./name" /> 337 <xsl:variable name="communication_vuart"> 338 <xsl:value-of select="count(//vuart_connection[type = 'pci']/endpoint[vm_name/text() = $vm_name])" /> 339 </xsl:variable> 340 341 <xsl:variable name="pci_devs" select="count(./pci_devs/pci_dev[text() != ''])" /> 342 <xsl:variable name="pci_hostbridge" select="1" /> 343 <xsl:variable name="virtual_root_port"> 344 <xsl:choose> 345 <xsl:when test="./PTM = 'y'"> 346 <xsl:value-of select="1" /> 347 </xsl:when> 348 <xsl:otherwise> 349 <xsl:value-of select="0" /> 350 </xsl:otherwise> 351 </xsl:choose> 352 </xsl:variable> 353 <xsl:if test="acrn:is-pre-launched-vm($vmtype)"> 354 <xsl:if test="$ivshmem + $console_vuart + $communication_vuart + $pci_devs > 0"> 355 <func:result select="$ivshmem + $console_vuart + $communication_vuart + $pci_devs + $pci_hostbridge" /> 356 </xsl:if> 357 </xsl:if> 358 <xsl:if test="acrn:is-post-launched-vm($vmtype)"> 359 <func:result select="$ivshmem + $console_vuart + $communication_vuart + $virtual_root_port" /> 360 </xsl:if> 361 <xsl:if test="acrn:is-service-vm($vmtype)"> 362 <func:result select="$ivshmem + $console_vuart + $communication_vuart" /> 363 </xsl:if> 364 </xsl:for-each> 365 </func:function> 366 367 <!-- acrn:get-hidden-device-num checks if a board has hidden devices which cannot be explored by scanning pci configuration space --> 368 <func:function name="acrn:get-hidden-device-num"> 369 <xsl:choose> 370 <!-- apl-mrb hidden devices list: [00:0d:0] --> 371 <xsl:when test="//@board = 'apl-mrb'"> 372 <func:result select="1" /> 373 </xsl:when> 374 <!-- apl-up2 hidden devices list: [00:0d:0] --> 375 <xsl:when test="//@board = 'apl-up2'"> 376 <func:result select="1" /> 377 </xsl:when> 378 <xsl:when test="count(//HIDDEN_PDEV/text()) > 0"> 379 <func:result select="count(//HIDDEN_PDEV/text())" /> 380 </xsl:when> 381 <xsl:otherwise> 382 <func:result select="0" /> 383 </xsl:otherwise> 384 </xsl:choose> 385 </func:function> 386 387 <func:function name="acrn:is-rdt-enabled"> 388 <xsl:choose> 389 <xsl:when test="acrn:is-rdt-supported() and //RDT_ENABLED = 'y'"> 390 <func:result select="true()" /> 391 </xsl:when> 392 <xsl:otherwise> 393 <func:result select="false()" /> 394 </xsl:otherwise> 395 </xsl:choose> 396 </func:function> 397 398 <func:function name="acrn:is-cdp-enabled"> 399 <xsl:choose> 400 <xsl:when test="acrn:is-rdt-enabled() and //CDP_ENABLED = 'y'"> 401 <func:result select="true()" /> 402 </xsl:when> 403 <xsl:otherwise> 404 <func:result select="false()" /> 405 </xsl:otherwise> 406 </xsl:choose> 407 </func:function> 408 409 <func:function name="acrn:is-vcat-enabled"> 410 <xsl:choose> 411 <xsl:when test="acrn:is-rdt-enabled() and //VCAT_ENABLED = 'y'"> 412 <func:result select="true()" /> 413 </xsl:when> 414 <xsl:otherwise> 415 <func:result select="false()" /> 416 </xsl:otherwise> 417 </xsl:choose> 418 </func:function> 419 420 <func:function name="acrn:is-rdt-supported"> 421 <xsl:variable name="rdt_resource" select="acrn:get-normalized-closinfo-rdt-res-str()" /> 422 <xsl:variable name="rdt_res_clos_max" select="acrn:get-normalized-closinfo-rdt-clos-max-str()" /> 423 <xsl:choose> 424 <xsl:when test="$rdt_resource and $rdt_res_clos_max"> 425 <func:result select="true()" /> 426 </xsl:when> 427 <xsl:otherwise> 428 <func:result select="false()" /> 429 </xsl:otherwise> 430 </xsl:choose> 431 </func:function> 432 433 <func:function name="acrn:get-common-clos-count"> 434 <xsl:choose> 435 <xsl:when test="not(acrn:is-rdt-enabled()) and not(acrn:is-cdp-enabled())"> 436 <func:result select="0" /> 437 </xsl:when> 438 <xsl:otherwise> 439 <xsl:variable name="rdt_resource_list" select="str:split(acrn:get-normalized-closinfo-rdt-res-str(), ',')" /> 440 <xsl:variable name="rdt_res_clos_count_list" select="str:split(acrn:get-normalized-closinfo-rdt-clos-max-str(), ',')" /> 441 <xsl:variable name="cdp_enabled" select="acrn:is-cdp-enabled()"/> 442 443 <xsl:variable name="clos_count_list_rtf"> 444 <xsl:for-each select="$rdt_resource_list"> 445 <xsl:variable name="pos" select="position()" /> 446 <xsl:variable name="res_clos_count" select="number($rdt_res_clos_count_list[$pos])" /> 447 448 <xsl:choose> 449 <xsl:when test=". = 'MBA'"> 450 <node><xsl:value-of select="$res_clos_count"/></node> 451 </xsl:when> 452 <!-- Some platforms have odd clos counts. Use "floor" to avoid this function returning a float number. --> 453 <xsl:otherwise> 454 <node><xsl:value-of select="floor($res_clos_count div (1 + $cdp_enabled))"/></node> 455 </xsl:otherwise> 456 </xsl:choose> 457 </xsl:for-each> 458 </xsl:variable> 459 460 <xsl:variable name="clos_count_list_it" select="exslt:node-set($clos_count_list_rtf)/node" /> 461 <func:result select="math:min($clos_count_list_it)" /> 462 </xsl:otherwise> 463 </xsl:choose> 464 </func:function> 465 466 <func:function name="acrn:is-service-vm"> 467 <xsl:param name="load_order" /> 468 <func:result select="$load_order = 'SERVICE_VM'" /> 469 </func:function> 470 471 <func:function name="acrn:is-pre-launched-vm"> 472 <xsl:param name="load_order" /> 473 <func:result select="$load_order = 'PRE_LAUNCHED_VM'" /> 474 </func:function> 475 476 <func:function name="acrn:is-post-launched-vm"> 477 <xsl:param name="load_order" /> 478 <func:result select="$load_order = 'POST_LAUNCHED_VM'" /> 479 </func:function> 480 481 <!-- acrn:is-vmsix-supported-device checks the given params are matched with any of the listed devices --> 482 <!-- The listed devices are known that can have a virtual vmsix --> 483 <!-- Each pair of vendor and identifier represents a device which can have a vmsix (virtual msix) --> 484 <func:function name="acrn:is-vmsix-supported-device"> 485 <xsl:param name="vendor" /> 486 <xsl:param name="identifier" /> 487 <xsl:choose> 488 <!-- TSN devices --> 489 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4b30'"> 490 <func:result select="1" /> 491 </xsl:when> 492 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4b31'"> 493 <func:result select="1" /> 494 </xsl:when> 495 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4b32'"> 496 <func:result select="1" /> 497 </xsl:when> 498 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4ba0'"> 499 <func:result select="1" /> 500 </xsl:when> 501 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4ba1'"> 502 <func:result select="1" /> 503 </xsl:when> 504 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4ba2'"> 505 <func:result select="1" /> 506 </xsl:when> 507 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4bb0'"> 508 <func:result select="1" /> 509 </xsl:when> 510 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4bb1'"> 511 <func:result select="1" /> 512 </xsl:when> 513 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4bb2'"> 514 <func:result select="1" /> 515 </xsl:when> 516 <xsl:when test="$vendor = '0x8086' and $identifier = '0xa0ac'"> 517 <func:result select="1" /> 518 </xsl:when> 519 <xsl:when test="$vendor = '0x8086' and $identifier = '0x43ac'"> 520 <func:result select="1" /> 521 </xsl:when> 522 <xsl:when test="$vendor = '0x8086' and $identifier = '0x43a2'"> 523 <func:result select="1" /> 524 </xsl:when> 525 <!-- End of TSN devices --> 526 <!-- GPIO devices --> 527 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4b88'"> 528 <func:result select="1" /> 529 </xsl:when> 530 <xsl:when test="$vendor = '0x8086' and $identifier = '0x4b89'"> 531 <func:result select="1" /> 532 </xsl:when> 533 <!-- End of GPIO devices --> 534 <xsl:otherwise> 535 <func:result select="0" /> 536 </xsl:otherwise> 537 </xsl:choose> 538 </func:function> 539 540 <func:function name="acrn:get-intx-mapping"> 541 <xsl:param name="pt_intx_nodes" /> 542 <xsl:variable name="joined" select="translate(acrn:string-join($pt_intx_nodes/text(), '', '', ''), $whitespaces, '')" /> 543 <xsl:variable name="unique_mapping" select="set:distinct(str:split(str:replace($joined, ')(', ').('), '.'))" /> 544 <func:result select="$unique_mapping" /> 545 </func:function> 546 547 <func:function name="acrn:binary-bdf"> 548 <xsl:param name="bdf" /> 549 <xsl:variable name="bus" select="substring-before($bdf, ':')" /> 550 <xsl:variable name="device" select="substring-before(substring-after($bdf, ':'), '.')" /> 551 <xsl:variable name="function" select="substring-after($bdf, '.')" /> 552 <xsl:variable name="serial_bdf"> 553 <xsl:text>0b</xsl:text> 554 <xsl:call-template name="hex-to-bin"> 555 <xsl:with-param name="s" select="$bus" /> 556 <xsl:with-param name="width" select="4" /> 557 </xsl:call-template> 558 <xsl:call-template name="hex-to-bin"> 559 <xsl:with-param name="s" select="$device" /> 560 <xsl:with-param name="width" select="1" /> 561 </xsl:call-template> 562 <xsl:call-template name="hex-to-bin"> 563 <xsl:with-param name="s" select="$function" /> 564 <xsl:with-param name="width" select="3" /> 565 </xsl:call-template> 566 </xsl:variable> 567 <func:result select="$serial_bdf" /> 568 </func:function> 569 570 <func:function name="acrn:get-vbdf"> 571 <xsl:param name="vmid" /> 572 <xsl:param name="name" /> 573 <xsl:variable name="bus" select="acrn:initializer('b', concat(//vm[@id = $vmid]/device[@name = $name]/bus, 'U'), '')" /> 574 <xsl:variable name="dev" select="acrn:initializer('d', concat(//vm[@id = $vmid]/device[@name = $name]/dev, 'U'), '')" /> 575 <xsl:variable name="func" select="acrn:initializer('f', concat(//vm[@id = $vmid]/device[@name = $name]/func, 'U'), '')" /> 576 <func:result select="concat('{', $bus, $dev, $func, '}')" /> 577 </func:function> 578 579 <func:function name="acrn:get-pbdf"> 580 <xsl:param name="pci_dev" /> 581 <xsl:variable name="bus" select="acrn:initializer('b', concat('0x', translate(substring-before($pci_dev, ':'), $lowercase, $uppercase), 'U'), '')" /> 582 <xsl:variable name="dev" select="acrn:initializer('d', concat('0x', translate(substring-before(substring-after($pci_dev, ':'), '.'), $lowercase, $uppercase), 'U'), '')" /> 583 <xsl:variable name="func" select="acrn:initializer('f', concat('0x0', translate(substring-after(substring-before($pci_dev, ' '), '.'), $lowercase, $uppercase), 'U'), '')" /> 584 <func:result select="concat('{', $bus, $dev, $func, '}')" /> 585 </func:function> 586 587 <func:function name="acrn:ptdev-name-suffix"> 588 <xsl:param name="pci_dev" /> 589 <xsl:variable name="bus" select="translate(substring-before($pci_dev, ':'), $uppercase, $lowercase)" /> 590 <xsl:variable name="dev" select="translate(substring-before(substring-after($pci_dev, ':'), '.'), $uppercase, $lowercase)" /> 591 <xsl:variable name="func" select="translate(substring-after(substring-before($pci_dev, ' '), '.'), $uppercase, $lowercase)" /> 592 <func:result select="concat($bus, ':', $dev, '.', $func)" /> 593 </func:function> 594 <!-- End of scenario-specific functions--> 595 596 <!-- Board-specific functions--> 597 <func:function name="acrn:get-normalized-closinfo-rdt-res-str"> 598 <xsl:variable name="rdt_resource" select="acrn:string-join(//cache[capability/@id='CAT']/@level, ', ', 'L', '')" /> 599 <func:result select="$rdt_resource" /> 600 </func:function> 601 602 <func:function name="acrn:get-normalized-closinfo-rdt-clos-max-str"> 603 <xsl:variable name="rdt_res_clos_max" select="acrn:string-join(//cache[capability/@id='CAT']/capability/clos_number, ', ', '', '')"/> 604 <func:result select="$rdt_res_clos_max" /> 605 </func:function> 606 607 <!-- End of board-specific functions--> 608 609</xsl:stylesheet> 610