@@ -542,11 +542,21 @@ static void Query_Features(void *pArg)
542542 VendorFromMainID(midr, iArg->Features->Info.Vendor.ID,
543543 &iArg->Features->Info.Vendor.CRC, &iArg->HypervisorID);
544544*/
545- if (iArg -> Features -> TSC ) {
546- iArg -> Features -> Factory .Freq = 512 ;
547- } else {
548- iArg -> Features -> Factory .Freq = 1000 ;
549- }
545+ #ifdef CONFIG_OF
546+ {
547+ struct device_node * cpu_node = of_cpu_device_node_get (iArg -> localProcessor );
548+ if (cpu_node != NULL ) {
549+ of_property_read_u32 ( cpu_node , "clock-frequency" ,
550+ & iArg -> Features -> Factory .Freq ); /* Hz->Mhz */
551+ of_node_put (cpu_node );
552+ iArg -> Features -> Factory .Freq = iArg -> Features -> Factory .Freq / 1000000U ;
553+ }
554+ else
555+ iArg -> Features -> Factory .Freq = 512 ;
556+ }
557+ #else
558+ iArg -> Features -> Factory .Freq = 512 ;
559+ #endif /* CONFIG_OF */
550560#if defined(CONFIG_ACPI )
551561 iArg -> Features -> ACPI = acpi_disabled == 0 ;
552562#else
@@ -773,6 +783,14 @@ static void Map_Generic_Topology(void *arg)
773783 Core->T.CoreID = mpid.Aff0;
774784 }
775785*/
786+ #ifdef CONFIG_OF
787+ struct device_node * cpu_node = of_cpu_device_node_get (Core -> Bind );
788+ if (cpu_node != NULL ) {
789+ of_property_read_u32 (cpu_node , "reg" , & Core -> T .CoreID );
790+ of_node_put (cpu_node );
791+ }
792+ #endif /* CONFIG_OF */
793+
776794 Cache_Topology (Core );
777795 }
778796}
@@ -981,6 +999,16 @@ static void Query_DeviceTree(unsigned int cpu)
981999#endif
9821000 }
9831001#endif /* CONFIG_CPU_FREQ */
1002+ #ifdef CONFIG_OF
1003+ if (max_freq == 0 ) {
1004+ struct device_node * cpu_node = of_cpu_device_node_get (Core -> Bind );
1005+ if (cpu_node != NULL ) {
1006+ of_property_read_u32 (cpu_node , "clock-frequency" , & max_freq ); /* Hz */
1007+ of_node_put (cpu_node );
1008+ max_freq = max_freq / 1000U ; /* KHz */
1009+ }
1010+ }
1011+ #endif /* CONFIG_OF */
9841012 if (max_freq > 0 ) {
9851013 FREQ2COF (max_freq , COF );
9861014 } else {
0 commit comments