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). Reviewed by: mav MFC after: 3 days
This commit is contained in:
parent
f399274395
commit
4461491b3e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208349
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -41,13 +41,11 @@ 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;
|
||||
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)
|
||||
void pc98_ata_disk_firmware_geom_adjust(struct disk *);
|
||||
#define ata_disk_firmware_geom_adjust(disk) \
|
||||
pc98_ata_disk_firmware_geom_adjust(disk)
|
||||
|
||||
#endif /* !_PC98_INCLUDE_MD_VAR_H_ */
|
||||
|
@ -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,9 @@ 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);
|
||||
|
||||
}
|
||||
|
@ -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_ */
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user