diff options
author | Ryan Jackson <rjackson@lnxi.com> | 2006-10-20 17:41:01 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-10-21 11:15:43 -0400 |
commit | c9073ce02adfa273a3d6d53eac8c4c035510ad9c (patch) | |
tree | 6191b00b2241ff73c6139a7a513b17073e10c46a /drivers/mtd | |
parent | 1ef93a0f668c8736cb6b6c3a43a5b8101efa24af (diff) |
[MTD] MAPS: Add parameter to amd76xrom to override rom window size
The 2 bits controlling the window size are often set to allow reading the
BIOS, but too small to allow writing, since the lock registers are 4MiB
lower in the address space than the data. This is intended to prevent
flashing the bios, perhaps accidentally.
The bits are 6 and 7. If both bits are set, it is a 5MiB window. If only
the 7 Bit is set, it is a 4MiB window. Otherwise, it is a 64KiB window.
This parameter allows the driver to override the BIOS settings.
Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/amd76xrom.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index 797caffb20b1..78b671172bb2 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/version.h> | ||
10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
12 | #include <asm/io.h> | 13 | #include <asm/io.h> |
@@ -44,6 +45,23 @@ struct amd76xrom_map_info { | |||
44 | char map_name[sizeof(MOD_NAME) + 2 + ADDRESS_NAME_LEN]; | 45 | char map_name[sizeof(MOD_NAME) + 2 + ADDRESS_NAME_LEN]; |
45 | }; | 46 | }; |
46 | 47 | ||
48 | /* The 2 bits controlling the window size are often set to allow reading | ||
49 | * the BIOS, but too small to allow writing, since the lock registers are | ||
50 | * 4MiB lower in the address space than the data. | ||
51 | * | ||
52 | * This is intended to prevent flashing the bios, perhaps accidentally. | ||
53 | * | ||
54 | * This parameter allows the normal driver to over-ride the BIOS settings. | ||
55 | * | ||
56 | * The bits are 6 and 7. If both bits are set, it is a 5MiB window. | ||
57 | * If only the 7 Bit is set, it is a 4MiB window. Otherwise, a | ||
58 | * 64KiB window. | ||
59 | * | ||
60 | */ | ||
61 | static uint win_size_bits; | ||
62 | module_param(win_size_bits, uint, 0); | ||
63 | MODULE_PARM_DESC(win_size_bits, "ROM window size bits override for 0x43 byte, normally set by BIOS."); | ||
64 | |||
47 | static struct amd76xrom_window amd76xrom_window = { | 65 | static struct amd76xrom_window amd76xrom_window = { |
48 | .maps = LIST_HEAD_INIT(amd76xrom_window.maps), | 66 | .maps = LIST_HEAD_INIT(amd76xrom_window.maps), |
49 | }; | 67 | }; |
@@ -95,6 +113,16 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, | |||
95 | /* Remember the pci dev I find the window in - already have a ref */ | 113 | /* Remember the pci dev I find the window in - already have a ref */ |
96 | window->pdev = pdev; | 114 | window->pdev = pdev; |
97 | 115 | ||
116 | /* Enable the selected rom window. This is often incorrectly | ||
117 | * set up by the BIOS, and the 4MiB offset for the lock registers | ||
118 | * requires the full 5MiB of window space. | ||
119 | * | ||
120 | * This 'write, then read' approach leaves the bits for | ||
121 | * other uses of the hardware info. | ||
122 | */ | ||
123 | pci_read_config_byte(pdev, 0x43, &byte); | ||
124 | pci_write_config_byte(pdev, 0x43, byte | win_size_bits ); | ||
125 | |||
98 | /* Assume the rom window is properly setup, and find it's size */ | 126 | /* Assume the rom window is properly setup, and find it's size */ |
99 | pci_read_config_byte(pdev, 0x43, &byte); | 127 | pci_read_config_byte(pdev, 0x43, &byte); |
100 | if ((byte & ((1<<7)|(1<<6))) == ((1<<7)|(1<<6))) { | 128 | if ((byte & ((1<<7)|(1<<6))) == ((1<<7)|(1<<6))) { |
@@ -129,12 +157,6 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, | |||
129 | (unsigned long long)window->rsrc.end); | 157 | (unsigned long long)window->rsrc.end); |
130 | } | 158 | } |
131 | 159 | ||
132 | #if 0 | ||
133 | |||
134 | /* Enable the selected rom window */ | ||
135 | pci_read_config_byte(pdev, 0x43, &byte); | ||
136 | pci_write_config_byte(pdev, 0x43, byte | rwindow->segen_bits); | ||
137 | #endif | ||
138 | 160 | ||
139 | /* Enable writes through the rom window */ | 161 | /* Enable writes through the rom window */ |
140 | pci_read_config_byte(pdev, 0x40, &byte); | 162 | pci_read_config_byte(pdev, 0x40, &byte); |