+static inline unsigned get_nodes(void)
+{
+ return ((pci_read_config32(PCI_DEV(0, 0x18, 0), 0x60)>>4) & 7) + 1;
+}
+
+static int optimize_link_coherent_ht(void)
+{
+ int needs_reset = 0;
+
+ unsigned nodes;
+
+ nodes = get_nodes();
+
+#if CONFIG_MAX_PHYSICAL_CPUS > 1
+ if(nodes>1) {
+ needs_reset |= optimize_connection(
+ NODE_HT(0), 0x80 + link_to_register(link_connection(0,1)),
+ NODE_HT(1), 0x80 + link_to_register(link_connection(1,0)) );
+ }
+
+#if CONFIG_MAX_PHYSICAL_CPUS > 2
+ if(nodes>2) {
+ /* optimize physical connections - by LYH */
+ static const u8 opt_conn4[] = {
+ 0,2,
+ 1,3,
+ 2,3,
+ };
+ needs_reset |= optimize_connection_group(opt_conn4, ARRAY_SIZE(opt_conn4));
+ }
+#endif
+
+#if CONFIG_MAX_PHYSICAL_CPUS > 4
+ if(nodes>4) {
+ static const uint8_t opt_conn6[] ={
+ 2, 4,
+ 3, 5,
+ #if !CROSS_BAR_47_56
+ 4, 5,
+ #endif
+ };
+ needs_reset |= optimize_connection_group(opt_conn6, ARRAY_SIZE(opt_conn6));
+ }
+#endif
+
+#if CONFIG_MAX_PHYSICAL_CPUS > 6
+ if(nodes>6) {
+ static const uint8_t opt_conn8[] ={
+ 4, 6,
+ #if CROSS_BAR_47_56
+ 4, 7,
+ 5, 6,
+ #endif
+ 5, 7,
+ 6, 7,
+ };
+ needs_reset |= optimize_connection_group(opt_conn8, ARRAY_SIZE(opt_conn8));
+ }
+#endif
+
+#endif
+
+ needs_reset |= apply_cpu_errata_fixes(nodes);
+ needs_reset |= optimize_link_read_pointers(nodes);
+
+ return needs_reset;
+}
+
+#if CONFIG_RAMINIT_SYSINFO
+static void setup_coherent_ht_domain(void)
+#else