diff options
author | marius <marius@FreeBSD.org> | 2010-05-23 16:16:33 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2010-05-23 16:16:33 +0000 |
commit | 2bb8616a9d068f5029aece25a88b8220b263b8c6 (patch) | |
tree | da00cfa1b8093da1b3db9a4d64e3ac6cd1f7f098 /sys | |
parent | 56466102a625fc8fa18b24c94ab0e1af9667cdae (diff) | |
download | FreeBSD-src-2bb8616a9d068f5029aece25a88b8220b263b8c6.zip FreeBSD-src-2bb8616a9d068f5029aece25a88b8220b263b8c6.tar.gz |
MFC: r208349
Change ad_firmware_geom_adjust() to operate on a struct disk * only and
hook it up to ada(4) also. While at it, rename *ad_firmware_geom_adjust()
to *ata_disk_firmware_geom_adjust() etc now that these are no longer
limited to ad(4). This also allows to maintain a compatibility shim for
pc98_ad_firmware_geom_adjust() for the tier-1 PC98 in stable/8.
Reviewed by: mav (r208349)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/ata/ata_da.c | 11 | ||||
-rw-r--r-- | sys/conf/files.sparc64 | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 6 | ||||
-rw-r--r-- | sys/pc98/include/md_var.h | 9 | ||||
-rw-r--r-- | sys/pc98/pc98/pc98_machdep.c | 29 | ||||
-rw-r--r-- | sys/sparc64/include/md_var.h | 9 | ||||
-rw-r--r-- | sys/sparc64/sparc64/ata_machdep.c | 2 |
7 files changed, 41 insertions, 27 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 6eff691..08d32c3 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include <cam/ata/ata_all.h> +#include <machine/md_var.h> /* geometry translation */ + #ifdef _KERNEL #define ATA_MAX_28BIT_LBA 268435455UL @@ -178,6 +180,13 @@ static void adashutdown(void *arg, int howto); #define ADA_DEFAULT_SEND_ORDERED 1 #endif +/* + * Most platforms map firmware geometry to actual, but some don't. If + * not overridden, default to nothing. + */ +#ifndef ata_disk_firmware_geom_adjust +#define ata_disk_firmware_geom_adjust(disk) +#endif static int ada_retry_count = ADA_DEFAULT_RETRY; static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; @@ -737,9 +746,9 @@ adaregister(struct cam_periph *periph, void *arg) ata_logical_sector_offset(&cgd->ident_data)) % softc->disk->d_stripesize; } - /* XXX: these are not actually "firmware" values, so they may be wrong */ softc->disk->d_fwsectors = softc->params.secs_per_track; softc->disk->d_fwheads = softc->params.heads; + ata_disk_firmware_geom_adjust(softc->disk); disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); diff --git a/sys/conf/files.sparc64 b/sys/conf/files.sparc64 index df8b5d3..e393cd3 100644 --- a/sys/conf/files.sparc64 +++ b/sys/conf/files.sparc64 @@ -84,7 +84,7 @@ sparc64/pci/schizo.c optional pci sparc64/sbus/dma_sbus.c optional sbus sparc64/sbus/sbus.c optional sbus sparc64/sbus/lsi64854.c optional sbus -sparc64/sparc64/ata_machdep.c optional atadisk +sparc64/sparc64/ata_machdep.c optional ada | atadisk | da sparc64/sparc64/autoconf.c standard sparc64/sparc64/bus_machdep.c standard sparc64/sparc64/cache.c standard diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index c6b50dd..746b9ca 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -67,8 +67,8 @@ 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) +#ifndef ata_disk_firmware_geom_adjust +#define ata_disk_firmware_geom_adjust(disk) #endif /* local vars */ @@ -142,9 +142,9 @@ ad_attach(device_t dev) adp->disk->d_flags |= DISKFLAG_CANDELETE; strlcpy(adp->disk->d_ident, atadev->param.serial, sizeof(adp->disk->d_ident)); + ata_disk_firmware_geom_adjust(adp->disk); 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); callout_init(&atadev->spindown_timer, 1); diff --git a/sys/pc98/include/md_var.h b/sys/pc98/include/md_var.h index 7ca6f3c..5b1ebb3 100644 --- a/sys/pc98/include/md_var.h +++ b/sys/pc98/include/md_var.h @@ -41,13 +41,14 @@ extern int need_post_dma_flush; /* * The ad driver maps the IDE disk's actual geometry to the firmware's * notion of geometry. However, PC98 machines need to do something - * different sometimes, so override the hook so we can do so. We have to - * have a knowledge that a device_t is a struct device * here to avoid - * including too many things from this file. + * different sometimes, so override the hook so we can do so. */ struct disk; +void pc98_ata_disk_firmware_geom_adjust(struct disk *); +#define ata_disk_firmware_geom_adjust(disk) \ + pc98_ata_disk_firmware_geom_adjust(disk) +/* backwards compatibility shim */ struct device; void pc98_ad_firmware_geom_adjust(struct device *, struct disk *); -#define ad_firmware_geom_adjust(dev, dsk) pc98_ad_firmware_geom_adjust(dev, dsk) #endif /* !_PC98_INCLUDE_MD_VAR_H_ */ diff --git a/sys/pc98/pc98/pc98_machdep.c b/sys/pc98/pc98/pc98_machdep.c index 31bb756..9683ada 100644 --- a/sys/pc98/pc98/pc98_machdep.c +++ b/sys/pc98/pc98/pc98_machdep.c @@ -211,7 +211,7 @@ scsi_da_bios_params(struct ccb_calc_geometry *ccg) /* IDE BIOS compatible mode. */ static void -pc98_ad_geom_adjust_idebios(struct disk *disk) +pc98_ata_disk_geom_adjust_idebios(struct disk *disk) { if (disk->d_mediasize < MEDIASIZE_4_3G) { @@ -236,7 +236,7 @@ pc98_ad_geom_adjust_idebios(struct disk *disk) /* SCSI BIOS compatible mode. */ static void -pc98_ad_geom_adjust_scsibios(struct disk *disk) +pc98_ata_disk_geom_adjust_scsibios(struct disk *disk) { if (disk->d_mediasize < MEDIASIZE_8G) { @@ -261,13 +261,13 @@ pc98_ad_geom_adjust_scsibios(struct disk *disk) /* Compatible with the revision 1.28. */ static void -pc98_ad_geom_adjust_cyl16bit(struct disk *disk) +pc98_ata_disk_geom_adjust_cyl16bit(struct disk *disk) { off_t totsec = disk->d_mediasize / disk->d_sectorsize; off_t cyl = totsec / disk->d_fwsectors / disk->d_fwheads; - + /* - * It is impossible to have more than 65535 cylendars, so if + * It is impossible to have more than 65535 cylinders, so if * we have more then try to adjust. This is lame, but it is * only POC. */ @@ -289,7 +289,7 @@ pc98_ad_geom_adjust_cyl16bit(struct disk *disk) } void -pc98_ad_firmware_geom_adjust(device_t dev, struct disk *disk) +pc98_ata_disk_firmware_geom_adjust(struct disk *disk) { u_int oldsectors, oldheads; @@ -298,13 +298,13 @@ pc98_ad_firmware_geom_adjust(device_t dev, struct disk *disk) switch (ad_geom_method) { case AD_GEOM_ADJUST_COMPATIDE: - pc98_ad_geom_adjust_idebios(disk); + pc98_ata_disk_geom_adjust_idebios(disk); break; case AD_GEOM_ADJUST_COMPATSCSI: - pc98_ad_geom_adjust_scsibios(disk); + pc98_ata_disk_geom_adjust_scsibios(disk); break; case AD_GEOM_ADJUST_COMPATCYL16: - pc98_ad_geom_adjust_cyl16bit(disk); + pc98_ata_disk_geom_adjust_cyl16bit(disk); break; default: /* Do nothing. */ @@ -313,9 +313,16 @@ pc98_ad_firmware_geom_adjust(device_t dev, struct disk *disk) if (bootverbose && (oldsectors != disk->d_fwsectors || oldheads != disk->d_fwheads)) - device_printf(dev, - "geometry adjusted from [%dH/%dS] to [%dH/%dS]\n", + printf( + "%s%d: geometry adjusted from [%dH/%dS] to [%dH/%dS]\n", + disk->d_name, disk->d_unit, oldheads, oldsectors, disk->d_fwheads, disk->d_fwsectors); +} + +void +pc98_ad_firmware_geom_adjust(device_t dev __unused, struct disk *disk) +{ + pc98_ata_disk_firmware_geom_adjust(disk); } diff --git a/sys/sparc64/include/md_var.h b/sys/sparc64/include/md_var.h index a1f3980..8f064e7 100644 --- a/sys/sparc64/include/md_var.h +++ b/sys/sparc64/include/md_var.h @@ -66,13 +66,10 @@ extern cpu_block_zero_t *cpu_block_zero; * Given that the Sun disk label only uses 16-bit fields for cylinders, * heads and sectors we might need to adjust the geometry of large IDE * disks. - * We have to have a knowledge that a device_t is a struct device * here - * to avoid including too many things from this file. */ struct disk; -struct device; -void sparc64_ad_firmware_geom_adjust(struct device *dev, struct disk *disk); -#define ad_firmware_geom_adjust(dev, dsk) \ - sparc64_ad_firmware_geom_adjust(dev, dsk) +void sparc64_ata_disk_firmware_geom_adjust(struct disk *disk); +#define ata_disk_firmware_geom_adjust(disk) \ + sparc64_ata_disk_firmware_geom_adjust(disk) #endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/sparc64/sparc64/ata_machdep.c b/sys/sparc64/sparc64/ata_machdep.c index 20729bb..102748d 100644 --- a/sys/sparc64/sparc64/ata_machdep.c +++ b/sys/sparc64/sparc64/ata_machdep.c @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include <machine/md_var.h> void -sparc64_ad_firmware_geom_adjust(device_t dev, struct disk *disk) +sparc64_ata_disk_firmware_geom_adjust(struct disk *disk) { /* |