Index: /trunk/src/VBox/Main/BusAssignmentManager.cpp
===================================================================
--- /trunk/src/VBox/Main/BusAssignmentManager.cpp	(revision 33689)
+++ /trunk/src/VBox/Main/BusAssignmentManager.cpp	(revision 33690)
@@ -24,4 +24,5 @@
 
 #include <map>
+#include <vector>
 
 struct BusAssignmentManager::State
@@ -35,11 +36,24 @@
             ::strncpy(szDevName, pszName, sizeof(szDevName));
         }
+
+        bool operator<(const PciDeviceRecord &a) const
+        {
+            return ::strcmp(szDevName, a.szDevName) < 0;
+        }
+
+        bool operator==(const PciDeviceRecord &a) const
+        {
+            return ::strcmp(szDevName, a.szDevName) == 0;
+        }
     };
 
-    typedef std::map <PciBusAddress, PciDeviceRecord > PciMap;
+    typedef std::map <PciBusAddress,PciDeviceRecord > PciMap;
+    typedef std::vector<PciBusAddress>                PciAddrList;
+    typedef std::map <PciDeviceRecord,PciAddrList >   ReversePciMap;
 
     volatile int32_t cRefCnt;
     ChipsetType_T    mChipsetType;
     PciMap           mPciMap;
+    ReversePciMap    mReversePciMap;
 
     State()
@@ -54,4 +68,5 @@
     HRESULT autoAssign(const char* pszName, PciBusAddress& Address);
     bool    checkAvailable(PciBusAddress& Address);
+    bool    findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address);
 };
 
@@ -65,6 +80,35 @@
 HRESULT BusAssignmentManager::State::record(const char* pszName, PciBusAddress& Address)
 {
-    mPciMap.insert(PciMap::value_type(Address, PciDeviceRecord(pszName)));
-    return S_OK;
+    PciDeviceRecord devRec(pszName);
+
+    /* Remember address -> device mapping */
+    mPciMap.insert(PciMap::value_type(Address, devRec));
+
+    ReversePciMap::iterator it = mReversePciMap.find(devRec);
+    if (it == mReversePciMap.end())
+    {
+        mReversePciMap.insert(ReversePciMap::value_type(devRec, PciAddrList()));
+        it = mReversePciMap.find(devRec);
+    }
+
+    /* Remember device name -> addresses mapping */
+    it->second.push_back(Address);
+
+    return S_OK;
+}
+
+bool    BusAssignmentManager::State::findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address)
+{
+    PciDeviceRecord devRec(pszDevName);
+
+    ReversePciMap::iterator it = mReversePciMap.find(devRec);
+    if (it == mReversePciMap.end())
+        return false;
+
+    if (iInstance >= (int)it->second.size())
+        return false;
+
+    Address = it->second[iInstance];
+    return true;
 }
 
@@ -176,2 +220,8 @@
     return S_OK;
 }
+
+
+bool BusAssignmentManager::findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address)
+{
+    return pState->findPciAddress(pszDevName, iInstance, Address);
+}
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 33689)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 33690)
@@ -966,4 +966,8 @@
             InsertConfigNode(pDevices, "lpc", &pDev);
             InsertConfigNode(pDev,     "0", &pInst);
+#if 0
+            PciAddr = PciBusAddress(0, 31, 0);
+            hrc = BusMgr->assignPciDevice("lpc", pInst);                               H();
+#endif
             InsertConfigInteger(pInst, "Trusted",   1); /* boolean */
         }
@@ -2307,7 +2311,10 @@
             if (fOsXGuest && fAudioEnabled)
             {
-                /** @todo: don't hardcode */
-                uint32_t u32AudioPciAddr = (5 << 16) | 0;
-                InsertConfigInteger(pCfg, "AudioPciAddress",    u32AudioPciAddr);
+                PciBusAddress Address;
+                if (BusMgr->findPciAddress("hda", 0, Address))
+                {
+                    uint32_t u32AudioPciAddr = (Address.iDevice << 16) | Address.iFn;
+                    InsertConfigInteger(pCfg, "AudioPciAddress",    u32AudioPciAddr);
+                }
             }
             InsertConfigInteger(pCfg,  "IocPciAddress", u32IocPciAddress);
Index: /trunk/src/VBox/Main/include/BusAssignmentManager.h
===================================================================
--- /trunk/src/VBox/Main/include/BusAssignmentManager.h	(revision 33689)
+++ /trunk/src/VBox/Main/include/BusAssignmentManager.h	(revision 33690)
@@ -49,5 +49,5 @@
         if (iBus < a.iBus)
             return true;
-        
+
         if (iBus > a.iBus)
             return false;
@@ -55,5 +55,5 @@
         if (iDevice < a.iDevice)
             return true;
-        
+
         if (iDevice > a.iDevice)
             return false;
@@ -61,5 +61,5 @@
         if (iFn < a.iFn)
             return true;
-        
+
         if (iFn > a.iFn)
             return false;
@@ -110,4 +110,5 @@
         return assignPciDevice(pszDevName, pCfg, Address, false);
     }
+    virtual bool findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address);
 };
 
