* RE: cciss patches for 2.4.21pre7
@ 2003-04-16 15:53 Miller, Mike (OS Dev)
2003-04-16 16:04 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Miller, Mike (OS Dev) @ 2003-04-16 15:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Cameron, Steve
This is the second of 3 patches to update the HP cciss driver to version 2.4.44 for the 2.4.21pre7 kernel. Patches should be applied in order.
Thanks,
mikem
2003/04/15
Changes:
1. Modifies the way we find the cciss config table. Required
for certain architecures.
diff -urN lx2421p7-1/drivers/block/cciss.c lx2421p7-1.1/drivers/block/cciss.c
--- lx2421p7-1/drivers/block/cciss.c Mon Apr 7 15:36:41 2003
+++ lx2421p7-1.1/drivers/block/cciss.c Mon Apr 7 15:44:06 2003
@@ -2438,25 +2438,54 @@
c->io_mem_addr = 0;
c->io_mem_length = 0;
}
+static int find_PCI_BAR_index(struct pci_dev *pdev,
+ unsigned long pci_bar_addr)
+{
+ int i, offset, mem_type, bar_type;
+ if (pci_bar_addr == PCI_BASE_ADDRESS_0) /* looking for BAR zero? */
+ return 0;
+ offset = 0;
+ for (i=0; i<DEVICE_COUNT_RESOURCE; i++) {
+ bar_type = pdev->resource[i].flags &
+ PCI_BASE_ADDRESS_SPACE;
+ if (bar_type == PCI_BASE_ADDRESS_SPACE_IO)
+ offset += 4;
+ else {
+ mem_type = pdev->resource[i].flags &
+ PCI_BASE_ADDRESS_MEM_TYPE_MASK;
+ switch (mem_type) {
+ case PCI_BASE_ADDRESS_MEM_TYPE_32:
+ case PCI_BASE_ADDRESS_MEM_TYPE_1M:
+ offset += 4; /* 32 bit */
+ break;
+ case PCI_BASE_ADDRESS_MEM_TYPE_64:
+ offset += 8;
+ break;
+ case PCI_BASE_ADDRESS_MEM_PREFETCH:
+ break;
+ }
+ }
+ if (offset == pci_bar_addr - PCI_BASE_ADDRESS_0)
+ return i+1;
+ }
+ return -1;
+ }
+
static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
{
ushort vendor_id, device_id, command;
unchar cache_line_size, latency_timer;
unchar irq, revision;
- uint addr[6];
__u32 board_id;
- int cfg_offset;
- int cfg_base_addr;
- int cfg_base_addr_index;
+ __u64 cfg_offset;
+ __u32 cfg_base_addr;
+ __u64 cfg_base_addr_index;
int i;
vendor_id = pdev->vendor;
device_id = pdev->device;
irq = pdev->irq;
- for(i=0; i<6; i++)
- addr[i] = pdev->resource[i].start;
-
if (pci_enable_device(pdev)) {
printk(KERN_ERR "cciss: Unable to Enable PCI device\n");
return -1;
@@ -2482,7 +2511,7 @@
return -1;
}
/* search for our IO range so we can protect it */
- for (i=0; i<6; i++) {
+ for (i=0; i<DEVICE_COUNT_RESOURCE; i++) {
/* is this an IO range */
if (pdev->resource[i].flags & 0x01) {
c->io_mem_addr = pdev->resource[i].start;
@@ -2492,6 +2521,7 @@
printk("IO value found base_addr[%d] %lx %lx\n", i,
c->io_mem_addr, c->io_mem_length);
#endif /* CCISS_DEBUG */
+ printk(KERN_DEBUG "IO range: %lx\n", c->io_mem_addr);
/* register the IO range */
if (!request_region( c->io_mem_addr,
c->io_mem_length, "cciss")) {
@@ -2511,7 +2541,7 @@
printk("device_id = %x\n", device_id);
printk("command = %x\n", command);
for(i=0; i<6; i++)
- printk("addr[%d] = %x\n", i, addr[i]);
+ printk("addr[%d] = %x\n", i, pdev->resource[i].start);
printk("revision = %x\n", revision);
printk("irq = %x\n", irq);
printk("cache_line_size = %x\n", cache_line_size);
@@ -2526,30 +2556,35 @@
* table
*/
- c->paddr = addr[0] ; /* addressing mode bits already removed */
+ c->paddr = pdev->resource[0].start; /* addressing mode bits already removed */
#ifdef CCISS_DEBUG
printk("address 0 = %x\n", c->paddr);
#endif /* CCISS_DEBUG */
- c->vaddr = remap_pci_mem(c->paddr, 200);
+ c->vaddr = remap_pci_mem(c->paddr, 200);
/* get the address index number */
cfg_base_addr = readl(c->vaddr + SA5_CTCFG_OFFSET);
- /* I am not prepared to deal with a 64 bit address value */
- cfg_base_addr &= 0xffff;
+ cfg_base_addr &= (__u32) 0x0000ffff;
#ifdef CCISS_DEBUG
printk("cfg base address = %x\n", cfg_base_addr);
#endif /* CCISS_DEBUG */
- cfg_base_addr_index = (cfg_base_addr - PCI_BASE_ADDRESS_0)/4;
+ cfg_base_addr_index =
+ find_PCI_BAR_index(pdev, cfg_base_addr);
#ifdef CCISS_DEBUG
printk("cfg base address index = %x\n", cfg_base_addr_index);
#endif /* CCISS_DEBUG */
+ if (cfg_base_addr_index == -1) {
+ printk(KERN_WARNING "cciss: Cannot find cfg_base_addr_index\n");
+ release_io_mem(hba[i]);
+ return -1;
+ }
cfg_offset = readl(c->vaddr + SA5_CTMEM_OFFSET);
#ifdef CCISS_DEBUG
printk("cfg offset = %x\n", cfg_offset);
#endif /* CCISS_DEBUG */
c->cfgtable = (CfgTable_struct *)
- remap_pci_mem((addr[cfg_base_addr_index] & 0xfffffff0)
+ remap_pci_mem(pdev->resource[cfg_base_addr_index].start
+ cfg_offset, sizeof(CfgTable_struct));
c->board_id = board_id;
diff -urN lx2421p7-1/drivers/block/cciss.h lx2421p7-1.1/drivers/block/cciss.h
--- lx2421p7-1/drivers/block/cciss.h Mon Apr 7 10:23:53 2003
+++ lx2421p7-1.1/drivers/block/cciss.h Mon Apr 7 15:39:38 2003
@@ -45,8 +45,8 @@
char firm_ver[4]; // Firmware version
struct pci_dev *pdev;
__u32 board_id;
- ulong vaddr;
- __u32 paddr;
+ unsigned long vaddr;
+ unsigned long paddr;
unsigned long io_mem_addr;
unsigned long io_mem_length;
CfgTable_struct *cfgtable;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cciss patches for 2.4.21pre7
2003-04-16 15:53 cciss patches for 2.4.21pre7 Miller, Mike (OS Dev)
@ 2003-04-16 16:04 ` Jeff Garzik
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2003-04-16 16:04 UTC (permalink / raw)
To: Miller, Mike (OS Dev); +Cc: linux-kernel, Cameron, Steve
On Wed, Apr 16, 2003 at 10:53:48AM -0500, Miller, Mike (OS Dev) wrote:
> - for (i=0; i<6; i++) {
> + for (i=0; i<DEVICE_COUNT_RESOURCE; i++) {
> /* is this an IO range */
> if (pdev->resource[i].flags & 0x01) {
> c->io_mem_addr = pdev->resource[i].start;
> @@ -2492,6 +2521,7 @@
> printk("IO value found base_addr[%d] %lx %lx\n", i,
> c->io_mem_addr, c->io_mem_length);
> #endif /* CCISS_DEBUG */
> + printk(KERN_DEBUG "IO range: %lx\n", c->io_mem_addr);
> /* register the IO range */
> if (!request_region( c->io_mem_addr,
> c->io_mem_length, "cciss")) {
> @@ -2511,7 +2541,7 @@
> printk("device_id = %x\n", device_id);
> printk("command = %x\n", command);
> for(i=0; i<6; i++)
> - printk("addr[%d] = %x\n", i, addr[i]);
> + printk("addr[%d] = %x\n", i, pdev->resource[i].start);
FWIW, if you care about source compatibility, or just like the
convenient wrappers, you can use
pci_resource_start(pdev, BAR#)
in place of
pdev->resource[i].start.
Ditto for .len and pci_resource_len() wrapper.
If you don't care, just ignore this message, the code otherwise looks ok.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* cciss patches for 2.4.21pre7
@ 2003-04-16 15:53 Miller, Mike (OS Dev)
0 siblings, 0 replies; 3+ messages in thread
From: Miller, Mike (OS Dev) @ 2003-04-16 15:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Cameron, Steve
This is the first of 3 patches to update the HP cciss driver to version 2.4.44 for the 2.4.21pre7 kernel. Patches should be applied in order.
Thanks,
mikem
2003/04/15
Changes:
1. Changes marketing name of 6400 to 6402.
2. Adds support for the 6404/256 expansion module.
diff -urN lx2421p7.orig/Documentation/cciss.txt lx2421p7-1/Documentation/cciss.txt
--- lx2421p7.orig/Documentation/cciss.txt Mon Apr 7 10:23:52 2003
+++ lx2421p7-1/Documentation/cciss.txt Mon Apr 7 15:27:12 2003
@@ -11,7 +11,8 @@
* SA 5312
* SA 641
* SA 642
- * SA 6400
+ * SA 6402
+ * SA 6404/256
If nodes are not already created in the /dev/cciss directory
diff -urN lx2421p7.orig/drivers/block/cciss.c lx2421p7-1/drivers/block/cciss.c
--- lx2421p7.orig/drivers/block/cciss.c Mon Apr 7 10:23:53 2003
+++ lx2421p7-1/drivers/block/cciss.c Mon Apr 7 15:33:15 2003
@@ -44,12 +44,12 @@
#include <linux/genhd.h>
#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
-#define DRIVER_NAME "HP CISS Driver (v 2.4.42)"
-#define DRIVER_VERSION CCISS_DRIVER_VERSION(2,4,42)
+#define DRIVER_NAME "HP CISS Driver (v 2.4.44)"
+#define DRIVER_VERSION CCISS_DRIVER_VERSION(2,4,44)
/* Embedded module documentation macros - see modules.h */
MODULE_AUTHOR("Charles M. White III - Hewlett-Packard Company");
-MODULE_DESCRIPTION("Driver for HP SA5xxx SA6xxx Controllers version 2.4.42");
+MODULE_DESCRIPTION("Driver for HP SA5xxx SA6xxx Controllers version 2.4.44");
MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400");
MODULE_LICENSE("GPL");
@@ -73,6 +73,8 @@
0x0E11, 0x409B, 0, 0, 0},
{ PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC,
0x0E11, 0x409C, 0, 0, 0},
+ { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC,
+ 0x0E11, 0x409D, 0, 0, 0},
{0,}
};
MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
@@ -90,7 +92,8 @@
{ 0x40830E11, "Smart Array 5312", &SA5B_access},
{ 0x409A0E11, "Smart Array 641", &SA5_access},
{ 0x409B0E11, "Smart Array 642", &SA5_access},
- { 0x409C0E11, "Smart Array 6400", &SA5_access},
+ { 0x409C0E11, "Smart Array 6402", &SA5_access},
+ { 0x409C0E11, "Smart Array 6404/256", &SA5_access},
};
/* How long to wait (in millesconds) for board to go into simple mode */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-16 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-16 15:53 cciss patches for 2.4.21pre7 Miller, Mike (OS Dev)
2003-04-16 16:04 ` Jeff Garzik
-- strict thread matches above, loose matches on Subject: below --
2003-04-16 15:53 Miller, Mike (OS Dev)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).