From d3422dbe58b6e9cbd4347733131e8ae42ad9abf4 Mon Sep 17 00:00:00 2001
From: Gleb Natapov <gleb@redhat.com>
Date: Wed, 2 Feb 2011 14:09:25 -0200
Subject: [PATCH 23/28] add bootindex parameter to assigned device

RH-Author: Gleb Natapov <gleb@redhat.com>
Message-id: <20110202140925.GK14984@redhat.com>
Patchwork-id: 17502
O-Subject: [PATCH RHEL6.1] add bootindex parameter to assigned device
Bugzilla: 643687
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

BZ: 643687
Upstream commit: 54ccaa575d588602148a018dffdb332c0aa861ad

Signed-off-by: Gleb Natapov <gleb@redhat.com>
--
			Gleb.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 hw/device-assignment.c |    4 ++++
 hw/device-assignment.h |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 42f2931..3b3ba64 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -40,6 +40,7 @@
 #include "monitor.h"
 /* #include "range.h" */
 #include <pci/header.h>
+#include "sysemu.h"
 
 /* From linux/ioport.h */
 #define IORESOURCE_IO       0x00000100  /* Resource type */
@@ -1714,6 +1715,8 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
     assigned_dev_load_option_rom(dev);
     QLIST_INSERT_HEAD(&devs, dev, next);
 
+    add_boot_device_path(dev->bootindex, &pci_dev->qdev, NULL);
+
     /* Register a vmsd so that we can mark it unmigratable. */
     vmstate_register(&dev->dev.qdev, 0, &vmstate_assigned_device, dev);
     register_device_unmigratable(&dev->dev.qdev,
@@ -1776,6 +1779,7 @@ static PCIDeviceInfo assign_info = {
     .qdev.props   = (Property[]) {
         DEFINE_PROP("host", AssignedDevice, host, qdev_prop_hostaddr, PCIHostDevice),
         DEFINE_PROP_UINT32("iommu", AssignedDevice, use_iommu, 1),
+        DEFINE_PROP_INT32("bootindex", AssignedDevice, bootindex, -1),
         DEFINE_PROP_STRING("configfd", AssignedDevice, configfd_name),
         DEFINE_PROP_END_OF_LIST(),
     },
diff --git a/hw/device-assignment.h b/hw/device-assignment.h
index 93a4b6e..bc48d54 100644
--- a/hw/device-assignment.h
+++ b/hw/device-assignment.h
@@ -103,6 +103,7 @@ typedef struct AssignedDevice {
     int mmio_index;
     int need_emulate_cmd;
     char *configfd_name;
+    int32_t bootindex;
     QLIST_ENTRY(AssignedDevice) next;
 } AssignedDevice;
 
-- 
1.7.4.rc1.16.gd2f15e

