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 525cf1a30Sjl * Common Development and Distribution License (the "License"). 625cf1a30Sjl * 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 /* 22986fd29aSsetje * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 26*1f4c6dbcSPeter Tribble /* 27*1f4c6dbcSPeter Tribble * Copyright 2019 Peter Tribble. 28*1f4c6dbcSPeter Tribble */ 29*1f4c6dbcSPeter Tribble 307c478bd9Sstevel@tonic-gate #ifndef _SYS_PLATFORM_MODULE_H 317c478bd9Sstevel@tonic-gate #define _SYS_PLATFORM_MODULE_H 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <sys/async.h> 347c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 35986fd29aSsetje #include <sys/memlist_plat.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifdef _KERNEL 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate /* 457c478bd9Sstevel@tonic-gate * The functions that are expected of the platform modules. 467c478bd9Sstevel@tonic-gate */ 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #pragma weak startup_platform 497c478bd9Sstevel@tonic-gate #pragma weak set_platform_tsb_spares 507c478bd9Sstevel@tonic-gate #pragma weak set_platform_defaults 517c478bd9Sstevel@tonic-gate #pragma weak load_platform_drivers 527c478bd9Sstevel@tonic-gate #pragma weak plat_cpu_poweron 537c478bd9Sstevel@tonic-gate #pragma weak plat_cpu_poweroff 547c478bd9Sstevel@tonic-gate #pragma weak plat_freelist_process 557c478bd9Sstevel@tonic-gate #pragma weak plat_lpkmem_is_supported 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate extern void startup_platform(void); 587c478bd9Sstevel@tonic-gate extern int set_platform_tsb_spares(void); 597c478bd9Sstevel@tonic-gate extern void set_platform_defaults(void); 607c478bd9Sstevel@tonic-gate extern void load_platform_drivers(void); 617c478bd9Sstevel@tonic-gate extern void load_platform_modules(void); 627c478bd9Sstevel@tonic-gate extern int plat_cpu_poweron(struct cpu *cp); /* power on CPU */ 637c478bd9Sstevel@tonic-gate extern int plat_cpu_poweroff(struct cpu *cp); /* power off CPU */ 647c478bd9Sstevel@tonic-gate extern void plat_freelist_process(int mnode); 65986fd29aSsetje extern void plat_build_mem_nodes(prom_memlist_t *, size_t); 667c478bd9Sstevel@tonic-gate extern void plat_slice_add(pfn_t, pfn_t); 677c478bd9Sstevel@tonic-gate extern void plat_slice_del(pfn_t, pfn_t); 687c478bd9Sstevel@tonic-gate extern int plat_lpkmem_is_supported(void); 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate /* 717c478bd9Sstevel@tonic-gate * Data structures expected of the platform modules. 727c478bd9Sstevel@tonic-gate */ 737c478bd9Sstevel@tonic-gate extern char *platform_module_list[]; 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate #pragma weak plat_get_cpu_unum 767c478bd9Sstevel@tonic-gate #pragma weak plat_get_mem_unum 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate extern int plat_get_cpu_unum(int cpuid, char *buf, int buflen, int *len); 797c478bd9Sstevel@tonic-gate extern int plat_get_mem_unum(int synd_code, uint64_t flt_addr, int flt_bus_id, 807c478bd9Sstevel@tonic-gate int flt_in_memory, ushort_t flt_status, char *buf, int buflen, int *len); 817c478bd9Sstevel@tonic-gate 82d00f0155Sayznaga #pragma weak plat_get_mem_sid 83d00f0155Sayznaga #pragma weak plat_get_mem_offset 84d00f0155Sayznaga #pragma weak plat_get_mem_addr 85d00f0155Sayznaga 86d00f0155Sayznaga extern int plat_get_mem_sid(char *unum, char *buf, int buflen, int *len); 87d00f0155Sayznaga extern int plat_get_mem_offset(uint64_t paddr, uint64_t *offp); 88d00f0155Sayznaga extern int plat_get_mem_addr(char *unum, char *sid, uint64_t offset, 89d00f0155Sayznaga uint64_t *paddr); 90d00f0155Sayznaga 917c478bd9Sstevel@tonic-gate #pragma weak plat_log_fruid_error 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate extern void plat_log_fruid_error(int synd_code, struct async_flt *ecc, 947c478bd9Sstevel@tonic-gate char *unum, uint64_t afsr_bit); 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate #pragma weak plat_log_fruid_error2 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate struct plat_ecc_ch_async_flt; 99d58fda43Sjbeloro struct rmc_comm_msg; 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate extern void plat_log_fruid_error2(int msg_type, char *unum, 1027c478bd9Sstevel@tonic-gate struct async_flt *aflt, struct plat_ecc_ch_async_flt *plat_ecc_ch_flt); 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #pragma weak plat_ecc_capability_sc_get 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate extern int plat_ecc_capability_sc_get(int type); 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #pragma weak plat_blacklist 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate extern int plat_blacklist(int cmd, const char *scheme, nvlist_t *fmri, 1117c478bd9Sstevel@tonic-gate const char *class); 1127c478bd9Sstevel@tonic-gate 11325cf1a30Sjl extern caddr_t plat_startup_memlist(caddr_t alloc_base); 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #pragma weak plat_setprop_enter 1167c478bd9Sstevel@tonic-gate #pragma weak plat_setprop_exit 1177c478bd9Sstevel@tonic-gate #pragma weak plat_shared_i2c_enter 1187c478bd9Sstevel@tonic-gate #pragma weak plat_shared_i2c_exit 1197c478bd9Sstevel@tonic-gate #pragma weak plat_fan_blast 120d58fda43Sjbeloro #pragma weak plat_rmc_comm_req 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate extern void plat_setprop_enter(void); 1237c478bd9Sstevel@tonic-gate extern void plat_setprop_exit(void); 1247c478bd9Sstevel@tonic-gate extern void plat_shared_i2c_enter(dev_info_t *); 1257c478bd9Sstevel@tonic-gate extern void plat_shared_i2c_exit(dev_info_t *); 1267c478bd9Sstevel@tonic-gate extern void plat_fan_blast(void); 127d58fda43Sjbeloro extern void plat_rmc_comm_req(struct rmc_comm_msg *); 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * Used to communicate DR updates to platform lgroup framework 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate typedef struct { 1337c478bd9Sstevel@tonic-gate int u_board; 1347c478bd9Sstevel@tonic-gate uint64_t u_base; 1357c478bd9Sstevel@tonic-gate uint64_t u_len; 1367c478bd9Sstevel@tonic-gate } update_membounds_t; 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1417c478bd9Sstevel@tonic-gate } 1427c478bd9Sstevel@tonic-gate #endif 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #endif /* _SYS_PLATFORM_MODULE_H */ 145