From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Kevin Tappe <kevin@zerodivide.de>
Cc: linux-scsi@vger.kernel.org, jejb <james.bottomley@steeleye.com>
Subject: [PATCH] g_NCR5380 - 2.6.0 - problem with reloading module
Date: Sun, 11 Jan 2004 15:30:51 -0800 [thread overview]
Message-ID: <20040111153051.03d56e7e.rddunlap@osdl.org> (raw)
In-Reply-To: <20040110193814.GA371@nihil.tappe.netz>
[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]
On Sat, 10 Jan 2004 20:38:15 +0100 Kevin Tappe <kevin@zerodivide.de> wrote:
| Hi,
|
| On Fri, Jan 09, 2004 at 11:26:56AM -0800, Randy.Dunlap wrote:
| > Can you show that 'modprobe -v g_NCR5380' output for the first time
| > that the driver is loaded also?
|
| nihil:~# modprobe -v g_NCR5380
| insmod /lib/modules/2.6.0/kernel/drivers/scsi/g_NCR5380.ko ncr_irq=255
| ncr_addr=0x280 dtc_3181e=1
no output from the driver??
That's OK though, I found the problem.
| > What's in /proc/scsi/g_NCR5380 while the driver is loaded the first time?
| > and in /proc/ioports and /proc/iomem?
|
| nihil:~# cat /proc/scsi/g_NCR5380/0
| SCSI host number 0 : Generic NCR5380/NCR53C400 Scsi Driver
| Generic NCR5380 driver version 1
| NCR5380 core version 7
| NO NCR53C400 driver extensions
| Using port mapping at port 0x280, no interrupt
| REQ not asserted, phase unknown.
| No currently connected command
| issue_queue
| disconnected_queue
|
| nihil:~# cat /proc/ioports
...
| 0213-0213 : ISAPnP
| 0220-022f : SoundBlaster
| 0260-0261 : pnp 00:11
| 0280-028f : ncr53c80
| 02f8-02ff : serial
...
| 0a79-0a79 : isapnp write
...
| f800-f81f : pnp 00:12
| f820-f83f : pnp 00:12
| fc00-fc0f : pnp 00:12
|
| nihil:~# cat /proc/iomem
...
|
| > Also, the latter 2 files after the driver is removed.
| > and in /proc/scsi after the driver is removed.
|
| nihil:~# cat /proc/ioports
| Segmentation fault
Yes, I see that one also.
The problem is that the detect function requests an IO region
of 16 bytes (at least when a command line override parameter is
used) but the release function only tries to release 8 bytes,
and this request isn't done because it doesn't match any allocated
IO region. [NCR53C400 extensions are not enabled, so
NCR5380_region_size is 8, not 16, but the request uses
NCR5380_region_size regardless.]
If enough kernel messages are enabled (like 'echo 9 > /proc/sysrq-trigger'),
you should have seen this message when the driver module was unloaded:
Trying to free nonexistent resource <280-287>
because 280-28f was allocated.
Options to fix this:
1/ if the release_region() in the release function fails, have it try
a second time with a different region size; (easy, sorta sloppy);
2/ save the allocated region size in instance->n_io_ports and release
that size only; <<<<< PATCH ATTACHED <<<<<
3/ if an override was used, release a region size of 16 in the
release function; (this only looks clean for one adapter, not
multiple)
Kevin, please test and report the results. I think that the
module will be reloadable now.
Patch comments? If no problems, James, please apply.
| nihil:~# cat /proc/iomem
...
|
| The files in /proc/scsi are attached. Hope that helps...
| -Kevin
| --
--
~Randy
[-- Attachment #2: gNCR_regions.patch --]
[-- Type: application/octet-stream, Size: 2183 bytes --]
description: release region of allocated (requested) size
product_versions: Linux 2.6.1
diffstat:=
drivers/scsi/g_NCR5380.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff -Naurp ./drivers/scsi/g_NCR5380.c~fakehw ./drivers/scsi/g_NCR5380.c
--- ./drivers/scsi/g_NCR5380.c~fakehw 2004-01-08 22:59:10.000000000 -0800
+++ ./drivers/scsi/g_NCR5380.c 2004-01-11 15:21:00.000000000 -0800
@@ -290,6 +290,7 @@ int __init generic_NCR5380_detect(Scsi_H
static int current_override = 0;
int count, i;
unsigned int *ports;
+ unsigned long region_size = 16;
static unsigned int __initdata ncr_53c400a_ports[] = {
0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
};
@@ -420,6 +421,7 @@ int __init generic_NCR5380_detect(Scsi_H
/* Not a 53C400A style setup - just grab */
if(!(request_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380")))
continue;
+ region_size = NCR5380_region_size;
}
#else
if(!request_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380"))
@@ -428,7 +430,7 @@ int __init generic_NCR5380_detect(Scsi_H
instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
if (instance == NULL) {
#ifndef CONFIG_SCSI_G_NCR5380_MEM
- release_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
+ release_region(overrides[current_override].NCR5380_map_name, region_size);
#else
release_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
#endif
@@ -436,6 +438,9 @@ int __init generic_NCR5380_detect(Scsi_H
}
instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
+#ifndef CONFIG_SCSI_G_NCR5380_MEM
+ instance->n_io_port = region_size;
+#endif
NCR5380_init(instance, flags);
@@ -498,7 +503,7 @@ int generic_NCR5380_release_resources(st
NCR5380_setup(instance);
#ifndef CONFIG_SCSI_G_NCR5380_MEM
- release_region(instance->NCR5380_instance_name, NCR5380_region_size);
+ release_region(instance->NCR5380_instance_name, instance->n_io_port);
#else
release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
#endif
prev parent reply other threads:[~2004-01-11 23:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-05 22:42 g_NCR5380 - 2.6.0 - problem with reloading module Kevin Tappe
2004-01-09 19:26 ` Randy.Dunlap
[not found] ` <20040110193814.GA371@nihil.tappe.netz>
2004-01-11 23:30 ` Randy.Dunlap [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040111153051.03d56e7e.rddunlap@osdl.org \
--to=rddunlap@osdl.org \
--cc=james.bottomley@steeleye.com \
--cc=kevin@zerodivide.de \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox