@@ -37,6 +37,37 @@ class UncorePMUDiscovery
3737 }
3838 return " unknown" ;
3939 };
40+ union PCICFGAddress
41+ {
42+ uint64 raw;
43+ struct {
44+ uint64 offset:12 ;
45+ uint64 function:3 ;
46+ uint64 device:5 ;
47+ uint64 bus:8 ;
48+ } fields;
49+ std::string getStr () const
50+ {
51+ std::ostringstream out (std::ostringstream::out);
52+ out << std::hex << fields.bus << " :" << fields.device << " ." << fields.function << " @" << fields.offset ;
53+ out << std::dec;
54+ return out.str ();
55+ }
56+ };
57+ static void printHelper (const accessTypeEnum accessType, const uint64 addr)
58+ {
59+ if (accessType == PCICFG)
60+ {
61+ PCICFGAddress Addr;
62+ Addr.raw = addr;
63+ std::cout << " (" << Addr.getStr () << " )" ;
64+ }
65+ else
66+ {
67+ std::cout << " (-)" ;
68+ }
69+ std::cout << " with access type " << std::dec << accessTypeStr (accessType);
70+ }
4071protected:
4172 struct GlobalPMU
4273 {
@@ -53,9 +84,9 @@ class UncorePMUDiscovery
5384 {
5485 std::cout << " global PMU " <<
5586 " of type " << std::dec << type <<
56- " globalCtrl: 0x" << std::hex << globalCtrlAddr <<
57- " with access type " << std::dec << accessTypeStr (accessType) <<
58- " stride: " << std::dec << stride
87+ " globalCtrl: 0x" << std::hex << globalCtrlAddr;
88+ UncorePMUDiscovery::printHelper ((accessTypeEnum)accessType, globalCtrlAddr);
89+ std::cout << " stride: " << std::dec << stride
5990 << " \n " ;
6091 }
6192 };
@@ -77,9 +108,10 @@ class UncorePMUDiscovery
77108 std::cout << " unit PMU " <<
78109 " of type " << std::dec << boxType <<
79110 " ID " << boxID <<
80- " box ctrl: 0x" << std::hex << boxCtrlAddr <<
81- " width " << std::dec << bitWidth <<
82- " with access type " << accessTypeStr (accessType) <<
111+ " box ctrl: 0x" << std::hex << boxCtrlAddr;
112+ UncorePMUDiscovery::printHelper ((accessTypeEnum)accessType, boxCtrlAddr);
113+ std::cout <<
114+ " width " << bitWidth <<
83115 " numRegs " << numRegs <<
84116 " ctrlOffset " << ctrlOffset <<
85117 " ctrOffset " << ctrOffset <<
0 commit comments