Skip to contentSkip to conversation

Enhancements and fixes for dell_rbu driver

PATCH In review Abhay Salunke 4 participants 4 messages Sep 16, 2005 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enhancements and fixes for dell_rbu driver

Please apply this patch which fixes as bug and usability issues in the dell_rbu driver and has some enhancements.

BUG fixes:
The driver used to allocate memory with spinlock held which has been fixed in this patch.
The driver was printing the entire buffer when it received a invalid entry in image_type. The fix is to only print a warning message and not the buffer.

Usability enhancements:
It is possible that due to user error the /sys/class/firmware/dell_rbu entries migh be missing, this can happen if the user does the following echo 1 > /sys/class/firmware/dell_rbu/loading
echo 0 > /sys/class/firmware/dell_rbu/loading
This will make the entries in /sys/class/firmware/ to disappear and the only way get them back was bby unloading and loading the driver.
This patch makes the user recreate these entries by echoing init in to image_type.

This patch has been tested with Libsmbios and Dell OpenManage.

Thanks
Abhay

Documentation/dell_rbu.txt +14 -6
diff -uprN linux-2.6.14-rc1.orig/Documentation/dell_rbu.txt linux-2.6.14-rc1.new/Documentation/dell_rbu.txt
@@ -13,6 +13,8 @@ the BIOS on Dell servers (starting from 
 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).
+Libsmbios can also be used to update BIOS on Dell systems go to
+http://linux.dell.com/libsmbios/ for details.
 
 Dell_RBU driver supports BIOS update using the monilothic image and packetized
 image methods. In case of moniolithic the driver allocates a contiguous chunk
@@ -22,8 +24,8 @@ would place each packet in contiguous ph
 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 rbu driver needs to have an application (as mentioned above)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.
@@ -42,9 +44,11 @@ In case of packet mechanism the single m
 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
+changed to packets 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
+Also echoing either mono ,packet or init in to image_type will free up the 
+memory allocated by the driver.
 
 Do the steps below to download the BIOS image.
 1) echo 1 > /sys/class/firmware/dell_rbu/loading
@@ -52,10 +56,14 @@ Do the steps below to download the BIOS 
 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
-
+done. 
+echo -1 > /sys/class/firmware/dell_rbu/loading.
 Until this step is completed the drivr cannot be unloaded.
+If an user by accident executes steps 1 and 3 above without executing step 2; 
+it will make the /sys/class/firmware/dell_rbu/ entries to disappear. 
+The entries can be recreated by doing the following
+echo init > /sys/devices/platform/dell_rbu/image_type
+NOTE: echoing init in image_type does not change it original value.
 
 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
drivers/firmware/dell_rbu.c +154 -97

476 lines not on this page · raw message

#1 lore raw

Dell laptops crashing / 2.6.13+ ?

Hi all,

I was wondering if any one else has a dell laptop which crashes during boot or locks up with 2.6.13 and higher ? Especially Oopses

Thanks

#2 lore raw

Re: Dell laptops crashing / 2.6.13+ ?

Quoted 2 lines · Trilight

I was wondering if any one else has a dell laptop which crashes during boot or locks up with 2.6.13 and higher ? Especially Oopses

Hmm... I'm on 2.6.13-mm1 on a Dell Latitude C840 here, and it seems relatively stable modulo the occasional lockup due to the NVidia card/driver (but of course, that's my problem, not lkml's).

What model laptop *exactly*, and do you have the text of an oops?

#3 lore raw
In reply to Abhay Salunke
Quoted 4 lines · Abhay Salunke

-static __exit void dcdrbu_exit(void)
+static __exit void
+dcdrbu_exit(void)

hm, all these extraneous whitespace changes actually take the driver further away from preferred coding style.

How about we do this?

drivers/firmware/dell_rbu.c renamed from drivers/firmware/dell_rbu.c~dell_rbu-tidy +30 -38
diff -puN drivers/firmware/dell_rbu.c~dell_rbu-tidy drivers/firmware/dell_rbu.c
@@ -85,8 +85,7 @@ static struct platform_device *rbu_devic
 static int context;
 static dma_addr_t dell_rbu_dmaaddr;
 
-static void
-init_packet_head(void)
+static void init_packet_head(void)
 {
 	INIT_LIST_HEAD(&packet_data_head.list);
 	rbu_data.packet_write_count = 0;
@@ -95,8 +94,7 @@ init_packet_head(void)
 	rbu_data.packetsize = 0;
 }
 
-static int
-fill_last_packet(void *data, size_t length)
+static int fill_last_packet(void *data, size_t length)
 {
 	struct list_head *ptemp_list;
 	struct packet_data *packet = NULL;
@@ -138,8 +136,7 @@ fill_last_packet(void *data, size_t leng
 	return 0;
 }
 
-static int
-create_packet(size_t length)
+static int create_packet(size_t length)
 {
 	struct packet_data *newpacket;
 	int ordernum = 0;
@@ -198,8 +195,7 @@ create_packet(size_t length)
 	return 0;
 }
 
-static int
-packetize_data(void *data, size_t length)
+static int packetize_data(void *data, size_t length)
 {
 	int rc = 0;
 
@@ -213,8 +209,7 @@ packetize_data(void *data, size_t length
 	return rc;
 }
 
-static int
-do_packet_read(char *data, struct list_head *ptemp_list,
+static int do_packet_read(char *data, struct list_head *ptemp_list,
 	int length, int bytes_read, int *list_read_count)
 {
 	void *ptemp_buf;
@@ -248,8 +243,7 @@ do_packet_read(char *data, struct list_h
 	return bytes_copied;
 }
 
-static int
-packet_read_list(char *data, size_t * pread_length)
+static int packet_read_list(char *data, size_t *pread_length)
 {
 	struct list_head *ptemp_list;
 	int temp_count = 0;
@@ -287,8 +281,7 @@ packet_read_list(char *data, size_t * pr
 	return 0;
 }
 
-static void
-packet_empty_list(void)
+static void packet_empty_list(void)
 {
 	struct list_head *ptemp_list;
 	struct list_head *pnext_list;
@@ -320,8 +313,7 @@ packet_empty_list(void)
  * img_update_free: Frees the buffer allocated for storing BIOS image
  * Always called with lock held and returned with lock held
  */
-static void
-img_update_free(void)
+static void img_update_free(void)
 {
 	if (!rbu_data.image_update_buffer)
 		return;
@@ -358,8 +350,7 @@ img_update_free(void)
  * already allocated size, then that memory is reused. This function is
  * called with lock held and returns with lock held.
  */
-static int
-img_update_realloc(unsigned long size)
+static int img_update_realloc(unsigned long size)
 {
 	unsigned char *image_update_buffer = NULL;
 	unsigned long rc;
@@ -428,8 +419,7 @@ img_update_realloc(unsigned long size)
 	return rc;
 }
 
-static ssize_t
-read_packet_data(char *buffer, loff_t pos, size_t count)
+static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
 {
 	int retval;
 	size_t bytes_left;
@@ -470,8 +460,7 @@ read_packet_data(char *buffer, loff_t po
 	return retval;
 }
 
-static ssize_t
-read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
+static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
 {
 	unsigned char *ptemp = NULL;
 	size_t bytes_left = 0;
@@ -509,8 +498,8 @@ read_rbu_mono_data(char *buffer, loff_t 
 	return ret_count;
 }
 
-static ssize_t
-read_rbu_data(struct kobject *kobj, char *buffer, loff_t pos, size_t count)
+static ssize_t read_rbu_data(struct kobject *kobj, char *buffer,
+			loff_t pos, size_t count)
 {
 	ssize_t ret_count = 0;
 
@@ -527,8 +516,7 @@ read_rbu_data(struct kobject *kobj, char
 	return ret_count;
 }
 
-static void
-callbackfn_rbu(const struct firmware *fw, void *context)
+static void callbackfn_rbu(const struct firmware *fw, void *context)
 {
 	int rc = 0;
 
@@ -564,9 +552,8 @@ callbackfn_rbu(const struct firmware *fw
 		rbu_data.entry_created = 1;
 }
 
-static ssize_t
-read_rbu_image_type(struct kobject *kobj, char *buffer, loff_t pos,
-	size_t count)
+static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
+			loff_t pos, size_t count)
 {
 	int size = 0;
 	if (!pos)
@@ -574,9 +561,8 @@ read_rbu_image_type(struct kobject *kobj
 	return size;
 }
 
-static ssize_t
-write_rbu_image_type(struct kobject *kobj, char *buffer, loff_t pos,
-	size_t count)
+static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
+			loff_t pos, size_t count)
 {
 	int rc = count;
 	int req_firm_rc = 0;
@@ -636,18 +622,25 @@ write_rbu_image_type(struct kobject *kob
 }
 
 static struct bin_attribute rbu_data_attr = {
-	.attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444},
+	.attr = {
+		.name = "data",
+		.owner = THIS_MODULE,
+		.mode = 0444,
+	},
 	.read = read_rbu_data,
 };
 
 static struct bin_attribute rbu_image_type_attr = {
-	.attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644},
+	.attr = {
+		.name = "image_type",
+		.owner = THIS_MODULE,
+		.mode = 0644,
+	},
 	.read = read_rbu_image_type,
 	.write = write_rbu_image_type,
 };
 
-static int __init
-dcdrbu_init(void)
+static int __init dcdrbu_init(void)
 {
 	int rc = 0;
 	spin_lock_init(&rbu_data.lock);
@@ -677,8 +670,7 @@ dcdrbu_init(void)
 
 }
 
-static __exit void
-dcdrbu_exit(void)
+static __exit void dcdrbu_exit(void)
 {
 	spin_lock(&rbu_data.lock);
 	packet_empty_list();

_