Recently, I was reading BIOS related content and came up with an EC concept. I searched for related content online and sorted out the relationship between bios and EC.
The position of BIOS (Basic Input/Output System) in the entire system is very important. It implements a bridge between the underlying hardware and the upper operating system. For example, if you copy a file from a CD to a hard disk, you only need to know the "copy and paste" command. You do not have to know how to read the file from the CD, then how to write data to the hard disk. For the operating system, you only need to send instructions to the bios, instead of knowing how the disc is read and how the hard disk is written. BiOS builds a bridge between the operating system and underlying hardware. The BIOS settings we usually talk about are just about the software settings, such as setting the startup sequence and disabling/enabling some features. But here is a question: how does the BIOS work on the hardware? After all, is the software running on the hardware platform? Here we cannot mention EC.
EC (embed controller, embedded controller) is a 16-bit single-chip microcomputer. It also has a certain amount of flash to store EC code. The position of EC in the system is never the north-south bridge. When the system is started, EC controls the sequence of most important signals. In the notebook, the EC is always on, whether you are on or off, unless you completely remove the battery and adapter. When the instance is shut down, the EC keeps running and waits for the user's boot information. After power-on, EC is also used as the keyboard controller, charging indicator light, Fan and other indicators and other equipment control, it even controls the system's standby, sleep and other States. Mainstream laptop Systems
Now the EC has two kinds of architecture, more traditional, that is, BIOS flash through X-BUS to EC, then EC through LPC to connect to the south bridge, in general this case, EC code is also placed in flash, that is, share a flash with BIOS. On the right is a relatively new architecture. EC and Flash are connected to the LPC bus. Generally, they only use the ROM inside the EC. As for the LPC bus, it was Intel's bus standard to replace low-speed and backward X-BUS. The EC generally contains a keyboard controller, so it is also called KBC. So what is the significance of EC and BIOS in the system? Here we will analyze it briefly. When the system is shut down, only the RTC part and the EC part are running. The RTC part maintains the computer clock and CMOS settings, while the EC is waiting for the user to press the on key. After detecting that the user presses the power-on key, the EC will notify the entire system to turn on the power. After the CPU is reset, it will read the commands in a specific address in the BIOS (actually a jump command, this address is set by the CPU hardware ). There are two cases: 1
The address sent by the CPU goes through the FSB to the North Bridge, then through the hub-link to the south bridge, through the LPC to the EC, and then through the X-BUS to the BIOS. After the CPU reads the instruction in the sent address, it executes the first instruction after it is reset. In this system, EC bridges the bios and the south bridge (or the entire system). After the IP address sent by the CPU is sent to the South Bridge, it is directly sent to the BIOS through the LPC, no EC bridging is required.
It should be noted that EC is generally not required for desktops. There are many reasons: for example, the ATX power supply of the desktop has certain intelligent functions, and he can be controlled by the operating system to realize the standby and sleep status; secondly, because the keyboard of the notebook cannot be directly connected to the PS/2 interface, it must be connected to the EC. In addition, the notebook has more small functions, for example, the charging indicator light, WiFi indicator light, FN, and many other special functions, and the notebook must support battery charging and discharging functions, while intelligent charging and discharging requires EC support. In addition, the switch sequence of the notebook TFT screen must also be controlled by EC. These causes lead to the necessity of using EC for internal management in the notebook.
In general, EC and BIOs are both at the very bottom of the machine. EC is a separate processor that manages the entire system globally before and during startup. The BIOS starts running only after the EC initializes the internal physical environment.
Here, I think everyone understands that EC is really holy. If the BIOS is an underlying system, the EC seems to be more underlying.
There is also a function block on the south bridge, namely the Power Management Unit (PM, power management). Generally, it works with EC. All functions including START, standby, sleep, and shutdown after the host key is pressed. It also controls the brightness and sound of backlights. As for Intel's speed step technology, some of its features are implemented through nanqiao (nanqiao sends the SLP, stpclk (sleep, stop clock) to achieve sleep and sleep ).
This part of the design is relatively simple, just point-to-point connection to the south bridge and the CPU.
Logical boot process:
The boot process is crucial for computer design. If the timing of the power supply is correct when the PCB is started on the laptop for the first time, other problems can be solved (generally, the machine can be enabled if the timing is correct ). The most feared is that the power supply timing is wrong and the machine cannot be turned on. This is the most terrible thing. There are several kinds of voltages in The Notebook, first RTC power supply, which will never be turned off unless the battery (button battery) no power and no external power supply (such as battery and power adapter ). RTC is used to keep the clock inside the machine running and ensure that the CMOS configuration information is not lost when the power is down. Secondly, when you plug in the battery or power adapter.
However, before pressing the power key (S5), the power enabled inside the machine is called always power, which is mainly used to ensure the normal operation of the EC;
Once again, after you start up, all the power is turned on. At this time, we call it the main power (S0) for the whole machine to run;
When you enter the standby mode (S3), the electricity in the machine becomes the SUS power, mainly the power supply of DDR, to ensure that the information in Ram is not lost;
The power of sleep (S4) is the same as that of Shutdown (S5), which is always. Among them, the above brackets indicate the computer status (S0-boot, S3-standby, S4-sleep, S5-Shutdown ).
Now we assume that no power equipment is in the power supply (no battery or power supply). At this time, only the RTC circuit is in operation in the machine, A 3 V button battery is attached to the south bridge to provide RTC power to maintain internal time and CMOS information.
Startup sequence of nanqiao
Based on the previous power status, we will analyze the boot process. When the battery or power supply is plugged in, the mcu ec inside the machine resets and starts to work, waiting for the user to press the power key. During this period, the time sequence is: after always power is enabled, the EC reset starts to run and then sends a signal called 'rsmrst # 'to nanqiao. At this time, some functions of nanqiao start initialization and wait for the boot signal. Note that at this time, the south bridge did not turn on all the power, only a few functions are available, such as pwrbtn # signal for detecting the boot signal.
When the user presses the power key, the EC detects a level change (the general sequence is high-low-high), and then sends a boot signal (pwrbtn #) to nanqiao, after receiving the pwrbtn # signal, nanqiao increases the slp_s5 #, slp_s4 #, and slp_s3 # signals sequentially, enabling all peripheral voltages, including + 3 V, + 5 V, and ddr2.5 v, and sends the PM pwrok signal, which indicates that the peripheral power supply is enabled normally.
PM pwrok will act as a enable signal to the voltage generator that sends vccp to the CPU peripheral, and enable vccp. After that, vccp generator will issue core_vr_on to enable core VR (the core voltage of the CPU ). At this point, the voltage of the entire machine has been fully enabled.
After vr_pwrgd_ich is used to notify nanqiao core that VR is enabled successfully, nanqiao will send a PCI rst # signal to the PCI bus, so all the devices on the bus will be initialized (including beiqiao ), at the same time, h_pwrgd is sent to notify the CPU that its core voltage has been successfully enabled. Then, beiqiao sent the h_cpurst # signal to the CPU, and the CPU was reset and started to work.
When the user needs to enter the standby mode (S3), the system's ACPI and Windows operate at the same time, pull down slp_s3 #, and keep slp_s4 # And slp_s5 # High, if the main power is disabled, the system enters the standby mode.
When the sleep or shutdown mode is required, the power supply except RTC is also reduced, including slp_s3 #, slp_s4 #, and slp_s5. Of course, in this series of processes, the operating system and bios need to work together. For the hardware, you only need to ensure that the specific voltage supply is guaranteed in a specific State.
When the machine needs to enter S5 from S0, that is, when it is shut down, there will also be a certain time series, basically the inverse operation of the previous time series.
The above is the entire hardware boot, S3, S5 process, of course, different hardware has a different boot process, the most common ACPI is the abbreviation of Advanced Configuration and Power interface, which means "Advanced Configuration and Power Interface ". This is a power management standard jointly developed by Intel, Microsoft, and Toshiba.
ACPI provides the following functions:
1. You can enable the peripherals to switch at a specified time;
2. Users who use laptops can specify that the computer enters the low-power state at low voltage to ensure that important applications run properly;
3. The operating system can reduce the clock frequency when the application requires less time;
4. The operating system can allocate energy to peripherals and boards based on their specific needs;
5. When no one uses a computer, the computer can enter sleep state, but some communication devices can be enabled;
6. The plug-and-play device can be controlled by ACPI during insertion.
However, ACPI is the same as other power management methods. to enjoy these features, you must have software and hardware support. In terms of software, Windows 98 and its subsequent products and Windows 2000 all provide comprehensive support for ACPI. However, the Linux kernel currently does not support ACPI very well. Hardware is troublesome. In addition to supporting ACPI for peripherals such as the motherboard, video card, and nic, the power supply of the chassis is also required. When the power supply provides a 5 V voltage to the motherboard, it must also make the current stable at more than 720 mA, so that it can achieve computer "Sleep" and "wake up ".
ACPI has six States: S0 to S5, which indicate the following:
S0 -- in fact, this is our normal working state. All devices are fully open, and the power consumption generally exceeds 80 W;
S1 -- also known as pos (power on suspend). In this case, in addition to disabling the CPU through the CPU clock controller, other components still work normally, and the power consumption is generally below 30 W; (In fact, some CPU cooling software uses this working principle)
S2-the CPU is stopped and the bus clock is disabled, but other devices are still running;
S3 -- this is the familiar STR (suspend to ram). At this time, the power consumption cannot exceed 10 W;
S4 -- also known as STD (suspend to disk), when the system master power is off, but the hard disk is still charged and can be awakened;
S5 -- this state is the most simple, that is, all devices, including power supply, are shut down and power consumption is 0.
What we use most frequently is the S3 status, that is, the suspend to Ram (suspended to memory) status, STR for short. As the name suggests, STR stores all the operating status data before the system enters STR into the memory. In the STR state, the power supply continues to power the most necessary devices, such as memory, to ensure that data is not lost, while other devices are in the off state, and the power consumption of the system is extremely low. Once we press the power button (host power switch), the system will be awakened and the data will be immediately read from the memory and restored to the working status before Str. Memory read/write speed is extremely fast, so we feel that it takes only a few seconds to enter and exit the STR state; and S4 status, that is, STD (suspended to the hard disk) the principle is the same as that of STR, except that the data is stored on the hard disk. Because the read/write speed of the hard disk is much slower than the memory, it is not as fast as Str.
The advantage of STD is that it can be implemented only through software. For example, Windows 2000 can implement STD on hardware that does not support Str.
The previous power management method was APM (Advanced Power Management). What is the difference between ACPI and APM?
2. Comparison between ACPI and APM
APM 1.0 & 1.1: The power is managed by the BIOS;
APM 1.2: the operating system defines the power management time, which is executed by the BIOS;
ACPI: the BIOS collects hardware information and defines the power management solution. The operating system is responsible for the implementation.
APM is a software solution that is therefore related to operating systems, and ACPI is an industrial standard that includes software and hardware specifications.
APIC (Advanced Programmable Interrupt Controller) has two functions for computers,
First, to manage IRQ allocation, you can extend the traditional 16 IRQ to 24 (the traditional management method is called pic) to adapt to more devices.
The second is to manage multiple CPUs. Because the NF2 motherboard does not support multiple CPUs, the direct impact of APIC shutdown is to reduce available IRQ.
However, if there are not many boards, disabling APIC has no impact on the system.
To implement the SMP function, the CPU used must meet the following requirements:
The CPU must have a built-in APIC unit. The core of Intel's multi-processing specifications is the use of advanced programmable interrupt controllers-apics. The CPU sends interruptions to each other to complete communication between them. By attaching the interrupt action (actions), different CPUs can control each other to some extent. Each CPU has its own APIC (the local APIC that becomes the CPU), and there is an I/o apic to handle the interruption caused by the I/O device, this I/O APIC is installed on the motherboard, but the APIC on each CPU is indispensable. Otherwise, the coordination between multiple CPUs cannot be handled.
APIC may encounter problems. Many such problems can be solved through BIOS update.
The following describes how to change the Hal type.
The actual CPU running frequency is inconsistent with the BIOS setting frequency
About 10% of NF2 users may encounter the problem that the actual CPU running frequency is inconsistent with the BIOS setting frequency. We call it "Incorrect frequency ".
The direct consequence of this phenomenon is that it will not feel smooth when testing 3dmark or running a 3D game, which is also called a "pause ".
Generally, when you change the BIOS settings and restart the driver, you can use the testing software such as aida32 and mbm5 to check that the CPU running frequency is different from that set in the BIOS, there is also a big gap. At this time, it takes several seconds to test the CPU speed with super Pi. Using 3dmark to run the test will be several percent or even thousands of points lower than normal. The CPU frequency shown in 3dmark does not match the BIOS setting.
If this happens, it is the question of "Incorrect frequency" that we have discussed.
However, not all 3D games are "choppy" for this reason. The method to judge is: If you only have a few games "Don" or use the software to test the frequency correctly, this is not the case.
If this problem is true, the solution is very simple. After discussion, you only need to disable the APIC function. (Note: It is APIC, not ACPI ).