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 51ae08745Sheppo * Common Development and Distribution License (the "License"). 61ae08745Sheppo * 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*9d468d1aSAnthony Yznaga * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _ERROR_H 277c478bd9Sstevel@tonic-gate #define _ERROR_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Resumable and Non-resumable queues 357c478bd9Sstevel@tonic-gate */ 361ae08745Sheppo #define CPU_RQ_ENTRIES 64 374bac2208Snarayan #define MAX_CPU_RQ_ENTRIES 128 384bac2208Snarayan 394bac2208Snarayan #define CPU_NRQ_ENTRIES 4 404bac2208Snarayan #define MAX_CPU_NRQ_ENTRIES 4 414bac2208Snarayan 427c478bd9Sstevel@tonic-gate #define Q_ENTRY_SIZE 64 434bac2208Snarayan 447c478bd9Sstevel@tonic-gate #define CPU_RQ_SIZE (CPU_RQ_ENTRIES * Q_ENTRY_SIZE) 457c478bd9Sstevel@tonic-gate #define CPU_NRQ_SIZE (CPU_NRQ_ENTRIES * Q_ENTRY_SIZE) 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * Sun4v Error Report error Descriptor describes the type of the error 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate #define ERRH_DESC_UNDEFINED 0 /* Undefined */ 517c478bd9Sstevel@tonic-gate #define ERRH_DESC_UCOR_RE 1 /* Uncorrected resumable error */ 527c478bd9Sstevel@tonic-gate #define ERRH_DESC_PR_NRE 2 /* Precise non-resumable error */ 537c478bd9Sstevel@tonic-gate #define ERRH_DESC_DEF_NRE 3 /* Deferred non-resumalbe error */ 543cac8019Srf157361 #define ERRH_DESC_WARN_RE 4 /* Power-off for vBSC HostShutdown() */ 55b72ed0ffSiskreen #define ERRH_DESC_USER_DCORE 5 /* User initiated panic */ 564df55fdeSJanie Lu #define ERRH_DESC_SP 6 /* SP state change */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * Sun4v Error Report Error Attributes specifies the attributes of the error 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate #define ERRH_ATTR_CPU 0x00000001 627c478bd9Sstevel@tonic-gate #define ERRH_ATTR_MEM 0x00000002 637c478bd9Sstevel@tonic-gate #define ERRH_ATTR_PIO 0x00000004 647c478bd9Sstevel@tonic-gate #define ERRH_ATTR_IRF 0x00000008 /* Integer register file */ 657c478bd9Sstevel@tonic-gate /* Floating-point register file */ 667c478bd9Sstevel@tonic-gate #define ERRH_ATTR_FRF 0x00000010 6744961713Sgirish #define ERRH_ATTR_SHUT 0x00000020 /* Shutdown request */ 6844961713Sgirish #define ERRH_ATTR_ASR 0x00000040 /* Sun4v ASR */ 6944961713Sgirish #define ERRH_ATTR_ASI 0x00000080 /* Sun4v ASI */ 7044961713Sgirish #define ERRH_ATTR_PREG 0x00000100 /* Sun4v Privileged Register */ 717c478bd9Sstevel@tonic-gate #define ERRH_ATTR_RQF 0x80000000 /* Resumablee Queue Full */ 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 744df55fdeSJanie Lu * For Execution mode 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate #define ERRH_MODE_MASK 0x03000000 777c478bd9Sstevel@tonic-gate #define ERRH_MODE_SHIFT 24 787c478bd9Sstevel@tonic-gate #define ERRH_MODE_UNKNOWN 0 797c478bd9Sstevel@tonic-gate #define ERRH_MODE_USER 1 807c478bd9Sstevel@tonic-gate #define ERRH_MODE_PRIV 2 817c478bd9Sstevel@tonic-gate 82ad559ebfSwh94709 /* 834df55fdeSJanie Lu * For SP (Service Processor) state change 844df55fdeSJanie Lu */ 85*9d468d1aSAnthony Yznaga #define ERRH_SP_MASK 0x00000600 864df55fdeSJanie Lu #define ERRH_SP_SHIFT 9 87*9d468d1aSAnthony Yznaga #define ERRH_SP_FAULTED 0 /* Physically present but faulted SP */ 884df55fdeSJanie Lu #define ERRH_SP_AVAILABLE 1 89*9d468d1aSAnthony Yznaga #define ERRH_SP_NOT_PRESENT 2 /* SP is not physically present */ 904df55fdeSJanie Lu 914df55fdeSJanie Lu /* 9244961713Sgirish * ASR register number 9344961713Sgirish */ 9444961713Sgirish #define ASR_REG_VALID 0x8000 /* Valid bit for register field */ 9544961713Sgirish #define ASR_REG_TICK 0x17 /* Tick Compare Register */ 9644961713Sgirish 9744961713Sgirish /* 98ad559ebfSwh94709 * For the second argument passed to process_nonresumable_error(), it is 99ad559ebfSwh94709 * an uint64_t. The upper 32 bits are reserved for various flags, the 100ad559ebfSwh94709 * lower 32 bits are used to pass the "current tl-1". Right now only bit 101ad559ebfSwh94709 * 32 in the upper 32 bits is being used as user's fill/spill flag. 102ad559ebfSwh94709 * If bit 32 is set, it means the first error in the error 103ad559ebfSwh94709 * queue happened in user fill/spill trap and it needs to be handled 104ad559ebfSwh94709 * differently. 105ad559ebfSwh94709 * 106ad559ebfSwh94709 * -Argument 2 of process_nonresumable_error() 107ad559ebfSwh94709 * ---------------------------------------------- 108ad559ebfSwh94709 * | reserved |x| current_tl - 1 | 109ad559ebfSwh94709 * ---------------------------------------------- 110ad559ebfSwh94709 * 63 32 31 0 111ad559ebfSwh94709 * x - bit 32, user fill/spill trap flag 112ad559ebfSwh94709 */ 113ad559ebfSwh94709 #define ERRH_U_SPILL_FILL 0x100000000 114ad559ebfSwh94709 #define ERRH_U_SPILL_FILL_SHIFT 32 115ad559ebfSwh94709 #define ERRH_TL_MASK 0xffffffff 116ad559ebfSwh94709 1177c478bd9Sstevel@tonic-gate #ifndef _ASM 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * For debug print out 1207c478bd9Sstevel@tonic-gate */ 1217c478bd9Sstevel@tonic-gate #define ER_SZ_IN_EXT_WORD (Q_ENTRY_SIZE / sizeof (uint64_t)) 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate /* 1247c478bd9Sstevel@tonic-gate * Sun4v Error Report record 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate typedef struct { 1277c478bd9Sstevel@tonic-gate uint64_t ehdl; /* Unique error handle */ 1287c478bd9Sstevel@tonic-gate uint64_t stick; /* Value of the %STICK register */ 1297c478bd9Sstevel@tonic-gate uint32_t desc; /* Error Descriptor */ 1307c478bd9Sstevel@tonic-gate uint32_t attr; /* error attributes bit field */ 1319d0d62adSJason Beloro uint64_t ra; /* Real address */ 1327c478bd9Sstevel@tonic-gate uint32_t sz; /* Size of affected mem region */ 1337c478bd9Sstevel@tonic-gate uint16_t cpuid; /* Virtual ID of the affected CPU */ 13444961713Sgirish uint16_t secs; /* Seconds */ 13544961713Sgirish uint8_t asi; /* ASI */ 13644961713Sgirish uint8_t rsvd; /* Padding for ASI */ 13744961713Sgirish uint16_t reg; /* Value of the ASR register number */ 1387c478bd9Sstevel@tonic-gate } errh_er_t; 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate typedef struct errh_async_flt { 1417c478bd9Sstevel@tonic-gate struct async_flt cmn_asyncflt; /* common fault structure */ 1427c478bd9Sstevel@tonic-gate errh_er_t errh_er; /* sun4v er record */ 1437c478bd9Sstevel@tonic-gate } errh_async_flt_t; 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * Global functions 1477c478bd9Sstevel@tonic-gate */ 1487c478bd9Sstevel@tonic-gate void mem_scrub(uint64_t, uint64_t); 1497c478bd9Sstevel@tonic-gate void errh_cpu_run_bus_error_handlers(struct async_flt *, int); 1507c478bd9Sstevel@tonic-gate void error_init(void); 1517c478bd9Sstevel@tonic-gate void cpu_async_log_err(void *); 1527c478bd9Sstevel@tonic-gate void cpu_ce_log_err(struct async_flt *); 1537c478bd9Sstevel@tonic-gate void cpu_ue_log_err(struct async_flt *); 1542ae0af4bSep32863 uint64_t mem_sync(caddr_t, size_t); 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate #endif /* _ASM */ 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1597c478bd9Sstevel@tonic-gate } 1607c478bd9Sstevel@tonic-gate #endif 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate #endif /* _ERROR_H */ 163