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*9d0d62adSJason Beloro * Copyright 2009 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 */ 543cac8019Srf #define ERRH_DESC_WARN_RE 4 /* Power-off for vBSC HostShutdown() */ 55b72ed0ffSiskreen #define ERRH_DESC_USER_DCORE 5 /* User initiated panic */ 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * Sun4v Error Report Error Attributes specifies the attributes of the error 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate #define ERRH_ATTR_CPU 0x00000001 617c478bd9Sstevel@tonic-gate #define ERRH_ATTR_MEM 0x00000002 627c478bd9Sstevel@tonic-gate #define ERRH_ATTR_PIO 0x00000004 637c478bd9Sstevel@tonic-gate #define ERRH_ATTR_IRF 0x00000008 /* Integer register file */ 647c478bd9Sstevel@tonic-gate /* Floating-point register file */ 657c478bd9Sstevel@tonic-gate #define ERRH_ATTR_FRF 0x00000010 6644961713Sgirish #define ERRH_ATTR_SHUT 0x00000020 /* Shutdown request */ 6744961713Sgirish #define ERRH_ATTR_ASR 0x00000040 /* Sun4v ASR */ 6844961713Sgirish #define ERRH_ATTR_ASI 0x00000080 /* Sun4v ASI */ 6944961713Sgirish #define ERRH_ATTR_PREG 0x00000100 /* Sun4v Privileged Register */ 707c478bd9Sstevel@tonic-gate #define ERRH_ATTR_RQF 0x80000000 /* Resumablee Queue Full */ 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate /* 737c478bd9Sstevel@tonic-gate * For Excution mode 747c478bd9Sstevel@tonic-gate */ 757c478bd9Sstevel@tonic-gate #define ERRH_MODE_MASK 0x03000000 767c478bd9Sstevel@tonic-gate #define ERRH_MODE_SHIFT 24 777c478bd9Sstevel@tonic-gate #define ERRH_MODE_UNKNOWN 0 787c478bd9Sstevel@tonic-gate #define ERRH_MODE_USER 1 797c478bd9Sstevel@tonic-gate #define ERRH_MODE_PRIV 2 807c478bd9Sstevel@tonic-gate 8144961713Sgirish /* 8244961713Sgirish * ASR register number 8344961713Sgirish */ 8444961713Sgirish #define ASR_REG_VALID 0x8000 /* Valid bit for register field */ 8544961713Sgirish #define ASR_REG_TICK 0x17 /* Tick Compare Register */ 8644961713Sgirish 87ad559ebfSwh /* 88ad559ebfSwh * For the second argument passed to process_nonresumable_error(), it is 89ad559ebfSwh * an uint64_t. The upper 32 bits are reserved for various flags, the 90ad559ebfSwh * lower 32 bits are used to pass the "current tl-1". Right now only bit 91ad559ebfSwh * 32 in the upper 32 bits is being used as user's fill/spill flag. 92ad559ebfSwh * If bit 32 is set, it means the first error in the error 93ad559ebfSwh * queue happened in user fill/spill trap and it needs to be handled 94ad559ebfSwh * differently. 95ad559ebfSwh * 96ad559ebfSwh * -Argument 2 of process_nonresumable_error() 97ad559ebfSwh * ---------------------------------------------- 98ad559ebfSwh * | reserved |x| current_tl - 1 | 99ad559ebfSwh * ---------------------------------------------- 100ad559ebfSwh * 63 32 31 0 101ad559ebfSwh * x - bit 32, user fill/spill trap flag 102ad559ebfSwh */ 103ad559ebfSwh #define ERRH_U_SPILL_FILL 0x100000000 104ad559ebfSwh #define ERRH_U_SPILL_FILL_SHIFT 32 105ad559ebfSwh #define ERRH_TL_MASK 0xffffffff 106ad559ebfSwh 1077c478bd9Sstevel@tonic-gate #ifndef _ASM 1087c478bd9Sstevel@tonic-gate /* 1097c478bd9Sstevel@tonic-gate * For debug print out 1107c478bd9Sstevel@tonic-gate */ 1117c478bd9Sstevel@tonic-gate #define ER_SZ_IN_EXT_WORD (Q_ENTRY_SIZE / sizeof (uint64_t)) 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate /* 1147c478bd9Sstevel@tonic-gate * Sun4v Error Report record 1157c478bd9Sstevel@tonic-gate */ 1167c478bd9Sstevel@tonic-gate typedef struct { 1177c478bd9Sstevel@tonic-gate uint64_t ehdl; /* Unique error handle */ 1187c478bd9Sstevel@tonic-gate uint64_t stick; /* Value of the %STICK register */ 1197c478bd9Sstevel@tonic-gate uint32_t desc; /* Error Descriptor */ 1207c478bd9Sstevel@tonic-gate uint32_t attr; /* error attributes bit field */ 121*9d0d62adSJason Beloro uint64_t ra; /* Real address */ 1227c478bd9Sstevel@tonic-gate uint32_t sz; /* Size of affected mem region */ 1237c478bd9Sstevel@tonic-gate uint16_t cpuid; /* Virtual ID of the affected CPU */ 12444961713Sgirish uint16_t secs; /* Seconds */ 12544961713Sgirish uint8_t asi; /* ASI */ 12644961713Sgirish uint8_t rsvd; /* Padding for ASI */ 12744961713Sgirish uint16_t reg; /* Value of the ASR register number */ 1287c478bd9Sstevel@tonic-gate } errh_er_t; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate typedef struct errh_async_flt { 1317c478bd9Sstevel@tonic-gate struct async_flt cmn_asyncflt; /* common fault structure */ 1327c478bd9Sstevel@tonic-gate errh_er_t errh_er; /* sun4v er record */ 1337c478bd9Sstevel@tonic-gate } errh_async_flt_t; 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate /* 1367c478bd9Sstevel@tonic-gate * Global functions 1377c478bd9Sstevel@tonic-gate */ 1387c478bd9Sstevel@tonic-gate void mem_scrub(uint64_t, uint64_t); 1397c478bd9Sstevel@tonic-gate void errh_cpu_run_bus_error_handlers(struct async_flt *, int); 1407c478bd9Sstevel@tonic-gate void error_init(void); 1417c478bd9Sstevel@tonic-gate void cpu_async_log_err(void *); 1427c478bd9Sstevel@tonic-gate void cpu_ce_log_err(struct async_flt *); 1437c478bd9Sstevel@tonic-gate void cpu_ue_log_err(struct async_flt *); 1442ae0af4bSep uint64_t mem_sync(caddr_t, size_t); 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate #endif /* _ASM */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1497c478bd9Sstevel@tonic-gate } 1507c478bd9Sstevel@tonic-gate #endif 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate #endif /* _ERROR_H */ 153