From: Andi Kleen <andi@firstfloor.org>
To: linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com
Subject: [PATCH] [2/22] Remove unchecked_isa in BusLogic
Date: Mon, 25 Feb 2008 00:35:14 +0100 (CET) [thread overview]
Message-ID: <20080224233515.0125E1B4183@basil.firstfloor.org> (raw)
In-Reply-To: <200802251235.889863872@firstfloor.org>
- ->cmnd handling audited and does always copy
- Allocate hostdata separately
- Enable sense_buffer isa bounce buffering
- Remove unchecked_isa_dma
- Enable block layer bouncing explicitely for isa adapters
Untested due to lack of hardware
Signed-off-by: Andi Kleen <ak@suse.de>
---
drivers/scsi/BusLogic.c | 74 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 56 insertions(+), 18 deletions(-)
Index: linux/drivers/scsi/BusLogic.c
===================================================================
--- linux.orig/drivers/scsi/BusLogic.c
+++ linux/drivers/scsi/BusLogic.c
@@ -62,6 +62,11 @@
static struct scsi_host_template Bus_Logic_template;
+struct host_ptr {
+ struct BusLogic_HostAdapter *host;
+};
+#define bl_shost_priv(shost) (((struct host_ptr *)shost_priv(shost))->host)
+
/*
BusLogic_DriverOptionsCount is a count of the number of BusLogic Driver
Options specifications provided via the Linux Kernel Command Line or via
@@ -124,6 +129,12 @@ static int BusLogic_ProbeInfoCount;
static struct BusLogic_ProbeInfo *BusLogic_ProbeInfoList;
+static int buslogic_adjust_queue(struct scsi_device *device)
+{
+ if (device->host->sense_buffer_mask)
+ blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_ISA);
+ return 0;
+}
/*
BusLogic_CommandFailureReason holds a string identifying the reason why a
@@ -152,7 +163,7 @@ static void BusLogic_AnnounceDriver(stru
static const char *BusLogic_DriverInfo(struct Scsi_Host *Host)
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(Host);
return HostAdapter->FullModelName;
}
@@ -1607,9 +1618,6 @@ static bool __init BusLogic_ReadHostAdap
BIOS_Address is 0.
*/
HostAdapter->BIOS_Address = ExtendedSetupInformation.BIOS_Address << 12;
- /*
- ISA Host Adapters require Bounce Buffers if there is more than 16MB memory.
- */
if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus && (void *) high_memory > (void *) MAX_DMA_ADDRESS)
HostAdapter->BounceBuffersRequired = true;
/*
@@ -2128,7 +2136,9 @@ static void __init BusLogic_InitializeHo
Host->this_id = HostAdapter->SCSI_ID;
Host->can_queue = HostAdapter->DriverQueueDepth;
Host->sg_tablesize = HostAdapter->DriverScatterGatherLimit;
- Host->unchecked_isa_dma = HostAdapter->BounceBuffersRequired;
+ if (HostAdapter->BounceBuffersRequired) {
+ Host->sense_buffer_mask = DMA_24BIT_MASK;
+ }
Host->cmd_per_lun = HostAdapter->UntaggedQueueDepth;
}
@@ -2142,7 +2152,7 @@ static void __init BusLogic_InitializeHo
*/
static int BusLogic_SlaveConfigure(struct scsi_device *Device)
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Device->host->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(Device->host);
int TargetID = Device->id;
int QueueDepth = HostAdapter->QueueDepth[TargetID];
@@ -2167,6 +2177,34 @@ static int BusLogic_SlaveConfigure(struc
return 0;
}
+static struct Scsi_Host *buslogic_host_alloc(gfp_t gfp)
+{
+ struct BusLogic_HostAdapter *board;
+ struct Scsi_Host *shost;
+ shost = scsi_host_alloc(&Bus_Logic_template, sizeof(struct host_ptr));
+ if (!shost)
+ return NULL;
+
+ board = (void *)__get_free_pages(gfp|GFP_KERNEL,
+ get_order(sizeof(struct BusLogic_HostAdapter)));
+ if (!board) {
+ scsi_host_put(shost);
+ return NULL;
+ }
+
+ memset(board, 0, sizeof(struct BusLogic_HostAdapter));
+ bl_shost_priv(shost) = board;
+
+ return shost;
+}
+
+static void buslogic_free_host(struct Scsi_Host *shost)
+{
+ free_pages((unsigned long)bl_shost_priv(shost),
+ get_order(sizeof(struct BusLogic_HostAdapter)));
+ scsi_host_put(shost);
+}
+
/*
BusLogic_DetectHostAdapter probes for BusLogic Host Adapters at the standard
I/O Addresses where they may be located, initializing, registering, and
@@ -2267,12 +2305,12 @@ static int __init BusLogic_init(void)
Register the SCSI Host structure.
*/
- Host = scsi_host_alloc(&Bus_Logic_template, sizeof(struct BusLogic_HostAdapter));
+ Host = buslogic_host_alloc(PrototypeHostAdapter->BounceBuffersRequired ? GFP_DMA : 0);
if (Host == NULL) {
release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
continue;
}
- HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata;
+ HostAdapter = bl_shost_priv(Host);
memcpy(HostAdapter, PrototypeHostAdapter, sizeof(struct BusLogic_HostAdapter));
HostAdapter->SCSI_Host = Host;
HostAdapter->HostNumber = Host->host_no;
@@ -2318,7 +2356,7 @@ static int __init BusLogic_init(void)
BusLogic_DestroyCCBs(HostAdapter);
BusLogic_ReleaseResources(HostAdapter);
list_del(&HostAdapter->host_list);
- scsi_host_put(Host);
+ buslogic_free_host(Host);
ret = -ENOMEM;
} else {
BusLogic_InitializeHostStructure(HostAdapter,
@@ -2332,7 +2370,7 @@ static int __init BusLogic_init(void)
BusLogic_DestroyCCBs(HostAdapter);
BusLogic_ReleaseResources(HostAdapter);
list_del(&HostAdapter->host_list);
- scsi_host_put(Host);
+ buslogic_free_host(Host);
ret = -ENODEV;
} else {
scsi_scan_host(Host);
@@ -2351,7 +2389,7 @@ static int __init BusLogic_init(void)
BusLogic_DestroyCCBs(HostAdapter);
BusLogic_ReleaseResources(HostAdapter);
list_del(&HostAdapter->host_list);
- scsi_host_put(Host);
+ buslogic_free_host(Host);
ret = -ENODEV;
}
}
@@ -2395,7 +2433,7 @@ static int __exit BusLogic_ReleaseHostAd
*/
list_del(&HostAdapter->host_list);
- scsi_host_put(Host);
+ buslogic_free_host(Host);
return 0;
}
@@ -2783,7 +2821,7 @@ static bool BusLogic_WriteOutgoingMailbo
static int BusLogic_host_reset(struct scsi_cmnd * SCpnt)
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) SCpnt->device->host->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(SCpnt->device->host);
unsigned int id = SCpnt->device->id;
struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id];
@@ -2805,7 +2843,7 @@ static int BusLogic_host_reset(struct sc
static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *))
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(Command->device->host);
struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id];
struct BusLogic_TargetStatistics *TargetStatistics = HostAdapter->TargetStatistics;
unsigned char *CDB = Command->cmnd;
@@ -2998,7 +3036,7 @@ static int BusLogic_QueueCommand(struct
static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(Command->device->host);
int TargetID = Command->device->id;
struct BusLogic_CCB *CCB;
@@ -3128,7 +3166,7 @@ static int BusLogic_ResetHostAdapter(str
static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_device *Device, sector_t capacity, int *Parameters)
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) sdev->host->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(sdev->host);
struct BIOS_DiskParameters *DiskParameters = (struct BIOS_DiskParameters *) Parameters;
unsigned char *buf;
if (HostAdapter->ExtendedTranslationEnabled && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */ ) {
@@ -3199,7 +3237,7 @@ static int BusLogic_BIOSDiskParameters(s
static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *shost, char *ProcBuffer, char **StartPointer, off_t Offset, int BytesAvailable, int WriteFlag)
{
- struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata;
+ struct BusLogic_HostAdapter *HostAdapter = bl_shost_priv(shost);
struct BusLogic_TargetStatistics *TargetStatistics;
int TargetID, Length;
char *Buffer;
@@ -3572,9 +3610,9 @@ static struct scsi_host_template Bus_Log
#if 0
.eh_abort_handler = BusLogic_AbortCommand,
#endif
- .unchecked_isa_dma = 1,
.max_sectors = 128,
.use_clustering = ENABLE_CLUSTERING,
+ .slave_alloc = buslogic_adjust_queue,
};
/*
next prev parent reply other threads:[~2008-02-24 23:51 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-24 23:35 [PATCH] [0/22] Remove isa_unchecked_dma and some more GFP_DMAs in the mid layer Andi Kleen
2008-02-24 23:35 ` [PATCH] [1/22] Add new sense_buffer_mask host template field Andi Kleen
2008-02-25 14:48 ` James Bottomley
2008-02-25 15:01 ` Andi Kleen
2008-02-24 23:35 ` Andi Kleen [this message]
2008-02-24 23:35 ` [PATCH] [3/22] Remove unchecked_isa_dma in advansys.c Andi Kleen
2008-02-25 21:47 ` Matthew Wilcox
2008-02-25 22:40 ` Andi Kleen
2008-02-25 22:50 ` Matthew Wilcox
2008-02-25 22:54 ` Jeff Garzik
2008-02-25 22:58 ` James Bottomley
2008-02-26 3:44 ` Andi Kleen
2008-02-26 15:18 ` James Bottomley
2008-02-26 18:40 ` Matthew Wilcox
2008-02-26 13:56 ` Matthew Wilcox
2008-02-24 23:35 ` [PATCH] [4/22] Remove unchecked_isa_dma in gdth Andi Kleen
2008-02-24 23:35 ` [PATCH] [6/22] Remove unchecked_isa_dma in aha1542 Andi Kleen
2008-02-24 23:35 ` [PATCH] [7/22] Remove unchecked_isa_dma in aha152x/wd7000/sym53c416/u14-34f/NCR53c406a Andi Kleen
2008-02-24 23:35 ` [PATCH] [8/22] Remove random noop unchecked_isa_dma users Andi Kleen
2008-02-25 14:19 ` Salyzyn, Mark
2008-02-24 23:35 ` [PATCH] [10/22] Remove unchecked_isa_dma support for hostdata Andi Kleen
2008-02-24 23:35 ` [PATCH] [11/22] Remove unchecked_isa_dma checks in sg.c Andi Kleen
2008-02-24 23:35 ` [PATCH] [12/22] Remove GFP_DMAs/unchecked_isa_dma checks in scsi_scan.c Andi Kleen
2008-02-25 14:46 ` James Bottomley
2008-02-25 14:58 ` Andi Kleen
2008-02-25 15:04 ` James Bottomley
2008-02-25 15:11 ` Andi Kleen
2008-02-25 15:45 ` James Bottomley
2008-02-25 16:34 ` Andi Kleen
2008-02-24 23:35 ` [PATCH] [13/22] Don't disable direct_io for unchecked_isa_dma in st.c Andi Kleen
2008-02-24 23:35 ` [PATCH] [14/22] Remove automatic block layer bouncing for unchecked_isa_dma Andi Kleen
2008-02-24 23:35 ` [PATCH] [15/22] Remove GFP_DMA use in sr_ioctl Andi Kleen
2008-02-24 23:35 ` [PATCH] [16/22] Remove unchecked_isa_dma from sysfs Andi Kleen
2008-02-24 23:35 ` [PATCH] [17/22] Switch to a single SCSI command pool Andi Kleen
2008-02-24 23:35 ` [PATCH] [18/22] Finally remove unchecked_isa_dma support for Cmnds Andi Kleen
2008-02-24 23:35 ` [PATCH] [19/22] Finally kill unchecked_isa_dma Andi Kleen
2008-02-24 23:35 ` [PATCH] [20/22] Remove GFP_DMA in sr.c Andi Kleen
2008-02-24 23:35 ` [PATCH] [21/22] Remove GFP_DMA in ch.c Andi Kleen
2008-02-24 23:35 ` [PATCH] [22/22] Remove GFP_DMA in sr_vendor.c Andi Kleen
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=20080224233515.0125E1B4183@basil.firstfloor.org \
--to=andi@firstfloor.org \
--cc=James.Bottomley@HansenPartnership.com \
--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;
as well as URLs for NNTP newsgroup(s).