lkml.org 
[lkml]   [2002]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: sys & legacy buses plus interrupt controller and IDE support
    Hi Pavel,

    On Tue, Feb 12, 2002 at 09:59:55AM +0100, Pavel Machek wrote:
    > Here it goes. For now I only put one device on each bus (sys &
    > legacy), but I'll quickly expand it once merged. Please apply,

    please take a quick look at attached patch. It's your patch with
    minor modification, hwif->pci_dev used as parent for ide interface.

    I made it because it was strange to see HPT370 IDE interface
    under legacy bus :))

    Best regards.

    --
    Andrey Panin | Embedded systems software engineer
    pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
    diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide-disk.c /linux/drivers/ide/ide-disk.c
    --- /linux.vanilla/drivers/ide/ide-disk.c Wed Feb 13 21:47:39 2002
    +++ /linux/drivers/ide/ide-disk.c Wed Feb 13 21:49:20 2002
    @@ -925,12 +925,16 @@
    ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
    }

    +static struct device_driver idedisk_device_driver = {
    +};
    +
    static void idedisk_setup (ide_drive_t *drive)
    {
    int i;

    struct hd_driveid *id = drive->id;
    unsigned long capacity;
    + int myid = -1;

    idedisk_add_settings(drive);

    @@ -953,11 +957,20 @@
    ide_hwif_t *hwif = HWIF(drive);

    if (drive != &hwif->drives[i]) continue;
    + myid = i;
    hwif->gd->de_arr[i] = drive->de;
    if (drive->removable)
    hwif->gd->flags[i] |= GENHD_FL_REMOVABLE;
    break;
    }
    + {
    + ide_hwif_t *hwif = HWIF(drive);
    + sprintf(drive->device.bus_id, "%d", myid);
    + sprintf(drive->device.name, "ide-disk");
    + drive->device.driver = &idedisk_device_driver;
    + drive->device.parent = &hwif->device;
    + device_register(&drive->device);
    + }

    /* Extract geometry if we did not already have one for the drive */
    if (!drive->cyl || !drive->head || !drive->sect) {
    @@ -1033,6 +1046,7 @@

    static int idedisk_cleanup (ide_drive_t *drive)
    {
    + put_device(&drive->device);
    if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
    if (do_idedisk_flushcache(drive))
    printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
    diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide-pnp.c /linux/drivers/ide/ide-pnp.c
    --- /linux.vanilla/drivers/ide/ide-pnp.c Wed Feb 13 21:47:39 2002
    +++ /linux/drivers/ide/ide-pnp.c Wed Feb 13 23:04:24 2002
    @@ -57,6 +57,7 @@
    static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
    {
    hw_regs_t hw;
    + ide_hwif_t *hwif;
    int index;

    if (!enable)
    @@ -69,9 +70,10 @@
    generic_ide_offsets, (ide_ioreg_t) DEV_IO(dev, 1),
    0, NULL, DEV_IRQ(dev, 0));

    - index = ide_register_hw(&hw, NULL);
    + index = ide_register_hw(&hw, &hwif);

    if (index != -1) {
    + hwif->pci_dev = dev;
    printk("ide%d: %s IDE interface\n", index, DEV_NAME(dev));
    return 0;
    }
    diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide-probe.c /linux/drivers/ide/ide-probe.c
    --- /linux.vanilla/drivers/ide/ide-probe.c Wed Feb 13 21:47:39 2002
    +++ /linux/drivers/ide/ide-probe.c Wed Feb 13 23:21:59 2002
    @@ -46,6 +46,7 @@
    #include <linux/delay.h>
    #include <linux/ide.h>
    #include <linux/spinlock.h>
    +#include <linux/pci.h>

    #include <asm/byteorder.h>
    #include <asm/irq.h>
    @@ -469,6 +470,14 @@

    static void hwif_register (ide_hwif_t *hwif)
    {
    + sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
    + sprintf(hwif->device.name, "ide");
    + hwif->device.driver_data = hwif;
    + if (hwif->pci_dev)
    + hwif->device.parent = &hwif->pci_dev->dev;
    + else
    + hwif->device.parent = &device_legacy;
    + device_register(&hwif->device);
    if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) ==
    ((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) {
    ide_request_region(hwif->io_ports[IDE_DATA_OFFSET], 8, hwif->name);
    diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide.c /linux/drivers/ide/ide.c
    --- /linux.vanilla/drivers/ide/ide.c Wed Feb 13 21:47:39 2002
    +++ /linux/drivers/ide/ide.c Wed Feb 13 21:49:20 2002
    @@ -2027,6 +2027,7 @@
    hwif = &ide_hwifs[index];
    if (!hwif->present)
    goto abort;
    + put_device(&hwif->device);
    for (unit = 0; unit < MAX_DRIVES; ++unit) {
    drive = &hwif->drives[unit];
    if (!drive->present)[unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2005-03-22 13:24    [W:0.028 / U:0.212 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site