ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • CMOS
    프로젝트/운영체제 만들기 2023. 7. 22. 18:18

    글의 참고

    - https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory


    글의 전제

    - 밑줄로 작성된 글은 강조 표시를 의미한다.

    - 그림 출처는 항시 그림 아래에 표시했다.


    글의 내용

     

    : CMOS는 작은 사이즈의 RAM과 같다. 그래서 시스템이 종료되면 데이터가 모두 사라져 버린다. 그런데, BIOS 및 UEFI 와 같은 시스템 펌웨어에서는 이 CMOS를 사용하고 있다. 그 이유를 보려면, CMOS의 특징을 알아야 될 듯 싶다.

    Nonvolatile BIOS memory refers to a small memory on PC motherboards that is used to store BIOS settings. It is traditionally called CMOS RAM because it uses a volatile, `low-power` complementary metal–oxide–semiconductor (CMOS) `SRAM` (such as the Motorola MC146818 or similar) powered by a `small "CMOS" battery` when system and standby power is off.[1] It is referred to as non-volatile memory or NVRAM because, after the system loses power, it does retain state by virtue of the CMOS battery. The typical NVRAM capacity is 256 bytes.[2]

    The CMOS RAM and the real-time clock have been integrated as a part of the southbridge chipset and it may not be a standalone chip on modern motherboards.[2][3] In turn, the southbridge have been integrated into a single Platform Controller Hub.

    Today's UEFI motherboards use NVRAM to store configuration data (NVRAM is a part of the UEFI flash ROM), but by many OEMs' design, the UEFI settings are still lost if the CMOS battery fails.[4][5]

    - 참고 : https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory

    : 위키피디아에서는 `CMOS`를 전력 소모가 적고 SRAM과 같이 빠르다고 설명한다. 그래서 BIOS 및 UEFI 펌웨어는 이 CMOS에 여러 가지 상태 및 설정 정보들을 저장한 뒤, 부팅 시점에 이 정보들을 읽어들인다. 그런데, 위에서 분명히 CMOS는 휘발성 메모리라고 했다. 그러면, BIOS 및 UEFI 펌웨어가 부팅하는 시점에 CMOS에 데이터는 없어야 한다.

     

    : CMOS는 작은 배터리를 사용해서 마치 `비휘발성 메모리`와 같이 동작하게 된다. CMOS 배터리는 대개 `CR2032 코인 셀`을 사용한다. 대개 PSU로 부터 전원 공급이 끊길 경웅, CMOS 배터리가 동작을 하는데, 3년 정도 유지된다고 보면 된다.

    The memory battery (aka motherboard, CMOS, real-time clock (RTC), clock battery)[1][6] is generally a `CR2032 lithium coin cell`. This cell battery has an estimated life of `three years` when power supply unit (PSU) is unplugged or when the PSU power switch is turned off.[7] This battery type, unlike the lithium-ion battery, is not rechargeable and trying to do so may result in an explosion. Motherboards have circuitry preventing batteries from being charged and discharged when a motherboard is powered on. Other common battery cell types can last significantly longer or shorter periods, such as the smaller CR2016 which will generally last about 40% less time than CR2032. Higher temperatures and longer power-off time will shorten battery cell life. When replacing the battery cell, the system time and CMOS BIOS settings may revert to default values. Unwanted BIOS reset may be avoided by replacing the battery cell with the PSU power switch turned on and plugged into an electric wall socket. On ATX motherboards, the PSU will supply 5V standby power to the motherboard to keep CMOS memory energized while the system is off.
    ....

    - 참고 : https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory

     

     

    - BIOS and CMOS

    The BIOS is a computer chip on the motherboard like CMOS, except that its purpose is to communicate between the processor and other hardware components like the hard drive, USB ports, sound card, video card, and more. A computer without a BIOS wouldn't understand how these pieces of the computer work together.

    The BIOS firmware is also what performs the `Power On Self Test` to test those pieces of hardware, and what ultimately runs the bootloader to launch the operating system.

    CMOS is also a computer chip on the motherboard, or more specifically a RAM chip, which means it would normally lose the settings it's storing when the computer is shut down (just like how the contents of RAM aren't maintained each time you restart your computer). However, the CMOS battery is used to provide constant power to the chip.

    When the computer first boots up, BIOS pulls information from the CMOS chip to understand the hardware settings, time, and anything else that's stored in it. The chip typically stores as little as 256 bytes of information.
    ....

    - 참고 : https://www.lifewire.com/what-is-cmos-2625826

     

    - 부트 업

    : BIOS 부팅이 되는 컴퓨터에서 CMOS를 설정하여 BIOS의 POST 동작을 컨트롤할 수 있다. 예를 들어, CMOS에는 `날짜 및 시간` 관련 데이터를 변경한다 거나 특정 하드웨어 디바이스를 초기화하지 못하도록 CMOS를 변경할 수 가 있다.

    When the computer is first starting up, there's an option to boot into BIOS or CMOS. Opening the CMOS setup is how you can change the settings it's storing, like the date and time and how the different computer components are first started up. You can also use CMOS setup to disable/enable some hardware devices.

    CMOS chips are desirable for battery-powered devices like laptops because they use less power than other types of chips. Although they use both negative polarity circuits and positive polarity circuits (NMOS and PMOS), only one circuit type is powered on at a time.
    ....

    - 참고 : https://www.lifewire.com/what-is-cmos-2625826

     

    - I/O 포트

    : CMOS(RTC)에 접근하는 방법은 I/O 포트 0x70, 0x71을 사용한다. 예를 들어, CMOS RAM에는 현재 프로세서가 RESET이 된 이유가 적혀있는 레지스터(0x0F)가 있다. RESET 이유를 알고 싶다면, 먼저 0x70에는 0x0F를 쓴다(`0x70` 포트는 읽거나 쓰고 싶은 레지스터의 번호를 작성하는 I/O 포트다). 여기에는 해당 RESET이 발생한 이유가 적혀있다. 코드로는 `outb(0x70, 0x0F)` 와 같이 작성하면 된다. 그런 다음, 실제 RESET REASON을 읽기 위해서 `inb(0x71)`을 작성하면, RESET REASON을 읽을 수 있다.

    ....
    But when it was used on IBM AT motherboard that has a 16-bit 80286 CPU, and all the motherboard IO devices already needed to be on a non-multiplexed IO bus for backwards compatibility with PC and TX, first some complex logic interfacing was needed to connect it like the other IO peripherals with non-multiplexed bus. It would have also been too much to give it 64 directly mapped IO addresses, as all the motherboard devices were reserved to be on the first 256 addresses. Therefore two IO ports were allocated, `0x70` to send the address cycle, and `0x71` to send the register data cycle.
    ....

    - 참고 : https://retrocomputing.stackexchange.com/questions/13969/performing-16-bit-port-i-o-on-the-rtc

    ....
    Accessing CMOS is extremely simple, but you always need to take into account how you want to handle NMI. You "select" a CMOS register (for reading or writing) by sending the register number to IO Port 0x70. Since the 0x80 bit of Port 0x70 controls NMI, you always end up setting that, too. So your CMOS controller always needs to know whether your OS wants NMI to be enabled or not. Selecting a CMOS register is done as follows:

    outb (0x70, (NMI_disable_bit << 7) | (selected CMOS register number));
    Once a register is selected, you either read the value of that register on Port 0x71 (with inb or an equivalent function), or you write a new value to that register -- also on Port 0x71 (with outb, for example):

    val_8bit = inb (0x71);
    ....

    - 참고 : https://wiki.osdev.org/CMOS#Accessing_CMOS_Registers

     

    '프로젝트 > 운영체제 만들기' 카테고리의 다른 글

    [멀티 프로세서] I/O APIC  (0) 2023.07.23
    [xv6] Application Processor  (0) 2023.07.23
    [xv6] Local APIC  (0) 2023.07.21
    [컴퓨터 구조] Local APIC  (0) 2023.07.19
    [멀티프로세서] Multi-Processor Specification(MPS)  (0) 2023.07.18
Designed by Tistory.