#include <uuid/uuid.h>
}
-#if !CONFIG_EMBEDDED
+#define kShutdownTimeout 30 //in secs
-/*
- * This will eventually be properly exported in
- * <rdar://problem/31181482> ER: Expose coprocessor version (T208/T290) in a kernel/kext header
- * although we'll always need to hardcode this here since we won't be able to include whatever
- * header this ends up in.
- */
-#define kCoprocessorMinVersion 0x00020000
+#if !CONFIG_EMBEDDED
boolean_t coprocessor_cross_panic_enabled = TRUE;
#endif /* !CONFIG_EMBEDDED */
OSData * busFrequency;
uint32_t debugFlags;
-#if !CONFIG_EMBEDDED
- IORegistryEntry *platform_entry = NULL;
- OSData *coprocessor_version_obj = NULL;
- uint64_t coprocessor_version = 0;
-#endif
if (!super::start(provider))
return false;
}
#if !CONFIG_EMBEDDED
- platform_entry = IORegistryEntry::fromPath(kIODeviceTreePlane ":/efi/platform");
- if (platform_entry != NULL) {
- coprocessor_version_obj = OSDynamicCast(OSData, platform_entry->getProperty("apple-coprocessor-version"));
- if ((coprocessor_version_obj != NULL) && (coprocessor_version_obj->getLength() <= sizeof(coprocessor_version))) {
- memcpy(&coprocessor_version, coprocessor_version_obj->getBytesNoCopy(), coprocessor_version_obj->getLength());
- if (coprocessor_version >= kCoprocessorMinVersion) {
- coprocessor_paniclog_flush = TRUE;
- extended_debug_log_init();
- }
- }
- platform_entry->release();
+ if (PEGetCoprocessorVersion() >= kCoprocessorVersion2) {
+ coprocessor_paniclog_flush = TRUE;
+ extended_debug_log_init();
}
-#endif /* !CONFIG_EMBEDDED */
+#endif
return( configure(provider) );
}
#else /* ! CONFIG_EMBEDDED */
int type = (int)(long)p0;
+ uint32_t timeout = (uint32_t)(uintptr_t)p1;
+
+ IOPMrootDomain *pmRootDomain = IOService::getPMRootDomain();
+ if (pmRootDomain) {
+ if ((PEGetCoprocessorVersion() >= kCoprocessorVersion2) || pmRootDomain->checkShutdownTimeout()) {
+ pmRootDomain->panicWithShutdownLog(timeout * 1000);
+ }
+ }
/* 30 seconds has elapsed - resume shutdown */
if(gIOPlatform) gIOPlatform->haltRestart(type);
thread_call_t shutdown_hang;
IORegistryEntry *node;
OSData *data;
- uint32_t timeout = 30;
+ uint32_t timeout = kShutdownTimeout;
static boolean_t panic_begin_called = FALSE;
if(type == kPEHaltCPU || type == kPERestartCPU || type == kPEUPSDelayHaltCPU)
shutdown_hang = thread_call_allocate( &IOShutdownNotificationsTimedOut,
(thread_call_param_t)(uintptr_t) type);
clock_interval_to_deadline( timeout, kSecondScale, &deadline );
- thread_call_enter1_delayed( shutdown_hang, 0, deadline );
+ thread_call_enter1_delayed( shutdown_hang, (thread_call_param_t)(uintptr_t)timeout, deadline );
pmRootDomain->handlePlatformHaltRestart(type);
/* This notification should have few clients who all do
else return 0;
}
-void PESavePanicInfoAction(void *buffer, size_t length)
+void PESavePanicInfoAction(void *buffer, UInt32 offset, UInt32 length)
{
- IOCPURunPlatformPanicSyncAction(buffer, length);
+ IOCPURunPlatformPanicSyncAction(buffer, offset, length);
return;
}
gIOPlatform->setUTCTimeOfDay(secs, usecs * NSEC_PER_USEC);
}
+coprocessor_type_t PEGetCoprocessorVersion( void )
+{
+ coprocessor_type_t coprocessor_version = kCoprocessorVersionNone;
+#if !CONFIG_EMBEDDED
+ IORegistryEntry *platform_entry = NULL;
+ OSData *coprocessor_version_obj = NULL;
+
+ platform_entry = IORegistryEntry::fromPath(kIODeviceTreePlane ":/efi/platform");
+ if (platform_entry != NULL) {
+ coprocessor_version_obj = OSDynamicCast(OSData, platform_entry->getProperty("apple-coprocessor-version"));
+ if ((coprocessor_version_obj != NULL) && (coprocessor_version_obj->getLength() <= sizeof(uint64_t))) {
+ memcpy(&coprocessor_version, coprocessor_version_obj->getBytesNoCopy(), coprocessor_version_obj->getLength());
+ }
+ platform_entry->release();
+ }
+#endif
+ return coprocessor_version;
+}
+
} /* extern "C" */
void IOPlatformExpert::registerNVRAMController(IONVRAMController * caller)
data = OSDynamicCast( OSData, entry->getProperty( "EffectiveProductionStatus" ) );
if ( data && ( data->getLength( ) == sizeof( UInt8 ) ) ) {
UInt8 *isProdFused = (UInt8 *) data->getBytesNoCopy( );
- if ( *isProdFused ) {
+ UInt32 debug_flags = 0;
+ if ( *isProdFused || ( PE_i_can_has_debugger(&debug_flags) &&
+ ( debug_flags & DB_DISABLE_CROSS_PANIC ) ) ) {
coprocessor_cross_panic_enabled = FALSE;
}
}