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 /* 22ad559ebfSwh * Copyright 2006 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 #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* 367c478bd9Sstevel@tonic-gate * Resumable and Non-resumable queues 377c478bd9Sstevel@tonic-gate */ 381ae08745Sheppo #define CPU_RQ_ENTRIES 64 394bac2208Snarayan #define MAX_CPU_RQ_ENTRIES 128 404bac2208Snarayan 414bac2208Snarayan #define CPU_NRQ_ENTRIES 4 424bac2208Snarayan #define MAX_CPU_NRQ_ENTRIES 4 434bac2208Snarayan 447c478bd9Sstevel@tonic-gate #define Q_ENTRY_SIZE 64 454bac2208Snarayan 467c478bd9Sstevel@tonic-gate #define CPU_RQ_SIZE (CPU_RQ_ENTRIES * Q_ENTRY_SIZE) 477c478bd9Sstevel@tonic-gate #define CPU_NRQ_SIZE (CPU_NRQ_ENTRIES * Q_ENTRY_SIZE) 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * Sun4v Error Report error Descriptor describes the type of the error 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate #define ERRH_DESC_UNDEFINED 0 /* Undefined */ 537c478bd9Sstevel@tonic-gate #define ERRH_DESC_UCOR_RE 1 /* Uncorrected resumable error */ 547c478bd9Sstevel@tonic-gate #define ERRH_DESC_PR_NRE 2 /* Precise non-resumable error */ 557c478bd9Sstevel@tonic-gate #define ERRH_DESC_DEF_NRE 3 /* Deferred non-resumalbe error */ 563cac8019Srf #define ERRH_DESC_WARN_RE 4 /* Power-off for vBSC HostShutdown() */ 57*b72ed0ffSiskreen #define ERRH_DESC_USER_DCORE 5 /* User initiated panic */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 607c478bd9Sstevel@tonic-gate * Sun4v Error Report Error Attributes specifies the attributes of the error 617c478bd9Sstevel@tonic-gate */ 627c478bd9Sstevel@tonic-gate #define ERRH_ATTR_CPU 0x00000001 637c478bd9Sstevel@tonic-gate #define ERRH_ATTR_MEM 0x00000002 647c478bd9Sstevel@tonic-gate #define ERRH_ATTR_PIO 0x00000004 657c478bd9Sstevel@tonic-gate #define ERRH_ATTR_IRF 0x00000008 /* Integer register file */ 667c478bd9Sstevel@tonic-gate /* Floating-point register file */ 677c478bd9Sstevel@tonic-gate #define ERRH_ATTR_FRF 0x00000010 6844961713Sgirish #define ERRH_ATTR_SHUT 0x00000020 /* Shutdown request */ 6944961713Sgirish #define ERRH_ATTR_ASR 0x00000040 /* Sun4v ASR */ 7044961713Sgirish #define ERRH_ATTR_ASI 0x00000080 /* Sun4v ASI */ 7144961713Sgirish #define ERRH_ATTR_PREG 0x00000100 /* Sun4v Privileged Register */ 727c478bd9Sstevel@tonic-gate #define ERRH_ATTR_RQF 0x80000000 /* Resumablee Queue Full */ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate /* 757c478bd9Sstevel@tonic-gate * For Excution mode 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate #define ERRH_MODE_MASK 0x03000000 787c478bd9Sstevel@tonic-gate #define ERRH_MODE_SHIFT 24 797c478bd9Sstevel@tonic-gate #define ERRH_MODE_UNKNOWN 0 807c478bd9Sstevel@tonic-gate #define ERRH_MODE_USER 1 817c478bd9Sstevel@tonic-gate #define ERRH_MODE_PRIV 2 827c478bd9Sstevel@tonic-gate 8344961713Sgirish /* 8444961713Sgirish * ASR register number 8544961713Sgirish */ 8644961713Sgirish #define ASR_REG_VALID 0x8000 /* Valid bit for register field */ 8744961713Sgirish #define ASR_REG_TICK 0x17 /* Tick Compare Register */ 8844961713Sgirish 89ad559ebfSwh /* 90ad559ebfSwh * For the second argument passed to process_nonresumable_error(), it is 91ad559ebfSwh * an uint64_t. The upper 32 bits are reserved for various flags, the 92ad559ebfSwh * lower 32 bits are used to pass the "current tl-1". Right now only bit 93ad559ebfSwh * 32 in the upper 32 bits is being used as user's fill/spill flag. 94ad559ebfSwh * If bit 32 is set, it means the first error in the error 95ad559ebfSwh * queue happened in user fill/spill trap and it needs to be handled 96ad559ebfSwh * differently. 97ad559ebfSwh * 98ad559ebfSwh * -Argument 2 of process_nonresumable_error() 99ad559ebfSwh * ---------------------------------------------- 100ad559ebfSwh * | reserved |x| current_tl - 1 | 101ad559ebfSwh * ---------------------------------------------- 102ad559ebfSwh * 63 32 31 0 103ad559ebfSwh * x - bit 32, user fill/spill trap flag 104ad559ebfSwh */ 105ad559ebfSwh #define ERRH_U_SPILL_FILL 0x100000000 106ad559ebfSwh #define ERRH_U_SPILL_FILL_SHIFT 32 107ad559ebfSwh #define ERRH_TL_MASK 0xffffffff 108ad559ebfSwh 1097c478bd9Sstevel@tonic-gate #ifndef _ASM 1107c478bd9Sstevel@tonic-gate /* 1117c478bd9Sstevel@tonic-gate * For debug print out 1127c478bd9Sstevel@tonic-gate */ 1137c478bd9Sstevel@tonic-gate #define ER_SZ_IN_EXT_WORD (Q_ENTRY_SIZE / sizeof (uint64_t)) 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* 1167c478bd9Sstevel@tonic-gate * Sun4v Error Report record 1177c478bd9Sstevel@tonic-gate */ 1187c478bd9Sstevel@tonic-gate typedef struct { 1197c478bd9Sstevel@tonic-gate uint64_t ehdl; /* Unique error handle */ 1207c478bd9Sstevel@tonic-gate uint64_t stick; /* Value of the %STICK register */ 1217c478bd9Sstevel@tonic-gate uint32_t desc; /* Error Descriptor */ 1227c478bd9Sstevel@tonic-gate uint32_t attr; /* error attributes bit field */ 1237c478bd9Sstevel@tonic-gate uint64_t ra; /* Real address */ 1247c478bd9Sstevel@tonic-gate uint32_t sz; /* Size of affected mem region */ 1257c478bd9Sstevel@tonic-gate uint16_t cpuid; /* Virtual ID of the affected CPU */ 12644961713Sgirish uint16_t secs; /* Seconds */ 12744961713Sgirish uint8_t asi; /* ASI */ 12844961713Sgirish uint8_t rsvd; /* Padding for ASI */ 12944961713Sgirish uint16_t reg; /* Value of the ASR register number */ 1307c478bd9Sstevel@tonic-gate } errh_er_t; 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate typedef struct errh_async_flt { 1337c478bd9Sstevel@tonic-gate struct async_flt cmn_asyncflt; /* common fault structure */ 1347c478bd9Sstevel@tonic-gate errh_er_t errh_er; /* sun4v er record */ 1357c478bd9Sstevel@tonic-gate } errh_async_flt_t; 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate /* 1387c478bd9Sstevel@tonic-gate * Global functions 1397c478bd9Sstevel@tonic-gate */ 1407c478bd9Sstevel@tonic-gate void mem_scrub(uint64_t, uint64_t); 1417c478bd9Sstevel@tonic-gate void errh_cpu_run_bus_error_handlers(struct async_flt *, int); 1427c478bd9Sstevel@tonic-gate void error_init(void); 1437c478bd9Sstevel@tonic-gate void cpu_async_log_err(void *); 1447c478bd9Sstevel@tonic-gate void cpu_ce_log_err(struct async_flt *); 1457c478bd9Sstevel@tonic-gate void cpu_ue_log_err(struct async_flt *); 1462ae0af4bSep uint64_t mem_sync(caddr_t, size_t); 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #endif /* _ASM */ 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1517c478bd9Sstevel@tonic-gate } 1527c478bd9Sstevel@tonic-gate #endif 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #endif /* _ERROR_H */ 155