17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*986fd29aSsetje * Common Development and Distribution License (the "License"). 6*986fd29aSsetje * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*986fd29aSsetje * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #include <sys/param.h> 297c478bd9Sstevel@tonic-gate #include <sys/systm.h> 307c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 317c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 327c478bd9Sstevel@tonic-gate #include <sys/esunddi.h> 337c478bd9Sstevel@tonic-gate #include <sys/platform_module.h> 347c478bd9Sstevel@tonic-gate #include <sys/errno.h> 357c478bd9Sstevel@tonic-gate #include <sys/lgrp.h> 367c478bd9Sstevel@tonic-gate #include <sys/memnode.h> 377c478bd9Sstevel@tonic-gate #include <sys/promif.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate int (*p2get_mem_unum)(int, uint64_t, char *, int, int *); 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate void 427c478bd9Sstevel@tonic-gate startup_platform(void) 437c478bd9Sstevel@tonic-gate { 447c478bd9Sstevel@tonic-gate } 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate int 477c478bd9Sstevel@tonic-gate set_platform_tsb_spares() 487c478bd9Sstevel@tonic-gate { 497c478bd9Sstevel@tonic-gate return (0); 507c478bd9Sstevel@tonic-gate } 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate void 537c478bd9Sstevel@tonic-gate set_platform_defaults(void) 547c478bd9Sstevel@tonic-gate { 557c478bd9Sstevel@tonic-gate } 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * Definitions for accessing the pci config space of the isa node 597c478bd9Sstevel@tonic-gate * of Southbridge. 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate #define ENCHILADA_ISA_PATHNAME "/pci@1e,600000/isa@7" 627c478bd9Sstevel@tonic-gate static ddi_acc_handle_t isa_handle; /* handle for isa pci space */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate void 667c478bd9Sstevel@tonic-gate load_platform_drivers(void) 677c478bd9Sstevel@tonic-gate { 687c478bd9Sstevel@tonic-gate dev_info_t *dip; /* dip of the isa driver */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate /* 717c478bd9Sstevel@tonic-gate * Install power driver which handles the power button. 727c478bd9Sstevel@tonic-gate */ 737c478bd9Sstevel@tonic-gate if (i_ddi_attach_hw_nodes("power") != DDI_SUCCESS) 747c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "Failed to install \"power\" driver."); 757c478bd9Sstevel@tonic-gate (void) ddi_hold_driver(ddi_name_to_major("power")); 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate /* 787c478bd9Sstevel@tonic-gate * It is OK to return error because 'us' driver is not available 797c478bd9Sstevel@tonic-gate * in all clusters (e.g. missing in Core cluster). 807c478bd9Sstevel@tonic-gate */ 817c478bd9Sstevel@tonic-gate (void) i_ddi_attach_hw_nodes("us"); 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate if (i_ddi_attach_hw_nodes("grbeep") != DDI_SUCCESS) 847c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "Failed to install \"beep\" driver."); 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* 887c478bd9Sstevel@tonic-gate * mc-us3i must stay loaded for plat_get_mem_unum() 897c478bd9Sstevel@tonic-gate */ 907c478bd9Sstevel@tonic-gate if (i_ddi_attach_hw_nodes("mc-us3i") != DDI_SUCCESS) 917c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "mc-us3i driver failed to install"); 927c478bd9Sstevel@tonic-gate (void) ddi_hold_driver(ddi_name_to_major("mc-us3i")); 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate /* 957c478bd9Sstevel@tonic-gate * Install Isa driver. This is required for the southbridge IDE 967c478bd9Sstevel@tonic-gate * workaround - to reset the IDE channel during IDE bus reset. 977c478bd9Sstevel@tonic-gate * Panic the system in case ISA driver could not be loaded or 987c478bd9Sstevel@tonic-gate * any problem in accessing its pci config space. Since the register 997c478bd9Sstevel@tonic-gate * to reset the channel for IDE is in ISA config space!. 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate dip = e_ddi_hold_devi_by_path(ENCHILADA_ISA_PATHNAME, 0); 1037c478bd9Sstevel@tonic-gate if (dip == NULL) { 1047c478bd9Sstevel@tonic-gate cmn_err(CE_PANIC, "Could not install the isa driver\n"); 1057c478bd9Sstevel@tonic-gate return; 1067c478bd9Sstevel@tonic-gate } 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate if (pci_config_setup(dip, &isa_handle) != DDI_SUCCESS) { 1097c478bd9Sstevel@tonic-gate cmn_err(CE_PANIC, "Could not get the config space of isa\n"); 1107c478bd9Sstevel@tonic-gate return; 1117c478bd9Sstevel@tonic-gate } 1127c478bd9Sstevel@tonic-gate } 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate /* 1157c478bd9Sstevel@tonic-gate * This routine provides a workaround for a bug in the SB chip which 1167c478bd9Sstevel@tonic-gate * can cause data corruption. Will be invoked from the IDE HBA driver for 1177c478bd9Sstevel@tonic-gate * Acer SouthBridge at the time of IDE bus reset. 1187c478bd9Sstevel@tonic-gate */ 1197c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1207c478bd9Sstevel@tonic-gate int 1217c478bd9Sstevel@tonic-gate plat_ide_chipreset(dev_info_t *dip, int chno) 1227c478bd9Sstevel@tonic-gate { 1237c478bd9Sstevel@tonic-gate uint8_t val; 1247c478bd9Sstevel@tonic-gate int ret = DDI_SUCCESS; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate if (isa_handle == NULL) { 1277c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1287c478bd9Sstevel@tonic-gate } 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate val = pci_config_get8(isa_handle, 0x58); 1317c478bd9Sstevel@tonic-gate /* 1327c478bd9Sstevel@tonic-gate * The dip passed as the argument is not used here. 1337c478bd9Sstevel@tonic-gate * This will be needed for platforms which have multiple on-board SB, 1347c478bd9Sstevel@tonic-gate * The dip passed will be used to match the corresponding ISA node. 1357c478bd9Sstevel@tonic-gate */ 1367c478bd9Sstevel@tonic-gate switch (chno) { 1377c478bd9Sstevel@tonic-gate case 0: 1387c478bd9Sstevel@tonic-gate /* 1397c478bd9Sstevel@tonic-gate * First disable the primary channel then re-enable it. 1407c478bd9Sstevel@tonic-gate * As per ALI no wait should be required in between have 1417c478bd9Sstevel@tonic-gate * given 1ms delay in between to be on safer side. 1427c478bd9Sstevel@tonic-gate * bit 2 of register 0x58 when 0 disable the channel 0. 1437c478bd9Sstevel@tonic-gate * bit 2 of register 0x58 when 1 enables the channel 0. 1447c478bd9Sstevel@tonic-gate */ 1457c478bd9Sstevel@tonic-gate pci_config_put8(isa_handle, 0x58, val & 0xFB); 1467c478bd9Sstevel@tonic-gate drv_usecwait(1000); 1477c478bd9Sstevel@tonic-gate pci_config_put8(isa_handle, 0x58, val); 1487c478bd9Sstevel@tonic-gate break; 1497c478bd9Sstevel@tonic-gate case 1: 1507c478bd9Sstevel@tonic-gate /* 1517c478bd9Sstevel@tonic-gate * bit 3 of register 0x58 when 0 disable the channel 1. 1527c478bd9Sstevel@tonic-gate * bit 3 of register 0x58 when 1 enables the channel 1. 1537c478bd9Sstevel@tonic-gate */ 1547c478bd9Sstevel@tonic-gate pci_config_put8(isa_handle, 0x58, val & 0xF7); 1557c478bd9Sstevel@tonic-gate drv_usecwait(1000); 1567c478bd9Sstevel@tonic-gate pci_config_put8(isa_handle, 0x58, val); 1577c478bd9Sstevel@tonic-gate break; 1587c478bd9Sstevel@tonic-gate default: 1597c478bd9Sstevel@tonic-gate /* 1607c478bd9Sstevel@tonic-gate * Unknown channel number passed. Return failure. 1617c478bd9Sstevel@tonic-gate */ 1627c478bd9Sstevel@tonic-gate ret = DDI_FAILURE; 1637c478bd9Sstevel@tonic-gate } 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate return (ret); 1667c478bd9Sstevel@tonic-gate } 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1707c478bd9Sstevel@tonic-gate int 1717c478bd9Sstevel@tonic-gate plat_cpu_poweron(struct cpu *cp) 1727c478bd9Sstevel@tonic-gate { 1737c478bd9Sstevel@tonic-gate return (ENOTSUP); /* not supported on this platform */ 1747c478bd9Sstevel@tonic-gate } 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1777c478bd9Sstevel@tonic-gate int 1787c478bd9Sstevel@tonic-gate plat_cpu_poweroff(struct cpu *cp) 1797c478bd9Sstevel@tonic-gate { 1807c478bd9Sstevel@tonic-gate return (ENOTSUP); /* not supported on this platform */ 1817c478bd9Sstevel@tonic-gate } 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1847c478bd9Sstevel@tonic-gate void 1857c478bd9Sstevel@tonic-gate plat_freelist_process(int mnode) 1867c478bd9Sstevel@tonic-gate { 1877c478bd9Sstevel@tonic-gate } 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate char *platform_module_list[] = { 1907c478bd9Sstevel@tonic-gate "m1535ppm", 1917c478bd9Sstevel@tonic-gate "jbusppm", 1927c478bd9Sstevel@tonic-gate "ics951601", 1937c478bd9Sstevel@tonic-gate "pca9556", 1947c478bd9Sstevel@tonic-gate "ppm", 1957c478bd9Sstevel@tonic-gate (char *)0 1967c478bd9Sstevel@tonic-gate }; 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1997c478bd9Sstevel@tonic-gate void 2007c478bd9Sstevel@tonic-gate plat_tod_fault(enum tod_fault_type tod_bad) 2017c478bd9Sstevel@tonic-gate { 2027c478bd9Sstevel@tonic-gate } 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 2057c478bd9Sstevel@tonic-gate int 2067c478bd9Sstevel@tonic-gate plat_get_mem_unum(int synd_code, uint64_t flt_addr, int flt_bus_id, 2077c478bd9Sstevel@tonic-gate int flt_in_memory, ushort_t flt_status, char *buf, int buflen, int *lenp) 2087c478bd9Sstevel@tonic-gate { 2097c478bd9Sstevel@tonic-gate if (flt_in_memory && (p2get_mem_unum != NULL)) 2107c478bd9Sstevel@tonic-gate return (p2get_mem_unum(synd_code, P2ALIGN(flt_addr, 8), 2117c478bd9Sstevel@tonic-gate buf, buflen, lenp)); 2127c478bd9Sstevel@tonic-gate else 2137c478bd9Sstevel@tonic-gate return (ENOTSUP); 2147c478bd9Sstevel@tonic-gate } 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 2177c478bd9Sstevel@tonic-gate int 2187c478bd9Sstevel@tonic-gate plat_get_cpu_unum(int cpuid, char *buf, int buflen, int *lenp) 2197c478bd9Sstevel@tonic-gate { 2207c478bd9Sstevel@tonic-gate if (snprintf(buf, buflen, "MB") >= buflen) { 2217c478bd9Sstevel@tonic-gate return (ENOSPC); 2227c478bd9Sstevel@tonic-gate } else { 2237c478bd9Sstevel@tonic-gate *lenp = strlen(buf); 2247c478bd9Sstevel@tonic-gate return (0); 2257c478bd9Sstevel@tonic-gate } 2267c478bd9Sstevel@tonic-gate } 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate /* 2297c478bd9Sstevel@tonic-gate * Fiesta support for lgroups. 2307c478bd9Sstevel@tonic-gate * 2317c478bd9Sstevel@tonic-gate * On fiesta platform, an lgroup platform handle == CPU id 2327c478bd9Sstevel@tonic-gate */ 2337c478bd9Sstevel@tonic-gate 2347c478bd9Sstevel@tonic-gate /* 2357c478bd9Sstevel@tonic-gate * Macro for extracting the CPU number from the CPU id 2367c478bd9Sstevel@tonic-gate */ 2377c478bd9Sstevel@tonic-gate #define CPUID_TO_LGRP(id) ((id) & 0x7) 2387c478bd9Sstevel@tonic-gate #define ENCHILADA_MC_SHIFT 36 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate /* 2417c478bd9Sstevel@tonic-gate * Return the platform handle for the lgroup containing the given CPU 2427c478bd9Sstevel@tonic-gate */ 2437c478bd9Sstevel@tonic-gate lgrp_handle_t 2447c478bd9Sstevel@tonic-gate plat_lgrp_cpu_to_hand(processorid_t id) 2457c478bd9Sstevel@tonic-gate { 2467c478bd9Sstevel@tonic-gate return (CPUID_TO_LGRP(id)); 2477c478bd9Sstevel@tonic-gate } 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate /* 2507c478bd9Sstevel@tonic-gate * Platform specific lgroup initialization 2517c478bd9Sstevel@tonic-gate */ 2527c478bd9Sstevel@tonic-gate void 2537c478bd9Sstevel@tonic-gate plat_lgrp_init(void) 2547c478bd9Sstevel@tonic-gate { 255fa9e4066Sahrens pnode_t curnode; 2567c478bd9Sstevel@tonic-gate char tmp_name[MAXSYSNAME]; 2577c478bd9Sstevel@tonic-gate int portid; 2587c478bd9Sstevel@tonic-gate int cpucnt = 0; 2597c478bd9Sstevel@tonic-gate int max_portid = -1; 2607c478bd9Sstevel@tonic-gate extern uint32_t lgrp_expand_proc_thresh; 2617c478bd9Sstevel@tonic-gate extern uint32_t lgrp_expand_proc_diff; 2627c478bd9Sstevel@tonic-gate extern pgcnt_t lgrp_mem_free_thresh; 2637c478bd9Sstevel@tonic-gate extern uint32_t lgrp_loadavg_tolerance; 2647c478bd9Sstevel@tonic-gate extern uint32_t lgrp_loadavg_max_effect; 2657c478bd9Sstevel@tonic-gate extern uint32_t lgrp_load_thresh; 2667c478bd9Sstevel@tonic-gate extern lgrp_mem_policy_t lgrp_mem_policy_root; 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate /* 2697c478bd9Sstevel@tonic-gate * Count the number of CPUs installed to determine if 2707c478bd9Sstevel@tonic-gate * NUMA optimization should be enabled or not. 2717c478bd9Sstevel@tonic-gate * 2727c478bd9Sstevel@tonic-gate * All CPU nodes reside in the root node and have a 2737c478bd9Sstevel@tonic-gate * device type "cpu". 2747c478bd9Sstevel@tonic-gate */ 2757c478bd9Sstevel@tonic-gate curnode = prom_rootnode(); 2767c478bd9Sstevel@tonic-gate for (curnode = prom_childnode(curnode); curnode; 2777c478bd9Sstevel@tonic-gate curnode = prom_nextnode(curnode)) { 2787c478bd9Sstevel@tonic-gate bzero(tmp_name, MAXSYSNAME); 2797c478bd9Sstevel@tonic-gate if (prom_getprop(curnode, OBP_NAME, (caddr_t)tmp_name) == -1 || 2807c478bd9Sstevel@tonic-gate prom_getprop(curnode, OBP_DEVICETYPE, tmp_name) == -1 || 2817c478bd9Sstevel@tonic-gate strcmp(tmp_name, "cpu") != 0) 2827c478bd9Sstevel@tonic-gate continue; 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate cpucnt++; 2857c478bd9Sstevel@tonic-gate if (prom_getprop(curnode, "portid", (caddr_t)&portid) != -1 && 2867c478bd9Sstevel@tonic-gate portid > max_portid) 2877c478bd9Sstevel@tonic-gate max_portid = portid; 2887c478bd9Sstevel@tonic-gate } 2897c478bd9Sstevel@tonic-gate if (cpucnt <= 1) 2907c478bd9Sstevel@tonic-gate max_mem_nodes = 1; 2917c478bd9Sstevel@tonic-gate else if (max_portid >= 0 && max_portid < MAX_MEM_NODES) 2927c478bd9Sstevel@tonic-gate max_mem_nodes = max_portid + 1; 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate /* 2957c478bd9Sstevel@tonic-gate * Set tuneables for fiesta architecture 2967c478bd9Sstevel@tonic-gate * 2977c478bd9Sstevel@tonic-gate * lgrp_expand_proc_thresh is the minimum load on the lgroups 2987c478bd9Sstevel@tonic-gate * this process is currently running on before considering 2997c478bd9Sstevel@tonic-gate * expanding threads to another lgroup. 3007c478bd9Sstevel@tonic-gate * 3017c478bd9Sstevel@tonic-gate * lgrp_expand_proc_diff determines how much less the remote lgroup 3027c478bd9Sstevel@tonic-gate * must be loaded before expanding to it. 3037c478bd9Sstevel@tonic-gate * 3047c478bd9Sstevel@tonic-gate * Optimize for memory bandwidth by spreading multi-threaded 3057c478bd9Sstevel@tonic-gate * program to different lgroups. 3067c478bd9Sstevel@tonic-gate */ 3077c478bd9Sstevel@tonic-gate lgrp_expand_proc_thresh = lgrp_loadavg_max_effect - 1; 3087c478bd9Sstevel@tonic-gate lgrp_expand_proc_diff = lgrp_loadavg_max_effect / 2; 3097c478bd9Sstevel@tonic-gate lgrp_loadavg_tolerance = lgrp_loadavg_max_effect / 2; 3107c478bd9Sstevel@tonic-gate lgrp_mem_free_thresh = 1; /* home lgrp must have some memory */ 3117c478bd9Sstevel@tonic-gate lgrp_expand_proc_thresh = lgrp_loadavg_max_effect - 1; 3127c478bd9Sstevel@tonic-gate lgrp_mem_policy_root = LGRP_MEM_POLICY_NEXT; 3137c478bd9Sstevel@tonic-gate lgrp_load_thresh = 0; 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate mem_node_pfn_shift = ENCHILADA_MC_SHIFT - MMU_PAGESHIFT; 3167c478bd9Sstevel@tonic-gate } 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate /* 3197c478bd9Sstevel@tonic-gate * Return latency between "from" and "to" lgroups 3207c478bd9Sstevel@tonic-gate * 3217c478bd9Sstevel@tonic-gate * This latency number can only be used for relative comparison 3227c478bd9Sstevel@tonic-gate * between lgroups on the running system, cannot be used across platforms, 3237c478bd9Sstevel@tonic-gate * and may not reflect the actual latency. It is platform and implementation 3247c478bd9Sstevel@tonic-gate * specific, so platform gets to decide its value. It would be nice if the 3257c478bd9Sstevel@tonic-gate * number was at least proportional to make comparisons more meaningful though. 3267c478bd9Sstevel@tonic-gate * NOTE: The numbers below are supposed to be load latencies for uncached 3277c478bd9Sstevel@tonic-gate * memory divided by 10. 3287c478bd9Sstevel@tonic-gate */ 3297c478bd9Sstevel@tonic-gate int 3307c478bd9Sstevel@tonic-gate plat_lgrp_latency(lgrp_handle_t from, lgrp_handle_t to) 3317c478bd9Sstevel@tonic-gate { 3327c478bd9Sstevel@tonic-gate /* 3337c478bd9Sstevel@tonic-gate * Return remote latency when there are more than two lgroups 3347c478bd9Sstevel@tonic-gate * (root and child) and getting latency between two different 3357c478bd9Sstevel@tonic-gate * lgroups or root is involved 3367c478bd9Sstevel@tonic-gate */ 3377c478bd9Sstevel@tonic-gate if (lgrp_optimizations() && (from != to || 3387c478bd9Sstevel@tonic-gate from == LGRP_DEFAULT_HANDLE || to == LGRP_DEFAULT_HANDLE)) 3397c478bd9Sstevel@tonic-gate return (17); 3407c478bd9Sstevel@tonic-gate else 3417c478bd9Sstevel@tonic-gate return (12); 3427c478bd9Sstevel@tonic-gate } 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate int 3457c478bd9Sstevel@tonic-gate plat_pfn_to_mem_node(pfn_t pfn) 3467c478bd9Sstevel@tonic-gate { 3477c478bd9Sstevel@tonic-gate ASSERT(max_mem_nodes > 1); 3487c478bd9Sstevel@tonic-gate return (pfn >> mem_node_pfn_shift); 3497c478bd9Sstevel@tonic-gate } 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate /* 3527c478bd9Sstevel@tonic-gate * Assign memnode to lgroups 3537c478bd9Sstevel@tonic-gate */ 3547c478bd9Sstevel@tonic-gate void 355fa9e4066Sahrens plat_fill_mc(pnode_t nodeid) 3567c478bd9Sstevel@tonic-gate { 3577c478bd9Sstevel@tonic-gate int portid; 3587c478bd9Sstevel@tonic-gate 3597c478bd9Sstevel@tonic-gate /* 3607c478bd9Sstevel@tonic-gate * Enchilada memory controller portid == global CPU id 3617c478bd9Sstevel@tonic-gate */ 3627c478bd9Sstevel@tonic-gate if ((prom_getprop(nodeid, "portid", (caddr_t)&portid) == -1) || 3637c478bd9Sstevel@tonic-gate (portid < 0)) 3647c478bd9Sstevel@tonic-gate return; 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate if (portid < max_mem_nodes) 3677c478bd9Sstevel@tonic-gate plat_assign_lgrphand_to_mem_node(portid, portid); 3687c478bd9Sstevel@tonic-gate } 369