Many, or all, computer systems comprise one or more instances of executable system firmware that is useful, for example, to provide low-level interfaces to system resources. An example of such system firmware is a Basic Input/Output System (BIOS) code. In many cases, system firmware is stored in non-volatile storage, such as a read-only memory (ROM), copied to volatile memory, and executed from volatile memory.
Computer systems include operating systems that, among other functions, controls access to memory. In many systems, the operating system reserves an area of the volatile memory into which the system firmware is loaded for execution, but otherwise cannot access the area of memory reserved for the system firmware. For example, the operating system cannot perform reads or writes of the reserved area. As a result, the operating system unfortunately cannot relocate the system firmware from one area in memory to another area in the event, for example, that the memory area in which the system firmware is currently located becomes corrupted or for other reasons.
For a detailed description of exemplary embodiments of the invention, reference will now be made to the accompanying drawings in which:
Certain terms are used throughout the following description and claims to refer to particular system components. As one skilled in the art will appreciate, computer companies may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following discussion and in the claims, the terms “including” and “comprising” are used in an open-ended fashion, and thus should be interpreted to mean “including, but not limited to. . . . ” Also, the term “couple” or “couples” is intended to mean either an indirect, direct, optical or wireless electrical connection. Thus, if a first device couples to a second device, that connection may be through a direct electrical connection, through an indirect electrical connection via other devices and connections, through an optical electrical connection, or through a wireless electrical connection.
The non-volatile storage 58 comprises any suitable storage such as a hard disk drive, a compact disk read-only memory (CD ROM), etc. An operating system 60 is stored in the non-volatile storage 58 and, during an initialization (boot) process for the system 50, an instantiation of the operating system 60 is loaded into volatile memory 56. The instantiation of the operating system in volatile memory is indicated by reference numeral 62. The operating system 62 is executed from volatile memory 56 during run-time. Volatile memory 56 comprises, for example, random access memory (RAM).
The ROM 54 stores the system's firmware 64 (referred to as “system firmware”). System firmware 64 provides various functions such as power-on self-testing, an interface to various low-level functions of the system hardware, etc. In some applications, the system firmware 64 is referred to as a basic input/output system (BIOS). The system firmware 64 comprises executable code (i.e., code that is executed by processor 52). During system initialization, the processor 52 begins executing the system firmware 64 from ROM 54, but at a point during initialization, the system firmware is copied to volatile memory 56 and executed from volatile memory from that point on. The copy of system firmware in volatile memory is indicated by reference numeral 66.
Among other functions, the operating system 62 controls use of volatile memory 56. For instance, the operating system 62 allocates areas of memory for various purposes. One such allocation is for the system firmware 66. The operating system 62, during initialization, allocates an area of memory 56 into which the system firmware 66 is stored. The area of memory allocated for the system firmware 66 is not, however, accessible to the operating system 66. For example, the operating system does not and/or cannot perform read and/or write transactions to the area of memory allocated for the system firmware 66.
For any of a variety of reasons, it may be desirable to relocate the system firmware 66 from its current area to a new area. Such reasons comprise, for example, a hardware memory defect with one or more memory locations into which the system firmware 66 is stored. Because, however, the operating system 66 does not have access to the system firmware's memory area, the operating system 66 cannot directly relocate the system firmware. Relocating the system firmware is also referred to herein as migrating or copying the system firmware.
In accordance with various embodiments, the system 50 relocates the system firmware from its current area (a “first” area) to a new area (the “second” area) of memory without using, or requiring direct access (e.g., reads, writes), by the operating system. The system firmware 66 uses control logic to relocate itself. In some such embodiments, the system 50 implements the Advanced Configuration and Power Interface (ACPI) standard. ACPI generally comprises a power management specification that allows the operating system to control the amount of power distributed to various of the system's devices. According to the ACPI standard, the operating system is provided with various methods for controlling the system's hardware resources. In addition to predetermined methods, a device specific method (“_DSM”) is also provided to the operating system and can be configured by the system architect as desired. In accordance with various embodiments, the _DSM control method comprises the control logic mentioned above that is used to relocate the system firmware from one location in memory to another. The _DSM control method is part of the system firmware code itself. The operating system is provided with an interface “call” to the _DSM method and, through the call, can pass one or more values to the _DSM method.
At 106, the method comprises the operating system passing the address of the second area to the control method (e.g., _DSM). The control method receives the address of the second area at 108, and requests the size of the system firmware at 110. The size informs the control method how many bytes to copy from the first area to the second area. At 112, the control method copies the system firmware from the first area to the second area.
Copying the system firmware comprises, in at least one embodiment, making a copy of the system firmware thereby resulting in two copies of the system firmware being stored in memory 56—the original and the new copy. In some embodiments, the original is erased (e.g., overwritten with 0's) and in other embodiments, the original remains intact but not used.
In other embodiments, logic or other software (collectively “logic”), besides the operating system, can make the call into the system firmware's control method to cause the relocation of the system firmware to occur. Such logic also may not be able to access directly (e.g., reads, writes) the first and/or second areas. Also, the system firmware relocation can occur during which time the system firmware remains fully operational. In some embodiments, the operating system continues making calls to the original copy while the original copy is being relocated. Once the relocation completes and the operating system determines that all outstanding calls to the original copy of the system firmware have completed, the memory table is updated thereby causing the operating system to begin using the new copy.
In other embodiments, a “lock” is implemented for the system firmware at the beginning of the system firmware relocation process. The lock prevents the operating system from making calls to the system firmware, so that the system firmware can be relocated without interruption. Upon completion of the relocation process, the lock is released and calls can proceed using the new copy of the system firmware.
The above discussion is meant to be illustrative of the principles and various embodiments of the present invention. Numerous variations and modifications will become apparent to those skilled in the art once the above disclosure is fully appreciated. It is intended that the following claims be interpreted to embrace all such variations and modifications.