Changeset 107271 in vbox
- Timestamp:
- Dec 10, 2024 8:39:14 AM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImplConfigCommon.cpp
r107267 r107271 4740 4740 if (adapterType != NetworkAdapterType_UsbNet) 4741 4741 { 4742 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 4743 4744 int iPCIDeviceNo; 4745 if (enmChipset == ChipsetType_ICH9 || enmChipset == ChipsetType_PIIX3) 4746 { 4747 /* the first network card gets the PCI ID 3, the next 3 gets 8..10, 4748 * next 4 get 16..19. */ 4749 switch (uInstance) 4750 { 4751 case 0: 4742 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 4743 4744 int iPCIDeviceNo; 4745 if (enmChipset == ChipsetType_ICH9 || enmChipset == ChipsetType_PIIX3) 4746 { 4747 /* the first network card gets the PCI ID 3, the next 3 gets 8..10, 4748 * next 4 get 16..19. */ 4749 switch (uInstance) 4750 { 4751 case 0: 4752 iPCIDeviceNo = 3; 4753 break; 4754 case 1: case 2: case 3: 4755 iPCIDeviceNo = uInstance - 1 + 8; 4756 break; 4757 case 4: case 5: case 6: case 7: 4758 iPCIDeviceNo = uInstance - 4 + 16; 4759 break; 4760 default: 4761 /* auto assignment */ 4762 iPCIDeviceNo = -1; 4763 break; 4764 } 4765 #ifdef VMWARE_NET_IN_SLOT_11 4766 /* 4767 * Dirty hack for PCI slot compatibility with VMWare, 4768 * it assigns slot 0x11 to the first network controller. 4769 */ 4770 if (iPCIDeviceNo == 3 && adapterType == NetworkAdapterType_I82545EM) 4771 { 4772 iPCIDeviceNo = 0x11; 4773 fSwapSlots3and11 = true; 4774 } 4775 else if (iPCIDeviceNo == 0x11 && fSwapSlots3and11) 4752 4776 iPCIDeviceNo = 3; 4777 #endif 4778 } 4779 else /* Platforms other than x86 just use the auto assignment, no slot swap hack there. */ 4780 iPCIDeviceNo = -1; 4781 4782 PCIBusAddress PCIAddr = PCIBusAddress(0, iPCIDeviceNo, 0); 4783 hrc = pBusMgr->assignPCIDevice(pszAdapterName, pInst, PCIAddr); H(); 4784 4785 InsertConfigNode(pInst, "Config", &pCfg); 4786 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */ /** @todo Make PCNet ring-0 safe on 32-bit mac kernels! */ 4787 if (pDev == pDevPCNet) 4788 InsertConfigInteger(pCfg, "R0Enabled", false); 4789 #endif 4790 /* 4791 * Collect information needed for network booting and add it to the list. 4792 */ 4793 BootNic nic; 4794 4795 nic.mInstance = uInstance; 4796 /* Could be updated by reference, if auto assigned */ 4797 nic.mPCIAddress = PCIAddr; 4798 4799 hrc = networkAdapter->COMGETTER(BootPriority)(&nic.mBootPrio); H(); 4800 4801 llBootNics.push_back(nic); 4802 4803 /* 4804 * The virtual hardware type. PCNet supports three types, E1000 three, 4805 * but VirtIO only one. 4806 */ 4807 switch (adapterType) 4808 { 4809 case NetworkAdapterType_Am79C970A: 4810 InsertConfigString(pCfg, "ChipType", "Am79C970A"); 4753 4811 break; 4754 case 1: case 2: case3:4755 iPCIDeviceNo = uInstance - 1 + 8;4812 case NetworkAdapterType_Am79C973: 4813 InsertConfigString(pCfg, "ChipType", "Am79C973"); 4756 4814 break; 4757 case 4: case 5: case 6: case 7:4758 iPCIDeviceNo = uInstance - 4 + 16;4815 case NetworkAdapterType_Am79C960: 4816 InsertConfigString(pCfg, "ChipType", "Am79C960"); 4759 4817 break; 4760 default: 4761 /* auto assignment */ 4762 iPCIDeviceNo = -1; 4818 case NetworkAdapterType_I82540EM: 4819 InsertConfigInteger(pCfg, "AdapterType", 0); 4763 4820 break; 4764 } 4765 #ifdef VMWARE_NET_IN_SLOT_11 4766 /* 4767 * Dirty hack for PCI slot compatibility with VMWare, 4768 * it assigns slot 0x11 to the first network controller. 4769 */ 4770 if (iPCIDeviceNo == 3 && adapterType == NetworkAdapterType_I82545EM) 4771 { 4772 iPCIDeviceNo = 0x11; 4773 fSwapSlots3and11 = true; 4774 } 4775 else if (iPCIDeviceNo == 0x11 && fSwapSlots3and11) 4776 iPCIDeviceNo = 3; 4821 case NetworkAdapterType_I82543GC: 4822 InsertConfigInteger(pCfg, "AdapterType", 1); 4823 break; 4824 case NetworkAdapterType_I82545EM: 4825 InsertConfigInteger(pCfg, "AdapterType", 2); 4826 break; 4827 case NetworkAdapterType_Virtio: 4828 break; 4829 case NetworkAdapterType_NE1000: 4830 InsertConfigString(pCfg, "DeviceType", "NE1000"); 4831 break; 4832 case NetworkAdapterType_NE2000: 4833 InsertConfigString(pCfg, "DeviceType", "NE2000"); 4834 break; 4835 case NetworkAdapterType_WD8003: 4836 InsertConfigString(pCfg, "DeviceType", "WD8003"); 4837 break; 4838 case NetworkAdapterType_WD8013: 4839 InsertConfigString(pCfg, "DeviceType", "WD8013"); 4840 break; 4841 case NetworkAdapterType_ELNK2: 4842 InsertConfigString(pCfg, "DeviceType", "3C503"); 4843 break; 4844 case NetworkAdapterType_ELNK1: 4845 break; 4846 case NetworkAdapterType_UsbNet: /* fall through */ 4847 case NetworkAdapterType_Null: AssertFailedBreak(); /* (compiler warnings) */ 4848 #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK 4849 case NetworkAdapterType_32BitHack: AssertFailedBreak(); /* (compiler warnings) */ 4777 4850 #endif 4778 } 4779 else /* Platforms other than x86 just use the auto assignment, no slot swap hack there. */ 4780 iPCIDeviceNo = -1; 4781 4782 PCIBusAddress PCIAddr = PCIBusAddress(0, iPCIDeviceNo, 0); 4783 hrc = pBusMgr->assignPCIDevice(pszAdapterName, pInst, PCIAddr); H(); 4784 4785 InsertConfigNode(pInst, "Config", &pCfg); 4786 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */ /** @todo Make PCNet ring-0 safe on 32-bit mac kernels! */ 4787 if (pDev == pDevPCNet) 4788 InsertConfigInteger(pCfg, "R0Enabled", false); 4789 #endif 4790 /* 4791 * Collect information needed for network booting and add it to the list. 4792 */ 4793 BootNic nic; 4794 4795 nic.mInstance = uInstance; 4796 /* Could be updated by reference, if auto assigned */ 4797 nic.mPCIAddress = PCIAddr; 4798 4799 hrc = networkAdapter->COMGETTER(BootPriority)(&nic.mBootPrio); H(); 4800 4801 llBootNics.push_back(nic); 4802 4803 /* 4804 * The virtual hardware type. PCNet supports three types, E1000 three, 4805 * but VirtIO only one. 4806 */ 4807 switch (adapterType) 4808 { 4809 case NetworkAdapterType_Am79C970A: 4810 InsertConfigString(pCfg, "ChipType", "Am79C970A"); 4811 break; 4812 case NetworkAdapterType_Am79C973: 4813 InsertConfigString(pCfg, "ChipType", "Am79C973"); 4814 break; 4815 case NetworkAdapterType_Am79C960: 4816 InsertConfigString(pCfg, "ChipType", "Am79C960"); 4817 break; 4818 case NetworkAdapterType_I82540EM: 4819 InsertConfigInteger(pCfg, "AdapterType", 0); 4820 break; 4821 case NetworkAdapterType_I82543GC: 4822 InsertConfigInteger(pCfg, "AdapterType", 1); 4823 break; 4824 case NetworkAdapterType_I82545EM: 4825 InsertConfigInteger(pCfg, "AdapterType", 2); 4826 break; 4827 case NetworkAdapterType_Virtio: 4828 break; 4829 case NetworkAdapterType_NE1000: 4830 InsertConfigString(pCfg, "DeviceType", "NE1000"); 4831 break; 4832 case NetworkAdapterType_NE2000: 4833 InsertConfigString(pCfg, "DeviceType", "NE2000"); 4834 break; 4835 case NetworkAdapterType_WD8003: 4836 InsertConfigString(pCfg, "DeviceType", "WD8003"); 4837 break; 4838 case NetworkAdapterType_WD8013: 4839 InsertConfigString(pCfg, "DeviceType", "WD8013"); 4840 break; 4841 case NetworkAdapterType_ELNK2: 4842 InsertConfigString(pCfg, "DeviceType", "3C503"); 4843 break; 4844 case NetworkAdapterType_ELNK1: 4845 break; 4846 case NetworkAdapterType_UsbNet: /* fall through */ 4847 case NetworkAdapterType_Null: AssertFailedBreak(); /* (compiler warnings) */ 4848 #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK 4849 case NetworkAdapterType_32BitHack: AssertFailedBreak(); /* (compiler warnings) */ 4850 #endif 4851 } 4851 } 4852 4852 } 4853 4853 else
Note:
See TracChangeset
for help on using the changeset viewer.