From 6c35773729dad29b4e4d2b61222470aee5d1cbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Thu, 7 Oct 2004 17:37:09 +0000 Subject: [PATCH] Move the PC98 specific geometry "gunk" to geom_pc98.c where it belongs. This also adds support for bigger disks on the controller I have access to, and maybe others if I understood the adhoc methods used on those. Those with more PC98 bigdrive controllers it is hereby invited to add/fix support for those in geom_pc98.c and not using #ifdef PC98 all over the place. --- sys/dev/ata/ata-all.h | 3 +-- sys/dev/ata/ata-cbus.c | 2 +- sys/dev/ata/ata-disk.c | 6 +----- sys/geom/geom_pc98.c | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index e12b5793d4ce..28d36c88dce6 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -343,8 +343,7 @@ struct ata_channel { int flags; /* channel flags */ #define ATA_NO_SLAVE 0x01 #define ATA_USE_16BIT 0x02 -#define ATA_USE_PC98GEOM 0x04 -#define ATA_ATAPI_DMA_RO 0x08 +#define ATA_ATAPI_DMA_RO 0x04 #define ATA_48BIT_ACTIVE 0x10 #define ATA_IMMEDIATE_MODE 0x20 #define ATA_HWGONE 0x40 diff --git a/sys/dev/ata/ata-cbus.c b/sys/dev/ata/ata-cbus.c index 925b30f04fbc..5c3926165802 100644 --- a/sys/dev/ata/ata-cbus.c +++ b/sys/dev/ata/ata-cbus.c @@ -329,7 +329,7 @@ ata_cbussub_probe(device_t dev) ch->r_io[ATA_ALTSTAT].offset = 0; /* initialize softc for this channel */ - ch->flags |= ATA_USE_16BIT | ATA_USE_PC98GEOM; + ch->flags |= ATA_USE_16BIT; ch->locking = ctlr->locking; ch->device[MASTER].setmode = ctlr->setmode; ch->device[SLAVE].setmode = ctlr->setmode; diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 847736dfeca1..ccba1de78024 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -92,11 +92,7 @@ ad_attach(struct ata_device *atadev) adp->heads = atadev->param->heads; adp->sectors = atadev->param->sectors; adp->total_secs = atadev->param->cylinders * adp->heads * adp->sectors; - if (adp->device->channel->flags & ATA_USE_PC98GEOM && - adp->total_secs < 17 * 8 * 65536) { - adp->sectors = 17; - adp->heads = 8; - } + mtx_init(&adp->queue_mtx, "ATA disk bioqueue lock", NULL, MTX_DEF); bioq_init(&adp->queue); diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c index afbc59fcb126..355e121f8ae2 100644 --- a/sys/geom/geom_pc98.c +++ b/sys/geom/geom_pc98.c @@ -258,6 +258,25 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags) sectorsize = cp->provider->sectorsize; if (sectorsize < 512) break; + if (cp->provider->mediasize/sectorsize < 17*8*65535) { + fwsectors = 17; + fwheads = 8; + } + else if (cp->provider->mediasize/sectorsize < 63*16*65535) { + if (fwsectors > 63) + fwsectors = 63; + if (fwheads > 16) + fwheads = 16; + } + else if (cp->provider->mediasize/sectorsize < 255*16*65535) { + fwsectors = 255; + if (fwheads > 16) + fwheads = 16; + } + else { + fwsectors = 255; + fwheads = 255; + } buf = g_read_data(cp, 0, 8192, &error); if (buf == NULL || error != 0) break;