Skip to contentSkip to conversation

MAPS: Support for BIOS flash chips on the nvidia ck804 southbridge

PATCH In review Ryan Jackson 3 participants 5 messages Oct 24, 2006 – Oct 25, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MAPS: Support for BIOS flash chips on the nvidia ck804 southbridge

From: Dave Olsen <[email protected]>

Add support for accessing BIOS flash chips connected to the NVIDIA ck804 southbridge.

---
 drivers/mtd/maps/Kconfig     |    9 +
 drivers/mtd/maps/Makefile    |    1 
 drivers/mtd/maps/ck804xrom.c |  353 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 363 insertions(+), 0 deletions(-)
drivers/mtd/maps/Kconfig +9 -0
index 7514a9b..fa74668 100644
@@ -193,6 +193,15 @@ config MTD_ESB2ROM
 
           BE VERY CAREFUL.
 
+config MTD_CK804XROM
+	tristate "BIOS flash chip on Nvidia CK804"
+	depends on X86 && MTD_JEDECPROBE
+	help
+	  Support for treating the BIOS flash chip on nvidia motherboards
+	  as an MTD device - with this you can reprogram your BIOS.
+
+	  BE VERY CAREFUL.
+
 config MTD_SCB2_FLASH
 	tristate "BIOS flash chip on Intel SCB2 boards"
 	depends on X86 && MTD_JEDECPROBE
drivers/mtd/maps/Makefile +1 -0
index 9061432..3450521 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_MTD_L440GX)	+= l440gx.o
 obj-$(CONFIG_MTD_AMD76XROM)	+= amd76xrom.o
 obj-$(CONFIG_MTD_ESB2ROM)	+= esb2rom.o
 obj-$(CONFIG_MTD_ICHXROM)	+= ichxrom.o
+obj-$(CONFIG_MTD_CK804XROM)	+= ck804xrom.o
 obj-$(CONFIG_MTD_TSUNAMI)	+= tsunami_flash.o
 obj-$(CONFIG_MTD_LUBBOCK)	+= lubbock-flash.o
 obj-$(CONFIG_MTD_MAINSTONE)	+= mainstone-flash.o
drivers/mtd/maps/ck804xrom.c new file +353 -0

353 lines not on this page · raw message

Signature · 1 line
1.4.2.3
#1 lore raw

Hello Ryan,

please, find few of my minor notes below:

Quoted 5 lines

+/*
+ * ck804xrom.c
+ *
+ * Normal mappings of chips in physical memory
+ * $Id: ck804xrom.c,v 1.1 2005/01/06 16:58:24 dolsen Exp $

No need to dubmit CVS stuff
Also it would be nice to add your name at the header.

Quoted 3 lines

+ */

+#include <linux/config.h>

Don't include this file - this stuff is done by the Linux build system.

drivers/mtd/maps/ck804xrom.c line 28

Quoted 5 lines
drivers/mtd/maps/ck804xrom.c new file +5 -0
+#define MOD_NAME KBUILD_BASENAME
+
+#define ADDRESS_NAME_LEN 18
+
+#define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */

I personally would be happier to see a comment about what this macro is, not about that 64*1024 = 64KiB.

drivers/mtd/maps/ck804xrom.c line 84

Quoted 5 lines
drivers/mtd/maps/ck804xrom.c new file +5 -0
+	/* Free all of the mtd devices */
+	list_for_each_entry_safe(map, scratch, &window->maps, list) {
+		if (map->rsrc.parent) {
+			release_resource(&map->rsrc);
+		}

{} for one-line operators are not needed as well as all over the code - that's a linux coding style convention.

drivers/mtd/maps/ck804xrom.c line 138

Quoted 4 lines
drivers/mtd/maps/ck804xrom.c new file +4 -0
+        pci_write_config_byte(pdev, 0x88, byte | (1<<6));
+	}
+	else {
+		window->phys = 0xffff0000; /* 64KiB */

Please, use } else { instead.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#2 lore raw
Quoted 2 lines · Artem Bityutskiy
Quoted 1 line

+ * $Id: ck804xrom.c,v 1.1 2005/01/06 16:58:24 dolsen Exp $

No need to dubmit CVS stuff

Oops.

Quoted 1 line

Also it would be nice to add your name at the header.

Sure, but I'm not the original author. I'll put his name in as well as mine.

Quoted 2 lines
Quoted 1 line

+#include <linux/config.h>

Don't include this file - this stuff is done by the Linux build system.

Didn't catch that. I'll remove it.

Quoted 3 lines
Quoted 1 line

+#define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */

I personally would be happier to see a comment about what this macro is, not about that 64*1024 = 64KiB.

Sure.

Quoted 4 lines

{} for one-line operators are not needed as well as all over the code - that's a linux coding style convention.

Please, use } else { instead.

No problem. I should have checked for this already.

Thanks.

Signature · 2 lines
Ryan Jackson
Linux Networx
#3 lore raw
In reply to Ryan Jackson
Quoted 3 lines · Ryan Jackson

From: Dave Olsen <[email protected]>

Add support for accessing BIOS flash chips connected to the NVIDIA ck804 southbridge.

This is very reminiscent of the changes you made recently to the amd76xrom driver. Can they be merged?

Please fix 'KB' to 'KiB' and 'MB' to 'MiB' if you really mean powers of two and not powers of ten.

Signature · 1 line
dwmw2
#4 lore raw
Quoted 2 lines · David Woodhouse

This is very reminiscent of the changes you made recently to the amd76xrom driver. Can they be merged?

Technically yes, but I'm not totally convinced that makes sense. They are two completely different southbridges and the registers for each are different.

The code that loops over the window checking for chips is definitely generic. The amd76xrom, esb2rom, and the ck804xrom drivers all use it. Perhaps that bit and anything related could be shared.

Quoted 2 lines

Please fix 'KB' to 'KiB' and 'MB' to 'MiB' if you really mean powers of two and not powers of ten.

Okay, I'll change that.

Thanks.

Signature · 2 lines
Ryan Jackson
Linux Networx