e1000: Remove unneeded and unwanted memsets
[linux-2.6/linux-loongson.git] / drivers / ata / pata_isapnp.c
blob40ca2b82b7fc7bf9f9a670f613fe680b6dce6604
2 /*
3 * pata-isapnp.c - ISA PnP PATA controller driver.
4 * Copyright 2005/2006 Red Hat Inc <alan@redhat.com>, all rights reserved.
6 * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru>
7 */
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/isapnp.h>
12 #include <linux/init.h>
13 #include <linux/blkdev.h>
14 #include <linux/delay.h>
15 #include <scsi/scsi_host.h>
16 #include <linux/ata.h>
17 #include <linux/libata.h>
19 #define DRV_NAME "pata_isapnp"
20 #define DRV_VERSION "0.1.5"
22 static struct scsi_host_template isapnp_sht = {
23 .module = THIS_MODULE,
24 .name = DRV_NAME,
25 .ioctl = ata_scsi_ioctl,
26 .queuecommand = ata_scsi_queuecmd,
27 .can_queue = ATA_DEF_QUEUE,
28 .this_id = ATA_SHT_THIS_ID,
29 .sg_tablesize = LIBATA_MAX_PRD,
30 .max_sectors = ATA_MAX_SECTORS,
31 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
32 .emulated = ATA_SHT_EMULATED,
33 .use_clustering = ATA_SHT_USE_CLUSTERING,
34 .proc_name = DRV_NAME,
35 .dma_boundary = ATA_DMA_BOUNDARY,
36 .slave_configure = ata_scsi_slave_config,
37 .slave_destroy = ata_scsi_slave_destroy,
38 .bios_param = ata_std_bios_param,
41 static struct ata_port_operations isapnp_port_ops = {
42 .port_disable = ata_port_disable,
43 .tf_load = ata_tf_load,
44 .tf_read = ata_tf_read,
45 .check_status = ata_check_status,
46 .exec_command = ata_exec_command,
47 .dev_select = ata_std_dev_select,
49 .freeze = ata_bmdma_freeze,
50 .thaw = ata_bmdma_thaw,
51 .error_handler = ata_bmdma_error_handler,
52 .post_internal_cmd = ata_bmdma_post_internal_cmd,
54 .qc_prep = ata_qc_prep,
55 .qc_issue = ata_qc_issue_prot,
57 .data_xfer = ata_pio_data_xfer,
59 .irq_handler = ata_interrupt,
60 .irq_clear = ata_bmdma_irq_clear,
62 .port_start = ata_port_start,
63 .port_stop = ata_port_stop,
64 .host_stop = ata_host_stop
67 /**
68 * isapnp_init_one - attach an isapnp interface
69 * @idev: PnP device
70 * @dev_id: matching detect line
72 * Register an ISA bus IDE interface. Such interfaces are PIO 0 and
73 * non shared IRQ.
76 static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev_id)
78 struct ata_probe_ent ae;
80 if (pnp_port_valid(idev, 0) == 0)
81 return -ENODEV;
83 /* FIXME: Should selected polled PIO here not fail */
84 if (pnp_irq_valid(idev, 0) == 0)
85 return -ENODEV;
87 memset(&ae, 0, sizeof(struct ata_probe_ent));
88 INIT_LIST_HEAD(&ae.node);
89 ae.dev = &idev->dev;
90 ae.port_ops = &isapnp_port_ops;
91 ae.sht = &isapnp_sht;
92 ae.n_ports = 1;
93 ae.pio_mask = 1; /* ISA so PIO 0 cycles */
94 ae.irq = pnp_irq(idev, 0);
95 ae.irq_flags = 0;
96 ae.port_flags = ATA_FLAG_SLAVE_POSS;
97 ae.port[0].cmd_addr = pnp_port_start(idev, 0);
99 if (pnp_port_valid(idev, 1) == 0) {
100 ae.port[0].altstatus_addr = pnp_port_start(idev, 1);
101 ae.port[0].ctl_addr = pnp_port_start(idev, 1);
102 ae.port_flags |= ATA_FLAG_SRST;
104 ata_std_ports(&ae.port[0]);
106 if (ata_device_add(&ae) == 0)
107 return -ENODEV;
108 return 0;
112 * isapnp_remove_one - unplug an isapnp interface
113 * @idev: PnP device
115 * Remove a previously configured PnP ATA port. Called only on module
116 * unload events as the core does not currently deal with ISAPnP docking.
119 static void isapnp_remove_one(struct pnp_dev *idev)
121 struct device *dev = &idev->dev;
122 struct ata_host *host = dev_get_drvdata(dev);
124 ata_host_remove(host);
125 dev_set_drvdata(dev, NULL);
128 static struct pnp_device_id isapnp_devices[] = {
129 /* Generic ESDI/IDE/ATA compatible hard disk controller */
130 {.id = "PNP0600", .driver_data = 0},
131 {.id = ""}
134 static struct pnp_driver isapnp_driver = {
135 .name = DRV_NAME,
136 .id_table = isapnp_devices,
137 .probe = isapnp_init_one,
138 .remove = isapnp_remove_one,
141 static int __init isapnp_init(void)
143 return pnp_register_driver(&isapnp_driver);
146 static void __exit isapnp_exit(void)
148 pnp_unregister_driver(&isapnp_driver);
151 MODULE_AUTHOR("Alan Cox");
152 MODULE_DESCRIPTION("low-level driver for ISA PnP ATA");
153 MODULE_LICENSE("GPL");
154 MODULE_VERSION(DRV_VERSION);
156 module_init(isapnp_init);
157 module_exit(isapnp_exit);