-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ide: move legacy ISA/VLB ports handling to ide-legacy.c (v2)
* Move legacy ISA/VLB ports handling from ide-probe.c to ide-legacy.c. * Add CONFIG_IDE_LEGACY config option to be selected by host drivers needing ide-legacy.c. v2: Fix CONFIG_IDE_LEGACY not being defined in Kconfig. (from Takashi Iwai <tiwai@suse.de>) There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
- Loading branch information
Bartlomiej Zolnierkiewicz
committed
Dec 29, 2008
1 parent
e2984c6
commit 7f92b11
Showing
4 changed files
with
67 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <linux/kernel.h> | ||
#include <linux/ide.h> | ||
|
||
static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw, | ||
u8 port_no, const struct ide_port_info *d, | ||
unsigned long config) | ||
{ | ||
unsigned long base, ctl; | ||
int irq; | ||
|
||
if (port_no == 0) { | ||
base = 0x1f0; | ||
ctl = 0x3f6; | ||
irq = 14; | ||
} else { | ||
base = 0x170; | ||
ctl = 0x376; | ||
irq = 15; | ||
} | ||
|
||
if (!request_region(base, 8, d->name)) { | ||
printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", | ||
d->name, base, base + 7); | ||
return; | ||
} | ||
|
||
if (!request_region(ctl, 1, d->name)) { | ||
printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n", | ||
d->name, ctl); | ||
release_region(base, 8); | ||
return; | ||
} | ||
|
||
ide_std_init_ports(hw, base, ctl); | ||
hw->irq = irq; | ||
hw->chipset = d->chipset; | ||
hw->config = config; | ||
|
||
hws[port_no] = hw; | ||
} | ||
|
||
int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) | ||
{ | ||
hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; | ||
|
||
memset(&hw, 0, sizeof(hw)); | ||
|
||
if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0) | ||
ide_legacy_init_one(hws, &hw[0], 0, d, config); | ||
ide_legacy_init_one(hws, &hw[1], 1, d, config); | ||
|
||
if (hws[0] == NULL && hws[1] == NULL && | ||
(d->host_flags & IDE_HFLAG_SINGLE)) | ||
return -ENOENT; | ||
|
||
return ide_host_add(d, hws, NULL); | ||
} | ||
EXPORT_SYMBOL_GPL(ide_legacy_device_add); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters