mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
conf: introduce generic ISA address
For example: <address type='isa' iobase='0x505' irq='0x1'/> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
8edb622c93
commit
f1a039ef57
@ -2428,6 +2428,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>
|
||||
|
@ -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>
|
||||
|
@ -3921,6 +3921,12 @@
|
||||
</attribute>
|
||||
<ref name="ccwaddress"/>
|
||||
</group>
|
||||
<group>
|
||||
<attribute name="type">
|
||||
<value>isa</value>
|
||||
</attribute>
|
||||
<ref name="isaaddress"/>
|
||||
</group>
|
||||
</choice>
|
||||
</element>
|
||||
</define>
|
||||
|
@ -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",
|
||||
@ -3113,6 +3114,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);
|
||||
@ -3449,6 +3457,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
|
||||
*/
|
||||
@ -3580,6 +3622,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,
|
||||
@ -12977,6 +13024,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;
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user