Abstract:
An emulation methodology utilizes increasing microprocessor performance characteristics and System Management Mode (&#34;SMM&#34;) to emulate peripheral device functions in a computer system. The emulation methodology traps addresses associated with I/O between a CPU and one or more peripheral devices. After trapping the I/O instruction address, a system management interrupt issues, and the computer system enters the operating system independent SMM. The CPU executes SMM code which proceeds to pass instructions to the CPU which result in the complete or partial emulation of a peripheral device. When the peripheral device is completely emulated, it can be replaced, for example, with a less expensive, less functional component or possibly even eliminated without substitution. The emulation methodology also responds to asynchronous peripheral device user activity by again trapping an I/O instruction to the peripheral device, and using SMM code to emulate the peripheral device.

Description:
FIELD OF THE INVENTION 
     This invention relates in general to computer systems and, more particularly, to an apparatus and method for eliminating one or more peripheral device functions independent of an operating system. 
     BACKGROUND OF THE INVENTION 
     Personal computer (&#34;PC&#34;) systems in general and IBM compatible PC systems in particular have attained widespread use. These PC systems handle information and primarily give independent computing power to a single user (or to a relatively small group of users in the case of a PC network). Such PC systems are generally inexpensively priced for purchase by individuals or businesses and provide computing power to many segments of today&#39;s society. 
     A PC system can usually be defined as a desktop, floor-standing, or portable microcomputer that includes a system unit having a central processing unit (&#34;CPU&#34;) which is typically associated with devices such as volatile and non-volatile memory, a display monitor, a keyboard, one or more floppy diskette drives, a hard disk storage device, an optional CD-ROM drive, and an optional printer. A PC system may also include one or a plurality of I/O devices (i.e. peripheral devices) coupled to the system processor to perform specialized functions. Examples of I/O devices include keyboard interfaces with keyboard controllers, floppy diskette drive controllers, modems, sound and video devices, and specialized communication devices. These I/O devices are typically plugged into I/O interfaces of the computer system such as serial interfaces and parallel interfaces. Generally, these PC systems use a system board or motherboard to electrically interconnect these devices. 
     PC systems also typically include basic input/output system (&#34;BIOS&#34;) system programs to ease programmer/user interaction with the PC system devices. More specifically, BIOS provides a software interface between the system hardware and the operating system/application program. The operating system (&#34;OS&#34;) and application code typically access BIOS rather than directly manipulating I/O ports, registers, and control words of the specific system hardware. Well known device drivers and interrupt handlers access BIOS to, for example, facilitate I/O data transfer between peripheral devices and the OS, application code, and data storage elements. BIOS is accessed through an interface of software interrupts and contains a plurality of entry points corresponding respectively to the different interrupts. In operation, BIOS is typically loaded from a BIOS ROM, which is nonvolatile, to main memory from which it is executed. This practice is referred to as &#34;shadowing&#34; or &#34;shadow RAM&#34; and increases the speed at which BIOS executes. 
     The CPU provides the &#34;kernel&#34; of the PC system, and I/O communication between an I/O device and the CPU forms a basic feature of PC systems. Many I/O devices include specialized hardware working in conjunction with OS specific device drivers and BIOS routines to perform functions such as data transfer between the I/O device and the CPU. 
     Referring to FIG. 1, an exemplary I/O device, keyboard user interface 100, is illustrated which allows a user to submit data through keyboard 102 to a PC system having keyboard interface 108. A user enters data by selecting characters arranged on keyboard 102, and scan codes representing a position of the selected characters are transferred via keyboard cable 104 to keyboard controller 106 of keyboard interface 108. Upon receiving a character scan code, keyboard controller 106 causes interrupt request logic 110 to issue a hardware interrupt to the PC system CPU (not shown) over interrupt request line 112 via bus 114. Interrupt request line 112 is usually designated IRQ1 in IBM™ compatible PC systems. 
     FIG. 2 illustrates a well-known embodiment of keyboard user interface 100. Keyboard 202, which may be, for example, an IBM™ brand PC/AT™ or PS/2™, includes a scan matrix 204 having an X-Y line intersection which is activated by a selected switch or key. (IBM™, PC/AT™, and PS/2™ are trademarks of International Business Machines Corp.). A keyboard processor 206, such as an ANY KEY ROLLOVER ASIC chip, checks the status of the scan matrix with X and Y line decoders 208 and 210, respectively, to determine an open or closed state of the switch(es) by, for example, successively and individually activating X lines 209 to detect a Y line(s) 211 signal reception or signal termination. In this manner, the keyboard processor 206 identifies selected and deselected switches. The keyboard processor 206 writes a scan code, usually in the form of a well-known serial data unit, corresponding to the identified switch into a keyboard internal buffer 212 and transmits the scan code via keyboard cable 214 to an input port 215 of keyboard controller 218 typically using a well-known serial data unit. 
     The keyboard interface 216 generally includes a serial interface and interrupt logic for the PC/XT™ (not shown) or includes a PC/AT™ keyboard controller 218, such as an Intel™ 8042, 8051, 8741, or 8742 and interrupt logic 220. (PC/XT™ is a trademark of International Business Machines Corp., and Intel™ is a trademark of the Intel Corp.). The keyboard controller 218 reads the scan codes in input port 215 and transfers the contents of input port 215 to keyboard controller output buffer 222. Next, interrupt logic 220 issues a hardware interrupt, for example, via Interrupt Request Line IRQ1 to a PC system CPU (not shown) via bus 224. 
     Control and monitoring of the PC system hardware is generally the responsibility of the OS which mainly uses device drivers to access PC system hardware. In response to the issued interrupt, the CPU saves the current CPU status, for example, current flags, code segment register, and instruction pointer (&#34;EIP&#34;), and enters a keyboard device driver interrupt handler. The interrupt handler retrieves the scan code from the keyboard controller output buffer 222 which is assigned a specific address, usually 60h (where the &#34;h&#34; suffix indicates a hexadecimal value). The keyboard driver then generally uses an internal conversion table to convert the scan code to an ASCII code, if an ASCII character code is available, or carries out certain predefined, well-known functions. The keyboard driver stores the codes in a keyboard buffer such as a BIOS data area. The stored codes are passed to a program which acts on them accordingly. 
     In addition to reading data from the keyboard processor 206, the keyboard controller 218, responding to well-known routines and controller commands from the CPU, can provide bidirectional information transfer between the CPU and the keyboard 202. Keyboard controller 218 may, for example, receive control commands for keyboard 202 via input buffer 225, typically at address 60h, through which the keyboard 202 may be enabled reset, key repetition rates and delays adjusted, keyboard data transfer path and command logic checked, and scan code sets selected. 
     The OS can also communicate and exert control over keyboard controller 218. The current state of the keyboard controller 218 can be determined by reading status register 226, typically at address 64h. Various well-known commands can be written to control register 228, which is also typically assigned address 64h. An exemplary command is a write output port command which allows an executing program to write to output port 230. 
     In Intel™ X86 and Pentium™ CPUs and compatibles, allowing a program to write to output port 230 also allows the program to execute a CPU reset. Output port 230 is typically a one byte register with a least significant bit being a processor reset bit, SYSR, which is coupled to the CPU RESET pin. To reset the CPU, the executing program instructs the keyboard controller 218, via command FEh written to control register 228, to accept a write output port command. The executing program then writes to output port 230 data that sets the SYSR bit, and the signal on SYSR causes the CPU to reset in a well-known manner. 
     Input port 215 and output port 230 of keyboard controller 218 may not only establish a connection between keyboard 202 and the CPU, but may also establish a connection to an auxiliary device 232 such as a mouse, gate chips, or other devices. Connection to the auxiliary device 232 is established by writing to the control register 228 the command write auxiliary device, and the next byte written to input buffer 225 is transferred to auxiliary device 232. Connection from the auxiliary device 232 is established by reading data transferred from auxiliary device 232 to output buffer 222. Output buffer 222 is read following an issued interrupt by using an appropriate auxiliary device driver. 
     Although a keyboard controller can provide usefil functions, there are several disadvantages of keyboard controllers which additionally can apply to other I/O devices. Physical space within a PC system is often limited especially in portable PC systems such as notebook computer systems, and keyboard controllers occupy physical space that could be used by other hardware. Additionally, connectability may also be at a premium given the increasing number of I/O devices demanding access to PC system buses. Furthermore, power consumption by I/O devices can contribute to a shortening of useful battery life in addition to increasing the power demand on a power supply. Moreover, cost competition in the PC industry can be intense and I/O devices contribute a noticeable amount to the overall cost of a PC system. Also, upgrading I/O device functions typically require complete replacement of the hardware. 
     Additionally, typically each OS includes a specific driver written to process data transfer between I/O devices and other PC system components such as the CPU. Elimination, modification, or substitution of hardware components, such as an I/O device, may require modifying the operating system(s) and/or all OS device drivers for each eliminated, modified, or substituted hardware component. 
     SUMMARY OF THE INVENTION 
     Specific functionality is often implemented in hardware in an effort to improve processing speed and efficiency. However, the present invention takes advantage of increasing CPU performance to emulate a variety of hardware functionality by implementing the functionality in software. By eliminating, in whole or in part, various hardware functions and replacing them with routines executed by a CPU, significant advantages of space, cost, maintainability, upgradeability, and power consumption may be achieved. The present invention takes advantage of a particular CPU operating mode, referred to as system management mode, and I/O trapping to emulate not only hardware functionality but also the hardware interface. The present invention may eliminate the need for operating system specific device drivers for hardware manipulation when a hardware component is completely emulated. Moreover, the present invention operates independently of any operating system. 
     In one embodiment of the present invention, a method of operating a computer system includes a memory coupled to a central processing unit, includes the steps of providing a peripheral device function request from the memory to the central processing unit, attempting to access a peripheral device address associated with the peripheral device function request, trapping the peripheral device address and associated function request, and providing instructions from the memory to the central processing unit to emulate the requested peripheral device function. 
     In another embodiment of the present invention, a computer system includes a memory having a program stored therein, an I/O device for entering data into the computer system, a processor, coupled to the memory, for executing instructions in an instruction stream provided to the processor from the memory, an I/O trap coupled to the processor to trap addresses within an address range, and a system management mode (SMM) code having an emulation module for examining the instruction associated with the trapped address and for emulating I/O device response to the instruction. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The same feature appearing in multiple figures has the same reference numeral. 
     FIG. 1, labeled prior art, is a keyboard user interface. 
     FIG. 2, labeled prior art, is one embodiment of the keyboard user interface of FIG. 1. 
     FIG. 3 is a block diagram of the disclosed PC system. 
     FIG. 3A one embodiment of a hardware keyboard interface of the PC system of FIG. 3. 
     FIG. 4 is a representation of the main memory of the computer system of FIG. 3. 
     FIG. 5 is a flow chart depicting the process flow of the keyboard controller emulation methodology employed in the computer system of FIG. 3. 
    
    
     DETAILED DESCRIPTION 
     The following description of the invention is intended to be illustrative only and not limiting. 
     In the following description, italicized words or phrases represent executable pseudocode. 
     Although functionality of a conventional keyboard controller has been described in some detail above, complete keyboard controller functionality and other I/O device functionality is well-known to those of ordinary skill in the art. The functionality described above is intended only to enhance understanding of the PC computer system 300 emulation methodology and not to limit the emulation methodology to explicitly described peripheral device function requests. 
     PC system 300 includes a microprocessor (&#34;CPU&#34;) 305, for example, an Intel™ Pentium class microprocessor or Intel™ 80486 class microprocessor, having a processor 310 for handling integer operations and a coprocessor 315 for handling floating point operations. CPU 305 is coupled to cache 329 and memory controller 330 via CPU bus 391. System controller I/O trap 392 couples CPU bus 391 to local bus 320 and is generally characterized as part of a system controller such as a Pico Power Vesuvious or an Intel™ Mobile Triton chip set. System controller I/O trap 392 can be programmed in a well-known manner to intercept a particular target address or address range, and, upon intercepting a target address, system controller I/O trap 392 asserts an intercept signal indicating that CPU 305 attempted to access the target address. In the emulation methodology embodiment of FIG. 5, the intercept signal is coupled to an SM (&#34;system management interrupt&#34;) pin of CPU 305 to cause CPU 305 to enter system management mode (&#34;SMM&#34;). 
     A main memory 325 of dynamic random access memory (&#34;DRAM&#34;) modules is coupled to CPU bus 391 by memory controller 330. Main memory 325 includes a system management mode memory area which is employed to store keyboard controller emulation code as will be discussed in more detail subsequently. 
     A Basic Input Output System (&#34;BIOS&#34;) memory 324 is coupled to local bus 320. A FLASH memory or other nonvolatile memory is used as BIOS memory 324. BIOS memory 324 stores the system code which controls some PC system 300 operations as discussed above. 
     A graphics controller 335 is coupled to local bus 320 and to a panel display screen 340. Graphics controller 335 is also coupled to a video memory 345 which stores information to be displayed on panel display 340. Panel display 340 is typically an active matrix or passive matrix liquid crystal display (&#34;LCD&#34;) although other display technologies may be used as well. Graphics controller 335 can also be coupled to an optional external display or standalone monitor display 356 as shown in FIG. 3. One graphics controller that can be employed as graphics controller 335 is the Cirrus Logic GD7542 graphics controller. 
     A bus interface controller or expansion bus controller 358 couples local bus 320 to an expansion bus 360. In this particular embodiment, expansion bus 360 is an Industry Standard Architecture (&#34;ISA&#34;) bus although other buses, for example, a Peripheral Component Interconnect (&#34;PCI&#34;) bus, could also be used. A personal computer memory card international association (&#34;PCMCIA&#34;) controller 365 is also coupled to expansion bus 360 as shown. PCMCIA controller 365 is coupled to a plurality of expansion slots 370 to receive PCMCIA expansion cards such as modems, fax cards, communications cards, and other input/output devices. 
     An I/O controller 375 often referred to as a super I/O controller is coupled to ISA bus 360. I/O controller 375 interfaces to both an integrated drive electronics (&#34;IDE&#34;) hard drive 380 and a floppy drive 385. I/O controller 375 also provides a serial interface 390 and a parallel interface 395 to which peripheral devices can be coupled. 
     PC system 300 includes a power supply 364, for example, a battery, which provides power to the many devices which form PC system 300. Power supply 364 is typically a rechargeable battery, such as a nickel metal hydride (&#34;NiMH&#34;) or lithium ion battery, when PC system 300 is embodied as a portable or notebook computer. Power supply 364 is coupled to a power management microcontroller 308 which controls the distribution of power from power supply 364. More specifically, microcontroller 308 includes a power output 309 coupled to the main power plane 314 which supplies power to CPU 305. Power microcontroller 308 is also coupled to a power plane (not shown) which supplies power to panel display 340. In this particular embodiment, power control microcontroller 308 is a Motorola 6805 microcontroller. Microcontroller 308 monitors the charge level of power supply 364 to determine when to charge and when not to charge battery 364. Microcontroller 308 is coupled to a main power switch 312 which the user actuates to turn the PC system 300 on and off While microcontroller 308 powers down other portions of PC system 300 such as hard drive 380 when not in use to conserve power, microcontroller 308 itself is always coupled to a source of energy, namely power supply 364. 
     Power management microcontroller 308 is also coupled to a keyboard interface 302 which is coupled to ISA bus 320. A keyboard 322 and auxiliary device 327, for example, a mouse, gate chips, or other devices, are coupled to keyboard interface 302 provide PC system 300, for example, with user input. 
     In a portable embodiment, PC system 300 also includes a screen lid switch 306 or indicator 306 which provides an indication of when panel display 340 is in the open position and an indication of when panel display 340 is in the closed position. It is noted that panel display 340 is generally located in the same location in the lid of the computer as is typical for &#34;clamshell&#34; types of portable computers such as laptop or notebook computers. In this manner, the display screen forms an integral part of the lid of the computer which swings from an open position for interaction with the user to a close position. 
     PC system 300 also includes a power management chip set 338 which includes power management chip models PT86C521 and PT86C522 manufactured by Pico Power. Power management chip set 338 is coupled to CPU 305 via local bus 320 so that power management chip set 338 can receive power control commands from CPU 305. Power management chip set 338 is connected to a plurality of individual power planes which supply power to respective devices in PC system 300 such as hard drive 380 and floppy drive 385, for example. In this manner, power management chip set 338 acts under the direction of CPU 305 to control the power to the various power planes and devices of the computer. A real time clock (&#34;RTC&#34;) 340 is coupled to I/O controller 375 and power management chip set 338 such that time events or alarms can be transmitted to power management chip set 338. Real time clock 340 can be programmed to generate an alarm signal at a predetermined time. 
     As described in more detail below, some or all of the functionality of a conventional keyboard controller is transferred to an emulation methodology using code in SMM memory 326 executed by CPU 305. If all keyboard controller functionality is transferred to the emulation methodology, the keyboard controller of keyboard interface 302 may be eliminated. As a result of eliminating the keyboard controller, keyboard interface 302 may have a simpler implementation as illustrated in FIG. 3A that includes a first in first out (&#34;FIFO&#34;) buffer or that includes a conventional serial interface. Alternatively, keyboard interface 302 may include a keyboard controller such as keyboard controller 218, and keyboard controller emulation may be limited to specific functions as described in more detail below. 
     Referring to FIG. 3A, one embodiment of a PC system 300 hardware keyboard interface 302 is illustrated. The FIFO buffer 304 of keyboard interface 302 generally has only one address and transfers data to CPU 305 through bus 360 and intervening PC system 300 components 399. FIFO buffer 304 may receive information from CPU 305 for transmission to keyboard 322 and may receive information from keyboard 322 for transmission to CPU 305. When FIFO buffer 304 receives information from keyboard 322, interrupt logic 303 issues an interrupt request to CPU 305. When FIFO buffer 304 receives information from CPU 305, FIFO buffer 304 transmits the information to keyboard 322. Subsequent processes for both events will be described below in conjunction with FIG. 5. An alternative embodiment of keyboard interface 302 utilizes a conventional serial interface having well-known characteristics. Implementing PC system 300 with keyboard interface 302 typically provides substantial cost savings over a PC system implemented with a conventional keyboard interface having a keyboard controller. 
     When PC system 300 is turned on or powered up, the system BIOS software stored in non-volatile BIOS memory 324 is copied into main memory 325 so that it can be executed more quickly. This technique is referred to as &#34;shadowing&#34; or &#34;shadow RAM&#34; as discussed above. At this time, SMM code 450 is also copied into the system management mode memory area 326 of main memory 325. CPU 305 executes SMM code 450 after CPU 305 receives a system management interrupt (&#34;SMI&#34;) which causes the microprocessor to enter SMM. Additional conditions under which an SMI is generated are discussed subsequently. It is noted that along with SMM code 450, also stored in BIOS memory 324 and copied into main memory 325 at power up are system BIOS 355 (including a power on self test (POST) and video BIOS 361. It will be recognized by those of ordinary skill in the art that other memory mapping schemes may be used. For example, SMM code 450 may be stored in fast SRAM memory coupled to CPU 305. 
     Referring to FIG. 4, a diagram of main memory 325 illustrates SMM code 450 storage in system management mode memory area 326 after being loaded into main memory 325. In this particular embodiment, SMM memory area 326 resides between main memory addresses 3000:0000h and 3000:FFFFh. Although SMM memory area 326 includes only 64 Kbytes, microprocessors such as the Pentium™ microprocessor can also access data outside system management mode memory area 326. Also loaded in main memory 325 at power up is an interrupt vector table 465 which is part of the system BIOS and directs the CPU 305 to particular interrupt handlers. Main memory also includes drivers 470. Memory areas not otherwise designated in main memory 325 of FIG. 4 are available for the operating system and user application codes. 
     Referring to FIG. 5, with the system BIOS 355 thus copied into main memory 325, the POST module of BIOS executes to commence initialization of PC system 300 as block 502 indicates. The POST routine includes verification of system hardware functionality such as hard disk drive 380, processor 305 registers, floppy disk drive 385, and the keyboard controller of keyboard interface 302. The POST routine can be considered as executing in block 512 and an attempted access to a keyboard controller results in a departure to block 516 with full emulation of a keyboard controller utilizing SMM code 450 in a process described more fully below. At block 504, BIOS issues an SMI which causes CPU 305, in a well-known manner, to store current register values necessary to restore the original condition in main memory 325, initialize CPU 305 registers for SMM, and enter SMM as per block 504. Upon entering system management mode, I/O trapping of addresses within the range of addresses assigned to keyboard interface 302 is initiated and commences as per block 506. This I/O trapping is implemented as discussed above by programming system controller I/O trap 392 to intercept I/O activity involving an address within an address range, such as 60h-6Fh, associated with a keyboard controller. One implementation embodiment of block 506 uses SMM code to program system controller I/O trap 392 to intercept an attempted access by CPU 305 to address range 60h-6Fh. When system controller I/O trap 392 intercepts a target address, the I/O trap output signal line connected to the SMI pin of CPU 305 is activated causing CPU 305 to enter SMM as discussed above. 
     Once I/O trapping has started, SMM is exited as per block 508 with an explicit resume from system management mode instruction such as RSM. The operating system and applications software are now loaded as per block 510. Execution of the operating system and applications software code commences at block 512. 
     With I/O trapping commenced, system controller I/O trap 392 traps all I/O addresses within a predetermined range that propagate between local bus 320 and CPU bus 391 as indicated in decision block 514. If the I/O address does not fall within the predetermined address range, the application code and OS continue executing. In this embodiment, system controller I/O trap 392 conducts a test to determine if an application code attempted to output information to keyboard controller address range of 60h-6Fh. This determination can be made, for example, by examining any I/O to the device instruction and comparing the associated instruction destination address with 60h-6Fh. If the intercepted address is within the range previously determined and subsequently programmed by SMM code into system controller I/O trap 392, system controller I/O trap 392 traps the destination address and issues an SMI activation signal on the SMI pin of CPU 305. With the SMI issue, a system management interrupt occurs as indicated in block 516, and CPU 305 stores its current registers, including the current code segment (&#34;CS&#34;) and extended instruction pointer (&#34;EIP&#34;) registers, and begins executing SMM code in system management memory 326 (FIG. 3). 
     Referring to block 518, the SMM code 450 reads data stored in keyboard interface 302, if a user has entered data into keyboard interface 302, for example, through keyboard 322. If data has been stored in keyboard interface 302, generally indicating that the SMI in block 516 resulted from keyboard interface 302 interrupt request described below, SMM code 450 issues instructions to CPU 305 to retrieve the data and store it in a reserved area of SMM memory 326 (FIG. 3) referred to herein as an &#34;SMM keystroke data buffer&#34;. 
     Emulation methodology 500 next determines whether or not the I/O instruction to the trapped range from the application code was a write or read instruction to the trapped range as indicated in decision block 520. In one embodiment, SMM code 450 uses the contents of the EIP register to examine the instruction that caused the SMI to issue. If SMM code 450 determines that the instruction requested a write operation (output to I/O device), SMM code 450 requests CPU 305 to read the contents of register AL to determine the I/O data content which was to be output to a keyboard controller as indicated in block 522. In popular Intel™ CPUs and compatibles, register EAX contains the data intended to be output to I/O devices or input from I/O devices. In one embodiment, data written to a keyboard controller is only one byte wide and is contained in the least significant byte of register EAX, register AL. Therefore, only register AL need be read by SMM code 450 in this embodiment. However, in other embodiments, EAX may be read wholly or partially as necessary according to the width of the data content transferred between an I/O device and a CPU. 
     After reading the contents of AL, SMM code 450 uses the data in register AL as a function code requested by the application code, and SMM code 450 proceeds as indicated in block 524 to perform the function requested using the processing capabilities of CPU 305. Depending on the function requested, SMM code 450 may have requested data retrieval from FIFO 304. If so, the data from the emulated function is stored in an area of SMM memory 326 (FIG. 3) herein referred to as a &#34;keyboard controller emulated data location&#34;. In one example, if the application attempts to set the gate for A20 bit of a keyboard controller output port, SMM code 450 reads the contents of AL and determines that a processor reset function is requested. In response, the SMM code 450 issues an output 02h to base address 092h resets A20 line instruction to perform the A20 line reset. 
     After performing the function requested by the application, the saved contents of register EIP are advanced according to the length of the requested operation, as indicated in block 526, so that CPU 305 executes the next application code instruction once emulation methodology returns to block 512. A resume from system management mode instruction is executed to exit SMM as indicated in block 528. Emulation methodology 500 then repeats from block 512. 
     Referring again to block 520, if SMM code 450 determines that application code instruction requested a read (input from I/O device) operation to a keyboard controller address range, SMM code 450 determines whether or not function data is available which was saved in the &#34;keyboard controller emulated data location&#34; as indicated in block 530. If data from an emulated function is available, the function data stored in block 524 is retrieved as indicated in block 532 and stored in register AL as indicated in block 534. Emulation methodology 500 then proceeds with the process in block 526 as described above. If in block 530, no data from an emulated function is available, indicating the SMI was generated as a result of the keyboard interface 302 interrupt request described below, the keystroke data stored in the SMM keystroke data buffer is retrieved as indicated in block 536 and stored in register AL as indicated in block 534. Emulation methodology 500 then proceeds with the process in block 526 as described above. 
     The following operational example describes emulation of an attempt by application code to read data from a keyboard controller input port. The application will pass a write to I/O port instruction, for example, OUT 64h, C0h , to CPU 305. CPU 305 writes the address 64h and function code C0h on CPU bus 391 as indicated in block 512. System controller I/O trap 392 traps the address 64h, as indicated in block 514, and issues an SMI as indicated in block 516. No keystroke data is available, and the emulation process proceeds to block 520. SMM code 450 examines the instruction pointed to by register EIP and determines that a write instruction has been executed as indicated in block 522. SMM code 450 reads the function code C0h which has been stored in AL by the OUT instruction and then responds by creating an emulation response that emulates a conventional keyboard interface response as indicated in block 524. The emulation response reflects the emulated action. The created data is stored in the keyboard controller emulated data location and the emulation process proceeds to blocks 526, 528, and 512. 
     Continuing, the application will pass a readfrom I/O port instruction, for example, IN al, 64h, to CPU 305. CPU 305 writes the address 64h and instruction on CPU bus 391 as indicated in block 512. System controller I/O trap 392 traps the address 64h, as indicated in block 514, and issues an SMI as indicated in block 516. No keystroke data is available, and the emulation process proceeds to block 520. SMM code 450 examines the instruction pointed to by register EIP and determines that a read status register instruction has been executed as indicated in block 520. SMM code 450 then proceeds to block 530 and retrieves function data stored in SMM memory 326 (FIG. 3) as indicated in block 332, that emulates data available from a keyboard status register indicating data contents in a keyboard controller output buffer. SMM code 450 stores the emulated function data in register AL as indicated in block 534, and the emulation process proceeds to blocks 526, 528, and 512. 
     Continuing, the application will pass another readfrom I/O port instruction, for example, IN al, 60h, to CPU 305. CPU 305 writes the address 60h and instruction on CPU bus 391 as indicated in block 512. System controller I/O trap 392 traps the address 60h, as indicated in block 514, and issues an SMI as indicated in block 516. No keystroke data is available, and the emulation process proceeds to block 520. SMM code 450 examines the instruction pointed to by register EIP and determines that a read instruction has been executed as indicated in block 520. SMM code 450 proceeds to block 530 and determines that data from the emulated function C0h is available in the keyboard controller emulated data location. SMM code 450 then retrieves the emulated function data from the keyboard controller emulated data location, as indicated in block 532, and stores the emulated function data in register AL as indicated in block 534. The emulation process proceeds to blocks 526, 528, and 512. 
     While the CPU 305 is, for example, executing application code or performing other tasks, asynchronous user activity involving an I/O device may independently commence. An example of asynchronous user activity commencement is indicated in block 540. A user may use keystrokes to enter data into PC system 300 through keyboard 322 as indicated in block 540. Keyboard 322 may be, for example, similar or identical to keyboard 202 (FIG. 2). After FIFO receives the data, interrupt logic 303 in keyboard interface 302 issues an interrupt request to processor 305. CPU 305 services the interrupt request by entering a conventional keyboard interrupt handler routine of a keyboard driver as indicated in block 542. The keyboard interrupt handler routine provides a read I/O instruction to CPU 305 which requests access to an address within the keyboard controller address range being trapped by system controller I/O trap 392. At this point as indicated by block 546, an SMI occurs as in block 516 and the emulation methodology 500 proceeds as described above from block 518. After exiting SMM as indicated in block 528, the interrupt handler routine resumes execution at block 548 and stores the keystroke data, previously saved in register AL as indicated in block 534 into an OS keyboard buffer. The interrupt handler then exits as indicated in block 550, and execution of the OS code in block 512 proceeds. 
     As described, emulation methodology 500 includes SMM code 450 which utilizes CPU 305 to emulate requested functions and data transfer conventionally undertaken with assistance from a keyboard controller. Although emulation of the processor reset function has been described, it will be appreciated by one of ordinary skill in the art after reading this application that most, if not all, functions conventionally performed by keyboard controller may be emulated using SMM code and a microprocessor such as CPU 305. Furthermore, SMM code 450 can also utilize CPU 305 to emulate only a portion of the keyboard controller functionality by analyzing the function requested and returning control to a conventional keyboard driver if the function is not identified as a function to be emulated. For example, If keyboard controller functionality is only partially emulated, keyboard interface 302 may include a conventional keyboard controller or include a keyboard controller having non-emulated functionality. Additionally, SMM executes independent of the PC system 300 operating system(s), and generally no modifications to the OS are required. 
     While the invention has been described with respect to the embodiments and variations set forth above, these embodiments and variations are illustrative and the invention is not to be considered limited in scope to these embodiments and variations. For example, although one embodiment of an I/O device emulation methodology is illustrated in FIG. 5, other I/O devices may be wholly or partially emulated in addition to or as an alternative to exemplary emulation methodology 500 by I/O trapping instructions addressed to emulated I/O devices and performing the trapped instructions using appropriate SMM code and CPU processing capabilities. Knowledge of specific I/O device instructions and hardware requirements is well-known in the art. Also, although keyboard interface information is generally transferred one byte at a time using register AL, information transferred between other I/O devices or other keyboard interfaces and a CPU may be transferred using more than one byte. As a result, references to register AL may be substituted with references to AX, EAX, or other registers and variations thereof to accommodate the increased bandwidth. Although, a CPU is referred to herein, other processors including multiprocessing systems may be used. Accordingly, various other embodiments and modifications and improvements not described herein may be within the spirit and scope of the present invention, as defmed by the following claims.