Misplaced Pages

Flash memory controller

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

A flash memory controller (or flash controller ) manages data stored on flash memory (usually NAND flash ) and communicates with a computer or electronic device . Flash memory controllers can be designed for operating in low duty-cycle environments like memory cards , or other similar media for use in PDAs , mobile phones , etc. USB flash drives use flash memory controllers designed to communicate with personal computers through the USB port at a low duty-cycle. Flash controllers can also be designed for higher duty-cycle environments like solid-state drives (SSD) used as data storage for laptop computer systems up to mission-critical enterprise storage arrays .

#24975

46-399: After a flash storage device is initially manufactured, the flash controller is first used to format the flash memory. This ensures the device is operating properly, it maps out bad flash memory cells, and it allocates spare cells to be substituted for future failed cells. Some part of the spare cells is also used to hold the firmware which operates the controller and other special features for

92-604: A car are transportation. They both have commonalities (e.g., you must steer) and physical differences (e.g., use of feet). One can always specify the abstraction "drive to" and let the implementor decide whether bicycling or driving a car is best. The "wheeled terrestrial transport" function is abstracted and the details of "how to drive" are encapsulated. Examples of "abstractions" on a PC include video input, printers, audio input and output, block devices (e.g. hard disk drives or USB flash drive ), etc. In certain computer science domains, such as operating systems or embedded systems,

138-503: A computer, exfiltrate data, or spy on the user. Other security researchers have worked further on how to exploit the principles behind BadUSB, releasing at the same time the source code of hacking tools that can be used to modify the behavior of different USB devices. Hardware abstraction Hardware abstractions are sets of routines in software that provide programs with access to hardware resources through programming interfaces. The programming interface allows all devices in

184-417: A consistent environment necessary for running more complex programs at the user's discretion. This required programming the computer to run those programs automatically. Furthermore, as companies, universities, and marketers wanted to sell computers to laypeople with little technical knowledge, greater automation became necessary to allow a lay-user to easily run programs for practical purposes. This gave rise to

230-445: A kind of software that a user would not consciously run, and it led to software that a lay user wouldn't even know about. As originally used, firmware contrasted with hardware (the CPU itself) and software (normal instructions executing on a CPU). It was not composed of CPU machine instructions, but of lower-level microcode involved in the implementation of machine instructions. It existed on

276-430: A minimum of code modification. Operating systems having a defined HAL are more easily portable across different hardware. This is especially important for embedded systems that run on dozens of different platforms. The Windows NT kernel has a HAL in the kernel space between hardware and the executive services that are contained in the file NTOSKRNL.EXE under %WINDOWS%\system32\hal.dll . This allows portability of

322-409: A more complex device, firmware may provide relatively low-level control as well as hardware abstraction services to higher-level software such as an operating system . Firmware is found in a wide range of computing devices including personal computers , phones , home appliances , vehicles , computer peripherals and in many of the digital chips inside each of these larger systems. Firmware

368-418: A particular class C of hardware devices to be accessed through identical interfaces even though C may contain different subclasses of devices that each provide a different hardware interface. Hardware abstractions often allow programmers to write device -independent, high performance applications by providing standard operating system (OS) calls to hardware. The process of abstracting pieces of hardware

414-481: A particular storage device. A directory structure is created to allow the controller to convert requests for logical sectors into the physical locations on the actual flash memory chips. When the system or device needs to read data from or write data to the flash memory, it will communicate with the flash memory controller. Simpler devices like SD cards and USB flash drives typically have a small number of flash memory die connected simultaneously. Operations are limited to

460-403: A program for such a system would have to know how each hardware device communicated with the rest of the system. This was a significant challenge to software developers since they then had to know how every hardware device in a system worked to ensure the software's compatibility . With hardware abstraction, rather than the program communicating directly with the hardware device, it communicates to

506-441: A program from the provider, and will often allow the old firmware to be saved before upgrading so it can be reverted to if the process fails, or if the newer version performs worse. Free software replacements for vendor flashing tools have been developed, such as Flashrom . Sometimes, third parties develop an unofficial new or modified ("aftermarket") version of firmware to provide new features or to unlock hidden functionality; this

SECTION 10

#1732869523025

552-458: A signal related to "movement". As physical limitations (e.g. resolution of sensor, temporal update frequency) may vary with hardware, an API can do little to hide that, other than by assuming a "least common denominator" model. Thus, certain deep architectural decisions from the implementation may become relevant to users of a particular instantiation of an abstraction. A good metaphor is the abstraction of transportation. Both bicycling and driving

598-580: A storage device. This is usually avoided in enterprise devices by allocating an oversized space for spares, although more durable forms of storage like MRAM has been proposed for FTL too. The FTL may has three types: page mapping, block mapping and hybrid mapping. Page mapping can has higher performance, but it has bigger FTL metadata size and higher cost, and its usually used on solid state drives . Block mapping can has smaller metadata size and lower cost, but it has lower performance, and its usually used on USB flash drives . On page mapping FTL implementations,

644-658: Is a major threat to system security: "Your biggest mistake is to assume that the NSA is the only institution abusing this position of trust – in fact, it's reasonable to assume that all firmware is a cesspool of insecurity, courtesy of incompetence of the highest degree from manufacturers, and competence of the highest degree from a very wide range of such agencies". As a potential solution to this problem, he has called for declarative firmware, which would describe "hardware linkage and dependencies" and "should not include executable code ". Firmware should be open-source so that

690-458: Is a process called garbage collection (GC). All SSDs, CF Cards, and other flash storage devices will include some level of garbage collection. The speed at which a flash controller will do this can vary. Firmware In computing , firmware is software that provides low-level control of computing device hardware . For a relatively simple device, firmware may perform all control, monitoring and data manipulation functionality. For

736-434: Is less frequently updated, even when flash memory (rather than ROM, EEPROM) storage is used for the firmware. Most computer peripherals are themselves special-purpose computers. Devices such as printers, scanners, webcams, and USB flash drives have internally-stored firmware; some devices may also permit field upgrading of their firmware. For modern simpler devices, such as USB keyboards , USB mouses and USB sound cards ,

782-431: Is often done from the perspective of a CPU . Each type of CPU has a specific instruction set architecture or ISA. The ISA represents the primitive operations of the machine that are available for use by assembly programmers and compiler writers. One of the main functions of a compiler is to allow a programmer to write an algorithm in a high-level language without having to care about CPU-specific instructions. Then it

828-471: Is referred to as custom firmware . An example is Rockbox as a firmware replacement for portable media players . There are many homebrew projects for various devices, which often unlock general-purpose computing functionality in previously limited devices (e.g., running Doom on iPods ). Firmware hacks usually take advantage of the firmware update facility on many devices to install or run themselves. Some, however, must resort to exploits to run, because

874-540: Is stored in non-volatile memory – either read-only memory (ROM) or programmable memory such as EPROM , EEPROM , or flash . Changing a device's firmware stored in ROM requires physically replacing the memory chip – although some chips are not designed to be removed after manufacture. Programmable firmware memory can be reprogrammed via a procedure sometimes called flashing . Common reasons for changing firmware include fixing bugs and adding features . Ascher Opler used

920-490: Is the job of the compiler to generate a CPU-specific executable. The same type of abstraction is made in operating systems, but OS APIs now represent the primitive operations of the machine, rather than an ISA. This allows a programmer to use OS-level operations (e.g. task creation/deletion) in their programs while retaining portability over a variety of different platforms. Many early computer systems did not have any form of hardware abstraction. This meant that anyone writing

966-430: The "flash translation layer" (FTL), a layer below the file system that maps host side or file system logical block addresses (LBAs) to the physical address of the flash memory (logical-to-physical mapping). The LBAs refer to sector numbers and to a mapping unit of 512 bytes. All LBAs that represent the logical size visible to and managed by the file system are mapped to a physical location (block ID, page ID and sector ID) of

SECTION 20

#1732869523025

1012-571: The API and communicates with the hardware by calling functions in the API. A hardware abstraction layer ( HAL ) is an abstraction layer , implemented in software, between the physical hardware of a computer and the software that runs on that computer. Its function is to hide differences in hardware from most of the operating system kernel , so that most of the kernel-mode code does not need to be changed to run on systems with different hardware. On Microsoft Windows, HAL can basically be considered to be

1058-556: The Equation Group in at least 42 countries. Mark Shuttleworth , the founder of the company Canonical , which created the Ubuntu Linux distribution, has described proprietary firmware as a security risk, saying that "firmware on your device is the NSA 's best friend" and calling firmware "a trojan horse of monumental proportions". He has asserted that low-quality, closed source firmware

1104-457: The Flash. As part of the wear leveling and other flash management algorithms (bad block management, read disturb management, safe flash handling etc.), the physical location of an LBA might dynamically change frequently. The mapping units of an FTL can differ so that LBAs are mapped block-, page- or even sub-page-based. Depending on the usage pattern, a finer mapping granularity can significantly reduce

1150-713: The GUI or even the battery life. Smartphones have a firmware over the air upgrade capability for adding new features and patching security issues. Since 1996, most automobiles have employed an on-board computer and various sensors to detect mechanical problems. As of 2010 , modern vehicles also employ computer-controlled anti-lock braking systems (ABS) and computer-operated transmission control units (TCUs). The driver can also get in-dash information while driving in this manner, such as real-time fuel economy and tire pressure readings. Local dealers can update most vehicle firmware. Other firmware applications include: Flashing involves

1196-677: The HAL, Windows 2000 was able to run on them. Since Windows Vista and Windows Server 2008 , the HAL used is automatically determined during startup . An "extreme" example of a HAL can be found in the System/38 and AS/400 architectures, currently implemented in the IBM i operating system. Most compilers for those systems generate an abstract machine code; the Licensed Internal Code, or LIC, translates this virtual machine code into native code for

1242-512: The Windows NT kernel-mode code to a variety of processors, with different memory management unit architectures, and a variety of systems with different I/O bus architectures; most of that code runs without change on those systems, when compiled for the instruction set applicable to those systems. For example, the SGI Intel x86-based workstations were not IBM PC compatible workstations, but due to

1288-476: The ability to insert one while running, like Adeos . The NetBSD operating system is widely known as having a clean hardware abstraction layer which allows it to be highly portable. As part of this system are uvm(9) / pmap(9) , bus_space(9) , bus_dma(9) and other subsystems. Popular buses which are used on more than one architecture are also abstracted, such as ISA , EISA , PCI , PCIe , etc., allowing drivers to also be highly portable with

1334-413: The abstractions have slightly different appearances (for instance, operating systems tend to have more standardized interfaces), but the concept of abstraction and encapsulation of complexity are common, and deep. The hardware abstraction layer resides below the application programming interface (API) in a software stack, whereas the application layer (often written in a high level language) resides above

1380-400: The boundary between hardware and software; thus the name firmware . Over time, popular usage extended the word firmware to denote any computer program that is tightly linked to hardware, including BIOS on PCs, boot firmware on smartphones, computer peripherals , or the control systems on simple consumer electronic devices such as microwave ovens , remote controls . In some respects,

1426-592: The code can be checked and verified. Custom firmware hacks have also focused on injecting malware into devices such as smartphones or USB devices . One such smartphone injection was demonstrated on the Symbian OS at MalCon , a hacker convention . A USB device firmware hack called BadUSB was presented at the Black Hat USA 2014 conference, demonstrating how a USB flash drive microcontroller can be reprogrammed to spoof various other device types to take control of

Flash memory controller - Misplaced Pages Continue

1472-606: The drive is formatted or wiped. Although the Kaspersky Lab report did not explicitly claim that this group is part of the United States National Security Agency (NSA), evidence obtained from the code of various Equation Group software suggests that they are part of the NSA. Researchers from the Kaspersky Lab categorized the undertakings by Equation Group as the most advanced hacking operation ever uncovered, also documenting around 500 infections caused by

1518-411: The driver for the motherboard and allows instructions from higher level computer languages to communicate with lower level components, but prevents direct access to the hardware. CP/M ( CP/M BIOS ), DOS ( DOS BIOS ), Solaris , Linux , BSD , macOS , and some other portable operating systems also have a HAL, even if it is not explicitly designated as such. Some operating systems, such as Linux, have

1564-575: The fact that the underlying hardware has been changed dramatically; at least three different types of processors have been in use. Android introduced a HAL known as the "vendor interface" (codenamed "Project Treble") on version 8.0 "Oreo" . It abstracts low-level code from the Android OS framework, and they must be made forward compatible to support future versions of Android to ease the development of firmware updates. Before Project Treble Android relied on various non-standardized legacy HALs. Halium

1610-453: The flash wear out and maximize the endurance of a flash based storage media. The deduplication function to eliminate redundant data and duplicate writes is also added in FTL. As the FTL metadata takes up its own flash space, it needs protection in case of power loss. In addition, it is possible for the mapping table to wear out before other parts of the flash memory has, prematurely ending the life of

1656-439: The hardware so that a programmer using the abstracted API, does not need to understand the details of the device's physical interface. This also allows code reuse since the same code can process standardized messages from any kind of implementation which supplies the "joystick" abstraction. A "nudge forward" can be from a potentiometer or from a capacitive touch sensor that recognises "swipe" gestures, as long as they both provide

1702-446: The manufacturer has attempted to lock the hardware to stop it from running unlicensed code . Most firmware hacks are free software . The Moscow-based Kaspersky Lab discovered that a group of developers it refers to as the " Equation Group " has developed hard disk drive firmware modifications for various drive models, containing a trojan horse that allows data to be stored on the drive in locations that will not be erased even if

1748-487: The one block would wear out before all the other blocks thereby prematurely ending the life of the storage device. For this reason flash controllers use a technique called wear leveling to distribute writes as evenly as possible across all the flash blocks in the SSD. In a perfect scenario this would enable every block to be written to its maximum life so they all fail at the same time. Usually, flash memory controllers also include

1794-688: The operating system what the device should do, which then generates a hardware-dependent instruction to the device. This meant programmers didn't need to know how specific devices worked, making their programs compatible with any device. An example of this might be a "joystick" abstraction. The joystick device, of which there are many physical implementations, is readable/writable through an API which many joystick-like devices might share. Most joystick-devices might report movement directions. Many joystick-devices might have sensitivity-settings that can be configured by an outside application. A Joystick abstraction hides details (e.g., register format, I2C address) of

1840-463: The overwriting of existing firmware or data, contained in EEPROM or flash memory module present in an electronic device, with new data. This can be done to upgrade a device or to change the provider of a service associated with the function of the device, such as changing from one mobile phone service provider to another or installing a new operating system. If firmware is upgradable, it is often done via

1886-459: The processor on which it is running and executes the resulting native code. (The exceptions are compilers that generate the LIC itself; those compilers are not available outside IBM.) This was so successful that application software and operating system software above the LIC layer that were compiled on the original S/38 run without modification and without recompilation on the latest AS/400 systems, despite

Flash memory controller - Misplaced Pages Continue

1932-501: The ratio of FTL metadata size and storage capacity is usually 1:1000, for example, a 1TB flash storage device may has 1GB of FTL metadata. Once every block of a solid-state storage device has been written one time, the flash controller will need to return to some of the initial blocks which no longer have current data (also called stale blocks). The data in these blocks were replaced with newly written blocks and now they are waiting to be erased so that new data can be written into them. This

1978-409: The speed of the individual flash memory die. In contrast, a high-performance solid-state drive will have more dies organized with parallel communication paths to enable speeds many times greater than that of a single flash die. Flash memory can withstand a limited number of program-erase cycles. If a particular flash memory block were programmed and erased repeatedly without writing to any other blocks,

2024-592: The term firmware in a 1967 Datamation article, as an intermediary term between "hardware" and "software". Opler projected that fourth-generation computer systems would have a writable control store (a small specialized high-speed memory) into which microcode firmware would be loaded. Many software functions would be moved to microcode, and instruction sets could be customized, with different firmware loaded for different instruction sets. As computers began to increase in complexity, it became clear that various programs needed to first be initiated and run to provide

2070-444: The trend is to store the firmware in on-chip memory in the device's microcontroller , as opposed to storing it in a separate EEPROM chip. Examples of computer firmware include: Consumer appliances like gaming consoles , digital cameras and portable music players support firmware upgrades. Some companies use firmware updates to add new playable file formats ( codecs ). Other features that may change with firmware updates include

2116-502: The various firmware components are as important as the operating system in a working computer. However, unlike most modern operating systems, firmware rarely has a well-evolved automatic mechanism of updating itself to fix any functionality issues detected after shipping the unit. A computer's firmware may be manually updated by a user via a small utility program. In contrast, firmware in mass storage devices (hard-disk drives, optical disc drives, flash memory storage e.g. solid state drive)

#24975