|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * Copyright (c) 1998-9 Apple Computer, Inc. All rights reserved.
24: *
25: * DRI: Josh de Cesare
26: *
27: */
28:
29: #include <IOKit/IOTypes.h>
30: #include <IOKit/IOLib.h>
31:
32: extern "C" {
33: #include <pexpert/pexpert.h>
34: }
35:
36: #include "AppleNMI.h"
37:
38:
39: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
40:
41: #define super IOService
42:
43: OSDefineMetaClassAndStructors(AppleNMI, IOService);
44:
45: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
46:
47: bool AppleNMI::start(IOService *provider)
48: {
49: if (!super::init()) return false;
50:
51: // Register the interrupt.
52: provider->registerInterrupt(0, this,
53: (IOInterruptAction) &AppleNMI::handleInterrupt, 0);
54: provider->enableInterrupt(0);
55:
56: return true;
57: }
58:
59: IOReturn AppleNMI::initNMI(IOInterruptController *parentController,
60: OSData *parentSource)
61: {
62: // Allocate the IOInterruptSource so this can act like a nub.
63: _interruptSources = (IOInterruptSource *)IOMalloc(sizeof(IOInterruptSource));
64: if (_interruptSources == 0) return kIOReturnNoMemory;
65: _numInterruptSources = 1;
66:
67: // Set up the IOInterruptSource to point at this.
68: _interruptSources[0].interruptController = parentController;
69: _interruptSources[0].vectorData = parentSource;
70:
71: // call start using itself as its provider.
72: if (!start(this)) return kIOReturnError;
73:
74: return kIOReturnSuccess;
75: }
76:
77: IOReturn AppleNMI::handleInterrupt(void * /*refCon*/, IOService * /*nub*/,
78: int /*source*/)
79: {
80: PE_enter_debugger("NMI");
81:
82: return kIOReturnSuccess;
83: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.