summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-pci.h
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2009-11-16 15:38:27 +0000
committermav <mav@FreeBSD.org>2009-11-16 15:38:27 +0000
commit0cf423f4bc725573827f0ae2dd6135ff185420b6 (patch)
treeefaf424fe83caf1bc785787b8411630fefbc407d /sys/dev/ata/ata-pci.h
parentfcc28e89e25a64898f3337bcad9dabf9745665a4 (diff)
downloadFreeBSD-src-0cf423f4bc725573827f0ae2dd6135ff185420b6.zip
FreeBSD-src-0cf423f4bc725573827f0ae2dd6135ff185420b6.tar.gz
Change the way in which AHCI+PATA combined controllers, such as JMicron
and Marvell handled. Instead of trying to attach two different drivers to single device, wrapping each call, make one of them (atajmicron, atamarvell) attach do device solely, but create child device for AHCI driver, passing it all required resources. It is quite easy, as none of resources are shared, except IRQ. As result, it: - makes drivers operation more independent and straitforward, - allows to use new ahci(4) driver with such devices, adding support for new features, such as PMP and NCQ, same time keeping legacy PATA support, - will allow to just drop old ataahci driver, when it's time come.
Diffstat (limited to 'sys/dev/ata/ata-pci.h')
-rw-r--r--sys/dev/ata/ata-pci.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/dev/ata/ata-pci.h b/sys/dev/ata/ata-pci.h
index 00c5962..f2a0e13 100644
--- a/sys/dev/ata/ata-pci.h
+++ b/sys/dev/ata/ata-pci.h
@@ -36,6 +36,8 @@ struct ata_chip_id {
char *text;
};
+#define ATA_PCI_MAX_CH 8
+
/* structure describing a PCI ATA controller */
struct ata_pci_controller {
device_t dev;
@@ -65,7 +67,7 @@ struct ata_pci_controller {
struct {
void (*function)(void *);
void *argument;
- } interrupt[8]; /* XXX SOS max ch# for now */
+ } interrupt[ATA_PCI_MAX_CH];
void *chipset_data;
};
@@ -486,6 +488,11 @@ int ata_pci_attach(device_t dev);
int ata_pci_detach(device_t dev);
int ata_pci_suspend(device_t dev);
int ata_pci_resume(device_t dev);
+int ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result);
+int ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value);
+uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width);
+void ata_pci_write_config(device_t dev, device_t child, int reg,
+ uint32_t val, int width);
struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r);
int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep);
@@ -509,12 +516,6 @@ int ata_mode2idx(int mode);
/* global prototypes from chipsets/ata-*.c */
int ata_ahci_chipinit(device_t);
-int ata_ahci_ch_attach(device_t dev);
-int ata_ahci_ch_detach(device_t dev);
-int ata_ahci_ch_suspend(device_t dev);
-int ata_ahci_ch_resume(device_t dev);
-int ata_ahci_ctlr_reset(device_t dev);
-void ata_ahci_reset(device_t dev);
int ata_marvell_edma_chipinit(device_t);
int ata_sii_chipinit(device_t);
@@ -530,12 +531,16 @@ static device_method_t __CONCAT(dname,_methods)[] = { \
DEVMETHOD(device_suspend, ata_pci_suspend), \
DEVMETHOD(device_resume, ata_pci_resume), \
DEVMETHOD(device_shutdown, bus_generic_shutdown), \
+ DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), \
+ DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), \
DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), \
DEVMETHOD(bus_release_resource, ata_pci_release_resource), \
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), \
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), \
DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), \
DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \
+ DEVMETHOD(pci_read_config, ata_pci_read_config), \
+ DEVMETHOD(pci_write_config, ata_pci_write_config), \
{ 0, 0 } \
}; \
static driver_t __CONCAT(dname,_driver) = { \
OpenPOWER on IntegriCloud