-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Linus Torvalds
committed
Sep 9, 2005
1 parent
f087ca5
commit 1e4869c
Showing
3,524 changed files
with
210,226 additions
and
120,143 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 29db35edb2548c3b0299c53d62d5f26d77a8e58f | ||
refs/heads/master: e3e3679cfc1c6689e035f6d69606253b1eda63ca |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
Using RCU to Protect Dynamic NMI Handlers | ||
|
||
|
||
Although RCU is usually used to protect read-mostly data structures, | ||
it is possible to use RCU to provide dynamic non-maskable interrupt | ||
handlers, as well as dynamic irq handlers. This document describes | ||
how to do this, drawing loosely from Zwane Mwaikambo's NMI-timer | ||
work in "arch/i386/oprofile/nmi_timer_int.c" and in | ||
"arch/i386/kernel/traps.c". | ||
|
||
The relevant pieces of code are listed below, each followed by a | ||
brief explanation. | ||
|
||
static int dummy_nmi_callback(struct pt_regs *regs, int cpu) | ||
{ | ||
return 0; | ||
} | ||
|
||
The dummy_nmi_callback() function is a "dummy" NMI handler that does | ||
nothing, but returns zero, thus saying that it did nothing, allowing | ||
the NMI handler to take the default machine-specific action. | ||
|
||
static nmi_callback_t nmi_callback = dummy_nmi_callback; | ||
|
||
This nmi_callback variable is a global function pointer to the current | ||
NMI handler. | ||
|
||
fastcall void do_nmi(struct pt_regs * regs, long error_code) | ||
{ | ||
int cpu; | ||
|
||
nmi_enter(); | ||
|
||
cpu = smp_processor_id(); | ||
++nmi_count(cpu); | ||
|
||
if (!rcu_dereference(nmi_callback)(regs, cpu)) | ||
default_do_nmi(regs); | ||
|
||
nmi_exit(); | ||
} | ||
|
||
The do_nmi() function processes each NMI. It first disables preemption | ||
in the same way that a hardware irq would, then increments the per-CPU | ||
count of NMIs. It then invokes the NMI handler stored in the nmi_callback | ||
function pointer. If this handler returns zero, do_nmi() invokes the | ||
default_do_nmi() function to handle a machine-specific NMI. Finally, | ||
preemption is restored. | ||
|
||
Strictly speaking, rcu_dereference() is not needed, since this code runs | ||
only on i386, which does not need rcu_dereference() anyway. However, | ||
it is a good documentation aid, particularly for anyone attempting to | ||
do something similar on Alpha. | ||
|
||
Quick Quiz: Why might the rcu_dereference() be necessary on Alpha, | ||
given that the code referenced by the pointer is read-only? | ||
|
||
|
||
Back to the discussion of NMI and RCU... | ||
|
||
void set_nmi_callback(nmi_callback_t callback) | ||
{ | ||
rcu_assign_pointer(nmi_callback, callback); | ||
} | ||
|
||
The set_nmi_callback() function registers an NMI handler. Note that any | ||
data that is to be used by the callback must be initialized up -before- | ||
the call to set_nmi_callback(). On architectures that do not order | ||
writes, the rcu_assign_pointer() ensures that the NMI handler sees the | ||
initialized values. | ||
|
||
void unset_nmi_callback(void) | ||
{ | ||
rcu_assign_pointer(nmi_callback, dummy_nmi_callback); | ||
} | ||
|
||
This function unregisters an NMI handler, restoring the original | ||
dummy_nmi_handler(). However, there may well be an NMI handler | ||
currently executing on some other CPU. We therefore cannot free | ||
up any data structures used by the old NMI handler until execution | ||
of it completes on all other CPUs. | ||
|
||
One way to accomplish this is via synchronize_sched(), perhaps as | ||
follows: | ||
|
||
unset_nmi_callback(); | ||
synchronize_sched(); | ||
kfree(my_nmi_data); | ||
|
||
This works because synchronize_sched() blocks until all CPUs complete | ||
any preemption-disabled segments of code that they were executing. | ||
Since NMI handlers disable preemption, synchronize_sched() is guaranteed | ||
not to return until all ongoing NMI handlers exit. It is therefore safe | ||
to free up the handler's data as soon as synchronize_sched() returns. | ||
|
||
|
||
Answer to Quick Quiz | ||
|
||
Why might the rcu_dereference() be necessary on Alpha, given | ||
that the code referenced by the pointer is read-only? | ||
|
||
Answer: The caller to set_nmi_callback() might well have | ||
initialized some data that is to be used by the | ||
new NMI handler. In this case, the rcu_dereference() | ||
would be needed, because otherwise a CPU that received | ||
an NMI just after the new handler was set might see | ||
the pointer to the new NMI handler, but the old | ||
pre-initialized version of the handler's data. | ||
|
||
More important, the rcu_dereference() makes it clear | ||
to someone reading the code that the pointer is being | ||
protected by RCU. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
Overview | ||
|
||
The Dell Systems Management Base Driver provides a sysfs interface for | ||
systems management software such as Dell OpenManage to perform system | ||
management interrupts and host control actions (system power cycle or | ||
power off after OS shutdown) on certain Dell systems. | ||
|
||
Dell OpenManage requires this driver on the following Dell PowerEdge systems: | ||
300, 1300, 1400, 400SC, 500SC, 1500SC, 1550, 600SC, 1600SC, 650, 1655MC, | ||
700, and 750. Other Dell software such as the open source libsmbios project | ||
is expected to make use of this driver, and it may include the use of this | ||
driver on other Dell systems. | ||
|
||
The Dell libsmbios project aims towards providing access to as much BIOS | ||
information as possible. See http://linux.dell.com/libsmbios/main/ for | ||
more information about the libsmbios project. | ||
|
||
|
||
System Management Interrupt | ||
|
||
On some Dell systems, systems management software must access certain | ||
management information via a system management interrupt (SMI). The SMI data | ||
buffer must reside in 32-bit address space, and the physical address of the | ||
buffer is required for the SMI. The driver maintains the memory required for | ||
the SMI and provides a way for the application to generate the SMI. | ||
The driver creates the following sysfs entries for systems management | ||
software to perform these system management interrupts: | ||
|
||
/sys/devices/platform/dcdbas/smi_data | ||
/sys/devices/platform/dcdbas/smi_data_buf_phys_addr | ||
/sys/devices/platform/dcdbas/smi_data_buf_size | ||
/sys/devices/platform/dcdbas/smi_request | ||
|
||
Systems management software must perform the following steps to execute | ||
a SMI using this driver: | ||
|
||
1) Lock smi_data. | ||
2) Write system management command to smi_data. | ||
3) Write "1" to smi_request to generate a calling interface SMI or | ||
"2" to generate a raw SMI. | ||
4) Read system management command response from smi_data. | ||
5) Unlock smi_data. | ||
|
||
|
||
Host Control Action | ||
|
||
Dell OpenManage supports a host control feature that allows the administrator | ||
to perform a power cycle or power off of the system after the OS has finished | ||
shutting down. On some Dell systems, this host control feature requires that | ||
a driver perform a SMI after the OS has finished shutting down. | ||
|
||
The driver creates the following sysfs entries for systems management software | ||
to schedule the driver to perform a power cycle or power off host control | ||
action after the system has finished shutting down: | ||
|
||
/sys/devices/platform/dcdbas/host_control_action | ||
/sys/devices/platform/dcdbas/host_control_smi_type | ||
/sys/devices/platform/dcdbas/host_control_on_shutdown | ||
|
||
Dell OpenManage performs the following steps to execute a power cycle or | ||
power off host control action using this driver: | ||
|
||
1) Write host control action to be performed to host_control_action. | ||
2) Write type of SMI that driver needs to perform to host_control_smi_type. | ||
3) Write "1" to host_control_on_shutdown to enable host control action. | ||
4) Initiate OS shutdown. | ||
(Driver will perform host control SMI when it is notified that the OS | ||
has finished shutting down.) | ||
|
||
|
||
Host Control SMI Type | ||
|
||
The following table shows the value to write to host_control_smi_type to | ||
perform a power cycle or power off host control action: | ||
|
||
PowerEdge System Host Control SMI Type | ||
---------------- --------------------- | ||
300 HC_SMITYPE_TYPE1 | ||
1300 HC_SMITYPE_TYPE1 | ||
1400 HC_SMITYPE_TYPE2 | ||
500SC HC_SMITYPE_TYPE2 | ||
1500SC HC_SMITYPE_TYPE2 | ||
1550 HC_SMITYPE_TYPE2 | ||
600SC HC_SMITYPE_TYPE2 | ||
1600SC HC_SMITYPE_TYPE2 | ||
650 HC_SMITYPE_TYPE2 | ||
1655MC HC_SMITYPE_TYPE2 | ||
700 HC_SMITYPE_TYPE3 | ||
750 HC_SMITYPE_TYPE3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Purpose: | ||
Demonstrate the usage of the new open sourced rbu (Remote BIOS Update) driver | ||
for updating BIOS images on Dell servers and desktops. | ||
|
||
Scope: | ||
This document discusses the functionality of the rbu driver only. | ||
It does not cover the support needed from aplications to enable the BIOS to | ||
update itself with the image downloaded in to the memory. | ||
|
||
Overview: | ||
This driver works with Dell OpenManage or Dell Update Packages for updating | ||
the BIOS on Dell servers (starting from servers sold since 1999), desktops | ||
and notebooks (starting from those sold in 2005). | ||
Please go to http://support.dell.com register and you can find info on | ||
OpenManage and Dell Update packages (DUP). | ||
|
||
Dell_RBU driver supports BIOS update using the monilothic image and packetized | ||
image methods. In case of moniolithic the driver allocates a contiguous chunk | ||
of physical pages having the BIOS image. In case of packetized the app | ||
using the driver breaks the image in to packets of fixed sizes and the driver | ||
would place each packet in contiguous physical memory. The driver also | ||
maintains a link list of packets for reading them back. | ||
If the dell_rbu driver is unloaded all the allocated memory is freed. | ||
|
||
The rbu driver needs to have an application which will inform the BIOS to | ||
enable the update in the next system reboot. | ||
|
||
The user should not unload the rbu driver after downloading the BIOS image | ||
or updating. | ||
|
||
The driver load creates the following directories under the /sys file system. | ||
/sys/class/firmware/dell_rbu/loading | ||
/sys/class/firmware/dell_rbu/data | ||
/sys/devices/platform/dell_rbu/image_type | ||
/sys/devices/platform/dell_rbu/data | ||
|
||
The driver supports two types of update mechanism; monolithic and packetized. | ||
These update mechanism depends upon the BIOS currently running on the system. | ||
Most of the Dell systems support a monolithic update where the BIOS image is | ||
copied to a single contiguous block of physical memory. | ||
In case of packet mechanism the single memory can be broken in smaller chuks | ||
of contiguous memory and the BIOS image is scattered in these packets. | ||
|
||
By default the driver uses monolithic memory for the update type. This can be | ||
changed to contiguous during the driver load time by specifying the load | ||
parameter image_type=packet. This can also be changed later as below | ||
echo packet > /sys/devices/platform/dell_rbu/image_type | ||
|
||
Do the steps below to download the BIOS image. | ||
1) echo 1 > /sys/class/firmware/dell_rbu/loading | ||
2) cp bios_image.hdr /sys/class/firmware/dell_rbu/data | ||
3) echo 0 > /sys/class/firmware/dell_rbu/loading | ||
|
||
The /sys/class/firmware/dell_rbu/ entries will remain till the following is | ||
done. | ||
echo -1 > /sys/class/firmware/dell_rbu/loading | ||
|
||
Until this step is completed the drivr cannot be unloaded. | ||
|
||
Also the driver provides /sys/devices/platform/dell_rbu/data readonly file to | ||
read back the image downloaded. This is useful in case of packet update | ||
mechanism where the above steps 1,2,3 will repeated for every packet. | ||
By reading the /sys/devices/platform/dell_rbu/data file all packet data | ||
downloaded can be verified in a single file. | ||
The packets are arranged in this file one after the other in a FIFO order. | ||
|
||
NOTE: | ||
This driver requires a patch for firmware_class.c which has the addition | ||
of request_firmware_nowait_nohotplug function to wortk | ||
Also after updating the BIOS image an user mdoe application neeeds to execute | ||
code which message the BIOS update request to the BIOS. So on the next reboot | ||
the BIOS knows about the new image downloaded and it updates it self. | ||
Also don't unload the rbu drive if the image has to be updated. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.