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 39*4bac2208Snarayan #define MAX_CPU_RQ_ENTRIES 128 40*4bac2208Snarayan 41*4bac2208Snarayan #define CPU_NRQ_ENTRIES 4 42*4bac2208Snarayan #define MAX_CPU_NRQ_ENTRIES 4 43*4bac2208Snarayan 447c478bd9Sstevel@tonic-gate #define Q_ENTRY_SIZE 64 45*4bac2208Snarayan 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 677c478bd9Sstevel@tonic-gate #define ERRH_ATTR_RQF 0x80000000 /* Resumablee Queue Full */ 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * For Excution mode 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate #define ERRH_MODE_MASK 0x03000000 737c478bd9Sstevel@tonic-gate #define ERRH_MODE_SHIFT 24 747c478bd9Sstevel@tonic-gate #define ERRH_MODE_UNKNOWN 0 757c478bd9Sstevel@tonic-gate #define ERRH_MODE_USER 1 767c478bd9Sstevel@tonic-gate #define ERRH_MODE_PRIV 2 777c478bd9Sstevel@tonic-gate 78ad559ebfSwh /* 79ad559ebfSwh * For the second argument passed to process_nonresumable_error(), it is 80ad559ebfSwh * an uint64_t. The upper 32 bits are reserved for various flags, the 81ad559ebfSwh * lower 32 bits are used to pass the "current tl-1". Right now only bit 82ad559ebfSwh * 32 in the upper 32 bits is being used as user's fill/spill flag. 83ad559ebfSwh * If bit 32 is set, it means the first error in the error 84ad559ebfSwh * queue happened in user fill/spill trap and it needs to be handled 85ad559ebfSwh * differently. 86ad559ebfSwh * 87ad559ebfSwh * -Argument 2 of process_nonresumable_error() 88ad559ebfSwh * ---------------------------------------------- 89ad559ebfSwh * | reserved |x| current_tl - 1 | 90ad559ebfSwh * ---------------------------------------------- 91ad559ebfSwh * 63 32 31 0 92ad559ebfSwh * x - bit 32, user fill/spill trap flag 93ad559ebfSwh */ 94ad559ebfSwh #define ERRH_U_SPILL_FILL 0x100000000 95ad559ebfSwh #define ERRH_U_SPILL_FILL_SHIFT 32 96ad559ebfSwh #define ERRH_TL_MASK 0xffffffff 97ad559ebfSwh 987c478bd9Sstevel@tonic-gate #ifndef _ASM 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * For debug print out 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate #define ER_SZ_IN_EXT_WORD (Q_ENTRY_SIZE / sizeof (uint64_t)) 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 1057c478bd9Sstevel@tonic-gate * Sun4v Error Report record 1067c478bd9Sstevel@tonic-gate */ 1077c478bd9Sstevel@tonic-gate typedef struct { 1087c478bd9Sstevel@tonic-gate uint64_t ehdl; /* Unique error handle */ 1097c478bd9Sstevel@tonic-gate uint64_t stick; /* Value of the %STICK register */ 1107c478bd9Sstevel@tonic-gate uint32_t desc; /* Error Descriptor */ 1117c478bd9Sstevel@tonic-gate uint32_t attr; /* error attributes bit field */ 1127c478bd9Sstevel@tonic-gate uint64_t ra; /* Real address */ 1137c478bd9Sstevel@tonic-gate uint32_t sz; /* Size of affected mem region */ 1147c478bd9Sstevel@tonic-gate uint16_t cpuid; /* Virtual ID of the affected CPU */ 1157c478bd9Sstevel@tonic-gate } errh_er_t; 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate typedef struct errh_async_flt { 1187c478bd9Sstevel@tonic-gate struct async_flt cmn_asyncflt; /* common fault structure */ 1197c478bd9Sstevel@tonic-gate errh_er_t errh_er; /* sun4v er record */ 1207c478bd9Sstevel@tonic-gate } errh_async_flt_t; 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate /* 1237c478bd9Sstevel@tonic-gate * Global functions 1247c478bd9Sstevel@tonic-gate */ 1257c478bd9Sstevel@tonic-gate void mem_scrub(uint64_t, uint64_t); 1267c478bd9Sstevel@tonic-gate void errh_cpu_run_bus_error_handlers(struct async_flt *, int); 1277c478bd9Sstevel@tonic-gate void error_init(void); 1287c478bd9Sstevel@tonic-gate void cpu_async_log_err(void *); 1297c478bd9Sstevel@tonic-gate void cpu_ce_log_err(struct async_flt *); 1307c478bd9Sstevel@tonic-gate void cpu_ue_log_err(struct async_flt *); 1317c478bd9Sstevel@tonic-gate void mem_sync(caddr_t, size_t); 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate #endif /* _ASM */ 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1367c478bd9Sstevel@tonic-gate } 1377c478bd9Sstevel@tonic-gate #endif 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #endif /* _ERROR_H */ 140