From 10126ce00c024c98f7ac29e2e3bba981d2d0b73e Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 29 Jan 2001 10:01:11 +0000 Subject: [PATCH] Convert ata and atapi #if NATA* > 0 to options instead. Stop config trying to count the number of ata* devs since they were not used anyway. --- sys/conf/files | 12 ++++++------ sys/conf/options | 4 ++++ sys/dev/ata/ata-all.c | 35 +++++++++++++++-------------------- sys/dev/ata/atapi-all.c | 21 +++++++++------------ 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 94469aeb5563..6637869a7ead 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -236,16 +236,16 @@ dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an card dev/an/if_an_pci.c optional an pci dev/asr/asr.c optional asr pci -dev/ata/ata-all.c count ata -dev/ata/ata-disk.c count atadisk -dev/ata/ata-raid.c count atadisk +dev/ata/ata-all.c optional ata +dev/ata/ata-disk.c optional atadisk +dev/ata/ata-raid.c optional atadisk dev/ata/ata-dma.c optional ata dev/ata/atapi-all.c optional atapicd dev/ata/atapi-all.c optional atapifd dev/ata/atapi-all.c optional atapist -dev/ata/atapi-cd.c count atapicd -dev/ata/atapi-fd.c count atapifd -dev/ata/atapi-tape.c count atapist +dev/ata/atapi-cd.c optional atapicd +dev/ata/atapi-fd.c optional atapifd +dev/ata/atapi-tape.c optional atapist dev/awi/am79c930.c optional awi dev/awi/awi.c optional awi dev/awi/awi_wep.c optional awi diff --git a/sys/conf/options b/sys/conf/options index 988c399d2319..35d1ee71f501 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -216,6 +216,10 @@ ATA_DEBUG opt_ata.h ATA_STATIC_ID opt_ata.h ATA_ENABLE_ATAPI_DMA opt_ata.h ATA_ENABLE_TAGS opt_ata.h +DEV_ATADISK opt_ata.h +DEV_ATAPICD opt_ata.h +DEV_ATAPIST opt_ata.h +DEV_ATAPIFD opt_ata.h # Resource limits. DFLDSIZ opt_rlimit.h diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 17f1de989873..45bb170a7169 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -28,13 +28,8 @@ * $FreeBSD$ */ -#include "ata.h" #include "card.h" #include "pci.h" -#include "atadisk.h" -#include "atapicd.h" -#include "atapifd.h" -#include "atapist.h" #include "opt_global.h" #include "opt_isa.h" #include "opt_ata.h" @@ -904,13 +899,13 @@ ata_attach(device_t dev) if (scp->devices & ATA_ATAPI_MASTER) if (ata_getparam(scp, ATA_MASTER,ATA_C_ATAPI_IDENTIFY)) scp->devices &= ~ATA_ATAPI_MASTER; -#if NATADISK > 0 +#ifdef DEV_ATADISK if (scp->devices & ATA_ATA_MASTER) ad_attach(scp, ATA_MASTER); if (scp->devices & ATA_ATA_SLAVE) ad_attach(scp, ATA_SLAVE); #endif -#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) if (scp->devices & ATA_ATAPI_MASTER) atapi_attach(scp, ATA_MASTER); if (scp->devices & ATA_ATAPI_SLAVE) @@ -929,13 +924,13 @@ ata_detach(device_t dev) if (!scp || !(scp->flags & ATA_ATTACHED)) return ENXIO; -#if NATADISK > 0 +#ifdef DEV_ATADISK if (scp->devices & ATA_ATA_MASTER) ad_detach(scp->dev_softc[0]); if (scp->devices & ATA_ATA_SLAVE) ad_detach(scp->dev_softc[1]); #endif -#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) if (scp->devices & ATA_ATAPI_MASTER) atapi_detach(scp->dev_softc[0]); if (scp->devices & ATA_ATAPI_SLAVE) @@ -1050,7 +1045,7 @@ ata_boot_attach(void) scp->devices &= ~ATA_ATAPI_MASTER; } -#if NATADISK > 0 +#ifdef DEV_ATADISK /* now we know whats there, do the real attach, first the ATA disks */ for (ctlr=0; ctlr 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) /* then the atapi devices */ for (ctlr=0; ctlractive) { -#if NATADISK > 0 +#ifdef DEV_ATADISK case ATA_ACTIVE_ATA: if (!scp->running || ad_interrupt(scp->running) == ATA_OP_CONTINUES) return; break; #endif -#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) case ATA_ACTIVE_ATAPI: if (!scp->running || atapi_interrupt(scp->running) == ATA_OP_CONTINUES) return; @@ -1188,17 +1183,17 @@ ata_intr(void *data) void ata_start(struct ata_softc *scp) { -#if NATADISK > 0 +#ifdef DEV_ATADISK struct ad_request *ad_request; #endif -#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) struct atapi_request *atapi_request; #endif if (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_ACTIVE)) return; -#if NATADISK > 0 +#ifdef DEV_ATADISK /* find & call the responsible driver if anything on the ATA queue */ if (TAILQ_EMPTY(&scp->ata_queue)) { if (scp->devices & (ATA_ATA_MASTER) && scp->dev_softc[0]) @@ -1215,7 +1210,7 @@ ata_start(struct ata_softc *scp) } #endif -#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) /* find & call the responsible driver if anything on the ATAPI queue */ if (TAILQ_EMPTY(&scp->atapi_queue)) { if (scp->devices & (ATA_ATAPI_MASTER) && scp->dev_softc[0]) @@ -1367,13 +1362,13 @@ ata_reinit(struct ata_softc *scp) if (omask != mask) printf(" device dissapeared! %d ", omask & ~mask); -#if NATADISK > 0 +#ifdef DEV_ATADISK if (scp->devices & (ATA_ATA_MASTER) && scp->dev_softc[0]) ad_reinit((struct ad_softc *)scp->dev_softc[0]); if (scp->devices & (ATA_ATA_SLAVE) && scp->dev_softc[1]) ad_reinit((struct ad_softc *)scp->dev_softc[1]); #endif -#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0 +#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) if (scp->devices & (ATA_ATAPI_MASTER) && scp->dev_softc[0]) atapi_reinit((struct atapi_softc *)scp->dev_softc[0]); if (scp->devices & (ATA_ATAPI_SLAVE) && scp->dev_softc[1]) @@ -1392,7 +1387,7 @@ ata_service(struct ata_softc *scp) /* do we have a SERVICE request from the drive ? */ if ((scp->status & (ATA_S_SERVICE|ATA_S_ERROR|ATA_S_DRQ)) == ATA_S_SERVICE){ outb(scp->bmaddr + ATA_BMSTAT_PORT, ata_dmastatus(scp) | ATA_BMSTAT_INTERRUPT); -#if NATADISK > 0 +#ifdef DEV_ATADISK if ((inb(scp->ioaddr + ATA_DRIVE) & ATA_SLAVE) == ATA_MASTER) { if ((scp->devices & ATA_ATA_MASTER) && scp->dev_softc[0]) return ad_service((struct ad_softc *)scp->dev_softc[0], 0); diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index 21aca15ff717..5da4ef2c7665 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -28,9 +28,6 @@ * $FreeBSD$ */ -#include "atapicd.h" -#include "atapist.h" -#include "atapifd.h" #include "opt_global.h" #include "opt_ata.h" #include @@ -90,19 +87,19 @@ atapi_attach(struct ata_softc *scp, int device) ata_pmode(ATP_PARAM)<0 ? 0 : ata_pmode(ATP_PARAM), -1, -1); switch (ATP_PARAM->device_type) { -#if NATAPICD > 0 +#ifdef DEV_ATAPICD case ATAPI_TYPE_CDROM: if (acdattach(atp)) goto notfound; break; #endif -#if NATAPIFD > 0 +#ifdef DEV_ATAPIFD case ATAPI_TYPE_DIRECT: if (afdattach(atp)) goto notfound; break; #endif -#if NATAPIST > 0 +#ifdef DEV_ATAPIST case ATAPI_TYPE_TAPE: if (astattach(atp)) goto notfound; @@ -124,17 +121,17 @@ void atapi_detach(struct atapi_softc *atp) { switch (ATP_PARAM->device_type) { -#if NATAPICD > 0 +#ifdef DEV_ATAPICD case ATAPI_TYPE_CDROM: acddetach(atp); break; #endif -#if NATAPIFD > 0 +#ifdef DEV_ATAPIFD case ATAPI_TYPE_DIRECT: afddetach(atp); break; #endif -#if NATAPIST > 0 +#ifdef DEV_ATAPIST case ATAPI_TYPE_TAPE: astdetach(atp); break; @@ -215,17 +212,17 @@ void atapi_start(struct atapi_softc *atp) { switch (ATP_PARAM->device_type) { -#if NATAPICD > 0 +#ifdef DEV_ATAPICD case ATAPI_TYPE_CDROM: acd_start(atp); break; #endif -#if NATAPIFD > 0 +#ifdef DEV_ATAPIFD case ATAPI_TYPE_DIRECT: afd_start(atp); break; #endif -#if NATAPIST > 0 +#ifdef DEV_ATAPIST case ATAPI_TYPE_TAPE: ast_start(atp); break;