--- docs/formatdomain.html.in | 5 ++++ docs/schemas/basictypes.rng | 17 ++++++++++++ docs/schemas/domaincommon.rng | 6 +++++ src/conf/domain_conf.c | 63 ++++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 9 +++++++ 5 files changed, 99 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 1850a2b..054ebc6 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2425,6 +2425,11 @@ operating system. <span class="since">Since 1.0.4</span> </dd> + <dt><code>type='isa'</code></dt> + <dd>ISA addresses have the following additional + attributes: <code>iobase</code> and <code>irq</code>. + <span class="since">Since 1.2.1</span> + </dd> </dl> <h4><a name="elementsControllers">Controllers</a></h4> diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 268bc5a..34ef613 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -380,4 +380,21 @@ </element> </define> + <define name="isaaddress"> + <optional> + <attribute name="iobase"> + <data type="string"> + <param name="pattern">0x[a-fA-F0-9]{1,4}</param> + </data> + </attribute> + </optional> + <optional> + <attribute name="irq"> + <data type="string"> + <param name="pattern">0x[a-fA-F0-9]</param> + </data> + </attribute> + </optional> + </define> + </grammar> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 80848d2..3e98af9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3921,6 +3921,12 @@ </attribute> <ref name="ccwaddress"/> </group> + <group> + <attribute name="type"> + <value>isa</value> + </attribute> + <ref name="isaaddress"/> + </group> </choice> </element> </define> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 140eb80..7d5617e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -212,7 +212,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, "spapr-vio", "virtio-s390", "ccw", - "virtio-mmio") + "virtio-mmio", + "isa") VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST, "block", @@ -3053,6 +3054,13 @@ virDomainDeviceInfoFormat(virBufferPtr buf, case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO: break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA: + if (info->addr.isa.iobase > 0) + virBufferAsprintf(buf, " iobase='0x%x'", info->addr.isa.iobase); + if (info->addr.isa.irq> 0) + virBufferAsprintf(buf, " irq='0x%x'", info->addr.isa.irq); + break; + default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown address type '%d'"), info->type); @@ -3389,6 +3397,40 @@ cleanup: return ret; } +static int +virDomainDeviceISAAddressParseXML(xmlNodePtr node, + virDomainDeviceISAAddressPtr addr) +{ + int ret = -1; + char *iobase; + char *irq; + + memset(addr, 0, sizeof(*addr)); + + iobase = virXMLPropString(node, "iobase"); + irq = virXMLPropString(node, "irq"); + + if (iobase && + virStrToLong_ui(iobase, NULL, 16, &addr->iobase) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Cannot parse <address> 'iobase' attribute")); + goto cleanup; + } + + if (irq && + virStrToLong_ui(irq, NULL, 16, &addr->irq) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Cannot parse <address> 'irq' attribute")); + goto cleanup; + } + + ret = 0; +cleanup: + VIR_FREE(iobase); + VIR_FREE(irq); + return ret; +} + /* Parse the XML definition for a device address * @param node XML nodeset to parse for device address definition */ @@ -3520,6 +3562,11 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO: break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA: + if (virDomainDeviceISAAddressParseXML(address, &info->addr.isa) < 0) + goto cleanup; + break; + default: /* Should not happen */ virReportError(VIR_ERR_INTERNAL_ERROR, @@ -12916,6 +12963,20 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, return false; } break; + + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA: + if (src->addr.isa.iobase != dst->addr.isa.iobase || + src->addr.isa.irq != dst->addr.isa.irq) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device isa address %d:%d " + "does not match source %d:%d"), + dst->addr.isa.iobase, + dst->addr.isa.irq, + src->addr.isa.iobase, + src->addr.isa.irq); + return false; + } + break; } return true; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4561ccc..25bd362 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -208,6 +208,7 @@ enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO, + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST }; @@ -284,6 +285,13 @@ struct _virDomainDeviceUSBMaster { unsigned int startport; }; +typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress; +typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr; +struct _virDomainDeviceISAAddress { + unsigned int iobase; + unsigned int irq; +}; + typedef struct _virDomainDeviceInfo virDomainDeviceInfo; typedef virDomainDeviceInfo *virDomainDeviceInfoPtr; struct _virDomainDeviceInfo { @@ -301,6 +309,7 @@ struct _virDomainDeviceInfo { virDomainDeviceUSBAddress usb; virDomainDeviceSpaprVioAddress spaprvio; virDomainDeviceCCWAddress ccw; + virDomainDeviceISAAddress isa; } addr; int mastertype; union { -- 1.7.11.7 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list