| 13 | thread_local Device::ErrorState Device::globalError; |
| 14 | |
| 15 | int PhysicalDevice::getInt(const std::string& name) const |
| 16 | { |
| 17 | if (name == "type") |
| 18 | return static_cast<int>(type); |
| 19 | else if (name == "uuidSupported") |
| 20 | return uuidSupported; |
| 21 | else if (name == "luidSupported") |
| 22 | return luidSupported; |
| 23 | else if (name == "nodeMask") |
| 24 | { |
| 25 | if (!luidSupported) |
| 26 | throw Exception(Error::InvalidArgument, |
| 27 | "physical device node mask unavailable, check luidSupported first"); |
| 28 | return nodeMask; |
| 29 | } |
| 30 | else if (name == "pciAddressSupported") |
| 31 | return pciAddressSupported; |
| 32 | else if (name == "pciDomain") |
| 33 | { |
| 34 | if (!pciAddressSupported) |
| 35 | throw Exception(Error::InvalidArgument, |
| 36 | "physical device PCI domain number unavailable, check pciAddressSupported first"); |
| 37 | return pciDomain; |
| 38 | } |
| 39 | else if (name == "pciBus") |
| 40 | { |
| 41 | if (!pciAddressSupported) |
| 42 | throw Exception(Error::InvalidArgument, |
| 43 | "physical device PCI bus number unavailable, check pciAddressSupported first"); |
| 44 | return pciBus; |
| 45 | } |
| 46 | else if (name == "pciDevice") |
| 47 | { |
| 48 | if (!pciAddressSupported) |
| 49 | throw Exception(Error::InvalidArgument, |
| 50 | "physical device PCI device number unavailable, check pciAddressSupported first"); |
| 51 | return pciDevice; |
| 52 | } |
| 53 | else if (name == "pciFunction") |
| 54 | { |
| 55 | if (!pciAddressSupported) |
| 56 | throw Exception(Error::InvalidArgument, |
| 57 | "physical device PCI function number unavailable, check pciAddressSupported first"); |
| 58 | return pciFunction; |
| 59 | } |
| 60 | else |
| 61 | throw Exception(Error::InvalidArgument, "unknown physical device parameter or type mismatch: '" + name + "'"); |
| 62 | } |
| 63 | |
| 64 | const char* PhysicalDevice::getString(const std::string& name) const |
| 65 | { |
no test coverage detected