Hardware resources
Https://osu.redhat.com/content/courses-zh-cn/rha130-4/section_0002/tag_lessons/section_0002/section_0001/tag_resource
The X86 architecture provides a common mechanism for communication between hardware and Linux kernel. When adding new devices to a machine, you must be careful to share the following resources to avoid conflicts between devices.
Interrupt request line-IRQ and/proc/interrupts
Every device needs a way to attract kernel attention, such as telling the kernel: "Hey, someone has moved the mouse !", Or "hey, I transferred that information to the disk as required !" Use of many devicesInterrupt request line)OrIRQTo achieve this goal. In the X86 architecture, 15 IRQ lines are available, and multiple devices can share the same IRQ line.
Proc file system file/Proc/interrupts
Display available IRQ lines and device drivers using themProgram. This file also shows the total number of interruptions (since machine boot.
[root @ station root] # Cat/proc/interrupts
cpu0 0: 6091325 XT-PIC timer 1: 41608 XT-PIC keyboard 2: 0 XT-PIC cascade 3: 0 XT-PIC EHCI-HCD 5: 115473 XT-PIC USB-uhci 8: 1 XT-PIC RTC 10: 16384184 XT-PIC USB-uhci, eth0 11: 9720993 XT-PIC USB-uhci, eth1, audigy 12: 848836 XT-PIC PS/2 mouse 14: 190363 XT-PIC ide0 15: 1765002 XT-PIC ide1nmi: 0 err: 0
|
On SMP machines, hardware interrupt requests are sent to independent CPUs, And the interrupt requests on each CPU are listed separately. |
|
Timer (timer)The device driver must use IRQ 0. Timer interrupts the kernel 100 times per second within a fixed period of time (timer interrupts the kernel at a fixed frequency of 100 times per second), reminding the kernel to interrupt general activities and execute any scheduled or pending work. |
|
Three completely unrelated Device Drivers (USB controller, an Ethernet network interface card, and audigy Sound Card) share IRQ 11. |
|
The NMI field counts the number of times that non-Maskable Interrupt occurs. These interruptions generally indicate low-layer hardware errors. |
I/O port and/proc/ioports
After attracting the attention of the kernel (by making an interrupt request), devices usually input data for the system output or from the system. The X86 architecture provides a separate 16-bit address space for the device.I/O port. When using the I/O port to communicate with the kernel, the device and the kernel must reach a consensus on the port used.
Proc file system file/Proc/ioports
Display the ports required by drivers of different devices. (The port address is displayed in hexadecimal notation .)
[Root @ station root] # Cat/proc/ioports
2017-001f: dma10020-003f: pic10040-005f: timer0060-006f: RTC... 03c0-03df: vesafb03f6-03f6: ide003f8-03ff: Serial (auto) 0cf8-0cff: PCI conf1c000-c01f: creative labs Sb audigy c000-c01f: Audigyc400-c407: creative labs Sb audigy MIDI/Game portc800-c8ff: linksys network everywhere Fast Ethernet 10/100 model nc100 c800-c8ff: tulip...
Device memory buffer and/proc/iomem
Many advanced devices have their own memory. Once these memories are mapped to the system's memory address space, they can be used to easily transmit data. A video card is a typical device that provides its own memory buffer.
Proc file system file/Proc/iomem
Display All devices whose memory buffers are mapped to the physical memory and the physical memory addresses allocated to each buffer (listed in hexadecimal numbers ).
[Root @ station root] # Cat/proc/iomem
Transfer 0000-0009fbff: System Ram 0009fc00-0009ffff: reserved000a0000-000bffff: Video RAM area000c0000-000c7fff: Video ROM000f0000-000fffff: System ROM00100000-2dfeffff: System Ram 00100000-002766f6: kernel code 002766f7-00384807: kernel data... e3000000-e3003fff: creative labs Sb audigy FireWire Porte3004000-e30043ff: Linksys network everywhere Fast Ethernet 10/100 model nc100 e3004000-e30043ff: tulipe3005000-e30057ff: creative labs Sb audigy FireWire Porte3006000-e30060ff: via Technologies, Inc. USB 2.0 e3006000-e30060ff: ehci-hcde3007000-e30070ff: via Technologies, Inc. vt6102 [Rhine-II] e3007000-e30070ff: Via-Rhine...
|
Before you see this file, the host's main memory (RAM or random access memory (Random Access Memory) is considered as "one other device" and mapped to the low-layer physical address space. |
|
The physical address space does not need to be used consecutively (with no interval. In this case, the system Ram ing is interrupted to map the VGA video card. The address of the device was previously in the physical address space, but cannot be deleted for some reason. |
|
Most cached advanced devices are mapped to the upper-layer addresses of the physical address space. |