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() */ 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 67*44961713Sgirish #define ERRH_ATTR_SHUT 0x00000020 /* Shutdown request */ 68*44961713Sgirish #define ERRH_ATTR_ASR 0x00000040 /* Sun4v ASR */ 69*44961713Sgirish #define ERRH_ATTR_ASI 0x00000080 /* Sun4v ASI */ 70*44961713Sgirish #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 /* 747c478bd9Sstevel@tonic-gate * For Excution 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 82*44961713Sgirish /* 83*44961713Sgirish * ASR register number 84*44961713Sgirish */ 85*44961713Sgirish #define ASR_REG_VALID 0x8000 /* Valid bit for register field */ 86*44961713Sgirish #define ASR_REG_TICK 0x17 /* Tick Compare Register */ 87*44961713Sgirish 88ad559ebfSwh /* 89ad559ebfSwh * For the second argument passed to process_nonresumable_error(), it is 90ad559ebfSwh * an uint64_t. The upper 32 bits are reserved for various flags, the 91ad559ebfSwh * lower 32 bits are used to pass the "current tl-1". Right now only bit 92ad559ebfSwh * 32 in the upper 32 bits is being used as user's fill/spill flag. 93ad559ebfSwh * If bit 32 is set, it means the first error in the error 94ad559ebfSwh * queue happened in user fill/spill trap and it needs to be handled 95ad559ebfSwh * differently. 96ad559ebfSwh * 97ad559ebfSwh * -Argument 2 of process_nonresumable_error() 98ad559ebfSwh * ---------------------------------------------- 99ad559ebfSwh * | reserved |x| current_tl - 1 | 100ad559ebfSwh * ---------------------------------------------- 101ad559ebfSwh * 63 32 31 0 102ad559ebfSwh * x - bit 32, user fill/spill trap flag 103ad559ebfSwh */ 104ad559ebfSwh #define ERRH_U_SPILL_FILL 0x100000000 105ad559ebfSwh #define ERRH_U_SPILL_FILL_SHIFT 32 106ad559ebfSwh #define ERRH_TL_MASK 0xffffffff 107ad559ebfSwh 1087c478bd9Sstevel@tonic-gate #ifndef _ASM 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * For debug print out 1117c478bd9Sstevel@tonic-gate */ 1127c478bd9Sstevel@tonic-gate #define ER_SZ_IN_EXT_WORD (Q_ENTRY_SIZE / sizeof (uint64_t)) 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate /* 1157c478bd9Sstevel@tonic-gate * Sun4v Error Report record 1167c478bd9Sstevel@tonic-gate */ 1177c478bd9Sstevel@tonic-gate typedef struct { 1187c478bd9Sstevel@tonic-gate uint64_t ehdl; /* Unique error handle */ 1197c478bd9Sstevel@tonic-gate uint64_t stick; /* Value of the %STICK register */ 1207c478bd9Sstevel@tonic-gate uint32_t desc; /* Error Descriptor */ 1217c478bd9Sstevel@tonic-gate uint32_t attr; /* error attributes bit field */ 1227c478bd9Sstevel@tonic-gate uint64_t ra; /* Real address */ 1237c478bd9Sstevel@tonic-gate uint32_t sz; /* Size of affected mem region */ 1247c478bd9Sstevel@tonic-gate uint16_t cpuid; /* Virtual ID of the affected CPU */ 125*44961713Sgirish uint16_t secs; /* Seconds */ 126*44961713Sgirish uint8_t asi; /* ASI */ 127*44961713Sgirish uint8_t rsvd; /* Padding for ASI */ 128*44961713Sgirish uint16_t reg; /* Value of the ASR register number */ 1297c478bd9Sstevel@tonic-gate } errh_er_t; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate typedef struct errh_async_flt { 1327c478bd9Sstevel@tonic-gate struct async_flt cmn_asyncflt; /* common fault structure */ 1337c478bd9Sstevel@tonic-gate errh_er_t errh_er; /* sun4v er record */ 1347c478bd9Sstevel@tonic-gate } errh_async_flt_t; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * Global functions 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate void mem_scrub(uint64_t, uint64_t); 1407c478bd9Sstevel@tonic-gate void errh_cpu_run_bus_error_handlers(struct async_flt *, int); 1417c478bd9Sstevel@tonic-gate void error_init(void); 1427c478bd9Sstevel@tonic-gate void cpu_async_log_err(void *); 1437c478bd9Sstevel@tonic-gate void cpu_ce_log_err(struct async_flt *); 1447c478bd9Sstevel@tonic-gate void cpu_ue_log_err(struct async_flt *); 1457c478bd9Sstevel@tonic-gate void mem_sync(caddr_t, size_t); 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #endif /* _ASM */ 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1507c478bd9Sstevel@tonic-gate } 1517c478bd9Sstevel@tonic-gate #endif 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate #endif /* _ERROR_H */ 154