summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-disk.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-08-09 18:23:47 +0000
committerimp <imp@FreeBSD.org>2006-08-09 18:23:47 +0000
commit0598f31308336f183158ca0b7f3cc024a72a7d7f (patch)
treea38bd9ef3fa9dad47561e8d2c581806557aca6d8 /sys/dev/ata/ata-disk.c
parentb2ae936be5770cb95ef230182dc30da91308565b (diff)
downloadFreeBSD-src-0598f31308336f183158ca0b7f3cc024a72a7d7f.zip
FreeBSD-src-0598f31308336f183158ca0b7f3cc024a72a7d7f.tar.gz
Most platforms map the actual drive geometry to the firmware's notion
of geometry. However, some platforms have a more complicated mapping of the firmware values to the actual values. pc98 is the only platform that currently does this. This mapping is necessary for large disks connected to pc98 boxes, as the firmware labels require do special hacks to the actual geometry for interoperability. We cannot do this all in the geom layer because of initialization issues (geom looks for an already initialized pc98 label, but we need the geometry information prior to initialization, classic chicken and egg problem). We pass the disk and the device_t to this function because the geometry mapping depends on what kind of controller is used. This hook allows platforms that want to override things to do so, and has 0 overhead on all other platforms. These patches have been in use locally for a long time, and received good feedback from the pc98 community and sos@ at various times during their development. MFC After: 1 week
Diffstat (limited to 'sys/dev/ata/ata-disk.c')
-rw-r--r--sys/dev/ata/ata-disk.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index 6d90b40..785699f 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -62,6 +62,14 @@ static disk_strategy_t ad_strategy;
static disk_ioctl_t ad_ioctl;
static dumper_t ad_dump;
+/*
+ * Most platforms map firmware geom to actual, but some don't. If
+ * not overridden, default to nothing.
+ */
+#ifndef ad_firmware_geom_adjust
+#define ad_firmware_geom_adjust(dev, disk)
+#endif
+
/* local vars */
static MALLOC_DEFINE(M_AD, "ad_driver", "ATA disk driver");
@@ -152,6 +160,7 @@ ad_attach(device_t dev)
adp->disk->d_unit = device_get_unit(dev);
disk_create(adp->disk, DISK_VERSION);
device_add_child(dev, "subdisk", device_get_unit(dev));
+ ad_firmware_geom_adjust(dev, adp->disk);
bus_generic_attach(dev);
return 0;
}
OpenPOWER on IntegriCloud