2010-03-02 21:44:46 +03:00
|
|
|
/* $NetBSD: fdc_acpi.c,v 1.37 2010/03/02 18:44:47 jruoho Exp $ */
|
2002-12-28 22:31:35 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI attachment for the PC Floppy Controller driver, based on
|
|
|
|
* sys/arch/i386/pnpbios/fdc_pnpbios.c by Jason R. Thorpe
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2010-03-02 21:44:46 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.37 2010/03/02 18:44:47 jruoho Exp $");
|
2002-12-28 22:31:35 +03:00
|
|
|
|
|
|
|
#include "rnd.h"
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/callout.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/buf.h>
|
2004-10-28 11:07:35 +04:00
|
|
|
#include <sys/bufq.h>
|
2002-12-28 22:31:35 +03:00
|
|
|
#include <sys/queue.h>
|
2003-01-09 03:22:39 +03:00
|
|
|
#include <sys/disk.h>
|
2002-12-28 22:31:35 +03:00
|
|
|
#if NRND > 0
|
|
|
|
#include <sys/rnd.h>
|
|
|
|
#endif
|
|
|
|
|
2007-10-19 15:59:34 +04:00
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/intr.h>
|
2002-12-28 22:31:35 +03:00
|
|
|
|
|
|
|
#include <dev/isa/isavar.h>
|
|
|
|
#include <dev/isa/isadmavar.h>
|
|
|
|
|
|
|
|
#include <dev/acpi/acpica.h>
|
|
|
|
#include <dev/acpi/acpireg.h>
|
|
|
|
#include <dev/acpi/acpivar.h>
|
|
|
|
|
|
|
|
#include <dev/isa/fdcvar.h>
|
2003-01-09 03:22:39 +03:00
|
|
|
#include <dev/isa/fdvar.h>
|
|
|
|
#include <dev/isa/fdreg.h>
|
|
|
|
|
|
|
|
#include <dev/acpi/fdc_acpireg.h>
|
2002-12-28 22:31:35 +03:00
|
|
|
|
2009-09-16 14:47:54 +04:00
|
|
|
#define _COMPONENT ACPI_RESOURCE_COMPONENT
|
|
|
|
ACPI_MODULE_NAME ("fdc_acpi")
|
|
|
|
|
2008-03-16 03:58:56 +03:00
|
|
|
static int fdc_acpi_match(device_t, cfdata_t, void *);
|
2008-02-18 09:19:50 +03:00
|
|
|
static void fdc_acpi_attach(device_t, device_t, void *);
|
2002-12-28 22:31:35 +03:00
|
|
|
|
|
|
|
struct fdc_acpi_softc {
|
|
|
|
struct fdc_softc sc_fdc;
|
|
|
|
bus_space_handle_t sc_baseioh;
|
2003-01-09 03:22:39 +03:00
|
|
|
struct acpi_devnode *sc_node; /* ACPI devnode */
|
2002-12-28 22:31:35 +03:00
|
|
|
};
|
|
|
|
|
2003-01-09 03:22:39 +03:00
|
|
|
static int fdc_acpi_enumerate(struct fdc_acpi_softc *);
|
|
|
|
static void fdc_acpi_getknownfds(struct fdc_acpi_softc *);
|
|
|
|
|
2008-02-18 09:19:50 +03:00
|
|
|
static const struct fd_type *fdc_acpi_nvtotype(const char *, int, int);
|
2003-01-09 03:22:39 +03:00
|
|
|
|
2008-03-16 03:58:56 +03:00
|
|
|
CFATTACH_DECL_NEW(fdc_acpi, sizeof(struct fdc_acpi_softc), fdc_acpi_match,
|
2002-12-28 22:31:35 +03:00
|
|
|
fdc_acpi_attach, NULL, NULL);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Supported device IDs
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const char * const fdc_acpi_ids[] = {
|
2003-11-03 22:03:40 +03:00
|
|
|
"PNP07??", /* PC standard floppy disk controller */
|
2002-12-28 22:31:35 +03:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* fdc_acpi_match: autoconf(9) match routine
|
|
|
|
*/
|
2004-05-01 16:03:27 +04:00
|
|
|
static int
|
2008-03-16 03:58:56 +03:00
|
|
|
fdc_acpi_match(device_t parent, cfdata_t match, void *aux)
|
2002-12-28 22:31:35 +03:00
|
|
|
{
|
|
|
|
struct acpi_attach_args *aa = aux;
|
|
|
|
|
|
|
|
if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
|
|
|
|
return 0;
|
|
|
|
|
2003-11-03 09:03:47 +03:00
|
|
|
return acpi_match_hid(aa->aa_node->ad_devinfo, fdc_acpi_ids);
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* fdc_acpi_attach: autoconf(9) attach routine
|
|
|
|
*/
|
2004-05-01 16:03:27 +04:00
|
|
|
static void
|
2008-02-18 09:19:50 +03:00
|
|
|
fdc_acpi_attach(device_t parent, device_t self, void *aux)
|
2002-12-28 22:31:35 +03:00
|
|
|
{
|
2008-02-18 09:19:50 +03:00
|
|
|
struct fdc_acpi_softc *asc = device_private(self);
|
2002-12-28 22:31:35 +03:00
|
|
|
struct fdc_softc *sc = &asc->sc_fdc;
|
|
|
|
struct acpi_attach_args *aa = aux;
|
|
|
|
struct acpi_io *io, *ctlio;
|
|
|
|
struct acpi_irq *irq;
|
|
|
|
struct acpi_drq *drq;
|
2004-04-11 14:36:35 +04:00
|
|
|
struct acpi_resources res;
|
2002-12-28 22:31:35 +03:00
|
|
|
ACPI_STATUS rv;
|
|
|
|
|
2008-03-16 03:58:56 +03:00
|
|
|
sc->sc_dev = self;
|
2002-12-28 22:31:35 +03:00
|
|
|
sc->sc_ic = aa->aa_ic;
|
2003-01-09 03:22:39 +03:00
|
|
|
asc->sc_node = aa->aa_node;
|
2002-12-28 22:31:35 +03:00
|
|
|
|
|
|
|
/* parse resources */
|
2008-03-16 03:58:56 +03:00
|
|
|
rv = acpi_resource_parse(sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
|
2004-04-11 14:36:35 +04:00
|
|
|
&res, &acpi_resource_parse_ops_default);
|
2003-11-03 21:07:10 +03:00
|
|
|
if (ACPI_FAILURE(rv))
|
2002-12-28 22:31:35 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* find our i/o registers */
|
2004-04-11 14:36:35 +04:00
|
|
|
io = acpi_res_io(&res, 0);
|
2002-12-28 22:31:35 +03:00
|
|
|
if (io == NULL) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"unable to find i/o register resource\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* find our IRQ */
|
2004-04-11 14:36:35 +04:00
|
|
|
irq = acpi_res_irq(&res, 0);
|
2002-12-28 22:31:35 +03:00
|
|
|
if (irq == NULL) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev, "unable to find irq resource\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* find our DRQ */
|
2004-04-11 14:36:35 +04:00
|
|
|
drq = acpi_res_drq(&res, 0);
|
2002-12-28 22:31:35 +03:00
|
|
|
if (drq == NULL) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev, "unable to find drq resource\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
2002-12-28 22:53:50 +03:00
|
|
|
sc->sc_drq = drq->ar_drq;
|
2002-12-28 22:31:35 +03:00
|
|
|
|
|
|
|
sc->sc_iot = aa->aa_iot;
|
|
|
|
if (bus_space_map(sc->sc_iot, io->ar_base, io->ar_length,
|
|
|
|
0, &asc->sc_baseioh)) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev, "can't map i/o space\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (io->ar_length) {
|
|
|
|
case 4:
|
|
|
|
sc->sc_ioh = asc->sc_baseioh;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if (bus_space_subregion(sc->sc_iot, asc->sc_baseioh, 2, 4,
|
|
|
|
&sc->sc_ioh)) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"unable to subregion i/o space\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"unknown size: %d of io mapping\n", io->ar_length);
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* omitting the controller I/O port. (One has to exist for there to
|
|
|
|
* be a working fdc). Just try and force the mapping in.
|
|
|
|
*/
|
2004-04-11 14:36:35 +04:00
|
|
|
ctlio = acpi_res_io(&res, 1);
|
2002-12-28 22:31:35 +03:00
|
|
|
if (ctlio == NULL) {
|
|
|
|
if (bus_space_map(sc->sc_iot, io->ar_base + io->ar_length + 1,
|
|
|
|
1, 0, &sc->sc_fdctlioh)) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"unable to force map ctl i/o space\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_verbose_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"ctl io %x did't probe. Forced attach\n",
|
|
|
|
io->ar_base + io->ar_length + 1);
|
2002-12-28 22:31:35 +03:00
|
|
|
} else {
|
|
|
|
if (bus_space_map(sc->sc_iot, ctlio->ar_base, ctlio->ar_length,
|
|
|
|
0, &sc->sc_fdctlioh)) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"unable to map ctl i/o space\n");
|
2004-04-11 14:36:35 +04:00
|
|
|
goto out;
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-09 15:23:28 +03:00
|
|
|
sc->sc_ih = isa_intr_establish(aa->aa_ic, irq->ar_irq,
|
|
|
|
(irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
|
|
|
|
IPL_BIO, fdcintr, sc);
|
2002-12-28 22:31:35 +03:00
|
|
|
|
2003-01-09 03:22:39 +03:00
|
|
|
/* Setup direct configuration of floppy drives */
|
|
|
|
sc->sc_present = fdc_acpi_enumerate(asc);
|
|
|
|
if (sc->sc_present >= 0) {
|
|
|
|
sc->sc_known = 1;
|
|
|
|
fdc_acpi_getknownfds(asc);
|
|
|
|
} else {
|
2003-01-09 04:25:13 +03:00
|
|
|
/*
|
|
|
|
* XXX if there is no _FDE control method, attempt to
|
|
|
|
* probe without pnp
|
|
|
|
*/
|
2003-01-09 15:18:38 +03:00
|
|
|
#ifdef ACPI_FDC_DEBUG
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_debug_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"unable to enumerate, attempting normal probe\n");
|
2003-01-09 15:18:38 +03:00
|
|
|
#endif
|
2003-01-09 03:22:39 +03:00
|
|
|
}
|
2003-01-09 04:25:13 +03:00
|
|
|
|
2003-09-26 01:55:49 +04:00
|
|
|
fdcattach(sc);
|
2004-04-11 14:36:35 +04:00
|
|
|
|
|
|
|
out:
|
|
|
|
acpi_resource_cleanup(&res);
|
2003-01-09 03:22:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
fdc_acpi_enumerate(struct fdc_acpi_softc *asc)
|
|
|
|
{
|
|
|
|
struct fdc_softc *sc = &asc->sc_fdc;
|
|
|
|
ACPI_OBJECT *fde;
|
2005-05-30 00:56:02 +04:00
|
|
|
ACPI_BUFFER abuf;
|
2003-01-09 03:22:39 +03:00
|
|
|
ACPI_STATUS rv;
|
2003-01-09 15:18:38 +03:00
|
|
|
UINT32 *p;
|
2005-07-11 22:31:12 +04:00
|
|
|
int i, drives = -1;
|
2003-01-09 03:22:39 +03:00
|
|
|
|
2005-05-30 00:56:02 +04:00
|
|
|
rv = acpi_eval_struct(asc->sc_node->ad_handle, "_FDE", &abuf);
|
2003-11-03 21:07:10 +03:00
|
|
|
if (ACPI_FAILURE(rv)) {
|
2003-01-09 15:18:38 +03:00
|
|
|
#ifdef ACPI_FDC_DEBUG
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_normal_dev(sc->sc_dev, "failed to evaluate _FDE: %s\n",
|
2008-02-18 09:19:50 +03:00
|
|
|
AcpiFormatException(rv));
|
2003-01-09 15:18:38 +03:00
|
|
|
#endif
|
2005-07-11 22:31:12 +04:00
|
|
|
return drives;
|
2003-01-09 03:22:39 +03:00
|
|
|
}
|
2005-05-30 00:56:02 +04:00
|
|
|
fde = (ACPI_OBJECT *)abuf.Pointer;
|
2003-01-09 03:22:39 +03:00
|
|
|
if (fde->Type != ACPI_TYPE_BUFFER) {
|
2010-03-02 21:44:46 +03:00
|
|
|
aprint_error_dev(sc->sc_dev, "expected BUFFER, got %u\n",
|
2003-01-09 03:22:39 +03:00
|
|
|
fde->Type);
|
|
|
|
goto out;
|
|
|
|
}
|
2003-01-09 15:18:38 +03:00
|
|
|
if (fde->Buffer.Length < 5 * sizeof(UINT32)) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2010-03-02 21:44:46 +03:00
|
|
|
"expected buffer len of %lu, got %u\n",
|
2003-05-21 21:23:55 +04:00
|
|
|
(unsigned long)(5 * sizeof(UINT32)), fde->Buffer.Length);
|
2003-01-09 03:22:39 +03:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2003-01-09 15:18:38 +03:00
|
|
|
p = (UINT32 *) fde->Buffer.Pointer;
|
|
|
|
|
2003-01-09 03:22:39 +03:00
|
|
|
/*
|
|
|
|
* Indexes 0 through 3 are each UINT32 booleans. True if a drive
|
|
|
|
* is present.
|
|
|
|
*/
|
|
|
|
drives = 0;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (p[i]) drives |= (1 << i);
|
|
|
|
#ifdef ACPI_FDC_DEBUG
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_normal_dev(sc->sc_dev, "drive %d %sattached\n", i,
|
2003-01-09 03:22:39 +03:00
|
|
|
p[i] ? "" : "not ");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2003-01-09 15:18:38 +03:00
|
|
|
* p[4] reports tape presence. Possible values:
|
2003-01-09 03:22:39 +03:00
|
|
|
* 0 - Unknown if device is present
|
|
|
|
* 1 - Device is present
|
|
|
|
* 2 - Device is never present
|
|
|
|
* >2 - Reserved
|
2003-01-09 15:18:38 +03:00
|
|
|
*
|
|
|
|
* we don't currently use this.
|
2003-01-09 03:22:39 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
out:
|
2009-09-16 14:47:54 +04:00
|
|
|
ACPI_FREE(abuf.Pointer);
|
2003-01-09 03:22:39 +03:00
|
|
|
return drives;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fdc_acpi_getknownfds(struct fdc_acpi_softc *asc)
|
|
|
|
{
|
|
|
|
struct fdc_softc *sc = &asc->sc_fdc;
|
|
|
|
ACPI_OBJECT *fdi, *e;
|
2005-05-30 00:56:02 +04:00
|
|
|
ACPI_BUFFER abuf;
|
2003-01-09 03:22:39 +03:00
|
|
|
ACPI_STATUS rv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if ((sc->sc_present & (1 << i)) == 0)
|
|
|
|
continue;
|
2005-05-30 00:56:02 +04:00
|
|
|
rv = acpi_eval_struct(asc->sc_node->ad_handle, "_FDI", &abuf);
|
2003-11-03 21:07:10 +03:00
|
|
|
if (ACPI_FAILURE(rv)) {
|
2003-01-09 04:25:13 +03:00
|
|
|
#ifdef ACPI_FDC_DEBUG
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_normal_dev(sc->sc_dev,
|
2008-02-18 09:19:50 +03:00
|
|
|
"failed to evaluate _FDI: %s on drive %d\n",
|
|
|
|
AcpiFormatException(rv), i);
|
2003-01-09 04:25:13 +03:00
|
|
|
#endif
|
|
|
|
/* XXX if _FDI fails, assume 1.44MB floppy */
|
|
|
|
sc->sc_knownfds[i] = &fdc_acpi_fdtypes[0];
|
2003-01-09 03:22:39 +03:00
|
|
|
continue;
|
|
|
|
}
|
2005-05-30 00:56:02 +04:00
|
|
|
fdi = (ACPI_OBJECT *)abuf.Pointer;
|
2003-01-09 03:22:39 +03:00
|
|
|
if (fdi->Type != ACPI_TYPE_PACKAGE) {
|
2008-03-16 03:58:56 +03:00
|
|
|
aprint_error_dev(sc->sc_dev,
|
2010-03-02 21:44:46 +03:00
|
|
|
"expected PACKAGE, got %u\n", fdi->Type);
|
2003-01-09 03:22:39 +03:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
e = fdi->Package.Elements;
|
2008-02-18 09:19:50 +03:00
|
|
|
sc->sc_knownfds[i] = fdc_acpi_nvtotype(
|
2008-03-16 16:58:22 +03:00
|
|
|
device_xname(sc->sc_dev),
|
2004-04-10 15:48:10 +04:00
|
|
|
e[1].Integer.Value, e[0].Integer.Value);
|
2003-01-09 15:18:38 +03:00
|
|
|
|
|
|
|
/* if fdc_acpi_nvtotype returns NULL, don't attach drive */
|
|
|
|
if (!sc->sc_knownfds[i])
|
|
|
|
sc->sc_present &= ~(1 << i);
|
|
|
|
|
2003-01-09 03:22:39 +03:00
|
|
|
out:
|
2009-09-16 14:47:54 +04:00
|
|
|
ACPI_FREE(abuf.Pointer);
|
2003-01-09 03:22:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct fd_type *
|
2008-02-18 09:19:50 +03:00
|
|
|
fdc_acpi_nvtotype(const char *fdc, int nvraminfo, int drive)
|
2003-01-09 03:22:39 +03:00
|
|
|
{
|
|
|
|
int type;
|
|
|
|
|
|
|
|
type = (drive == 0 ? nvraminfo : nvraminfo << 4) & 0xf0;
|
|
|
|
switch (type) {
|
|
|
|
case ACPI_FDC_DISKETTE_NONE:
|
|
|
|
return NULL;
|
|
|
|
case ACPI_FDC_DISKETTE_12M:
|
|
|
|
return &fdc_acpi_fdtypes[1];
|
|
|
|
case ACPI_FDC_DISKETTE_TYPE5:
|
|
|
|
case ACPI_FDC_DISKETTE_TYPE6:
|
|
|
|
case ACPI_FDC_DISKETTE_144M:
|
|
|
|
return &fdc_acpi_fdtypes[0];
|
|
|
|
case ACPI_FDC_DISKETTE_360K:
|
|
|
|
return &fdc_acpi_fdtypes[3];
|
|
|
|
case ACPI_FDC_DISKETTE_720K:
|
|
|
|
return &fdc_acpi_fdtypes[4];
|
|
|
|
default:
|
|
|
|
#ifdef ACPI_FDC_DEBUG
|
2006-02-20 15:17:49 +03:00
|
|
|
aprint_normal("%s: drive %d: unknown device type 0x%x\n",
|
2003-01-09 03:22:39 +03:00
|
|
|
fdc, drive, type);
|
|
|
|
#endif
|
|
|
|
return NULL;
|
|
|
|
}
|
2002-12-28 22:31:35 +03:00
|
|
|
}
|