ofw_disk.c revision 199767f8919635c4928607450d9e0abb932109ce
/*-
* Copyright (C) 2000 Benno Rice.
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY Benno Rice ``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 TOOLS GMBH 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.
*/
__FBSDID("$FreeBSD$");
/*
* Disk I/O routines using Open Firmware
*/
#include <stand.h>
#include "bootstrap.h"
#include "libofw.h"
static int ofwd_init(void);
static int ofwd_close(struct open_file *f);
static void ofwd_print(int verbose);
"block",
};
/*
* We're not guaranteed to be able to open a device more than once and there
* is no OFW standard method to determine whether a device is already opened.
* Opening a device multiple times simultaneously happens to work with most
* OFW block device drivers but triggers a trap with at least the driver for
* the on-board controllers of Sun Fire V100 and Ultra 1. Upper layers and MI
* code expect to be able to open a device more than once however. Given that
* different partitions of the same device might be opened at the same time as
* done by ZFS, we can't generally just keep track of the opened devices and
* reuse the instance handle when asked to open an already opened device. So
* the best we can do is to cache the lastly used device path and close and
* open devices in ofwd_strategy() as needed.
*/
static struct ofw_devdesc *kdp;
static int
ofwd_init(void)
{
return (0);
}
static int
{
int n;
#if !defined(__powerpc__)
#endif
}
return (ENOENT);
}
do {
return (EIO);
if (n < 0 && n != -2)
return (EIO);
} while (n == -2);
return (0);
}
static int
{
struct ofw_devdesc *dp;
}
return (ENOENT);
}
}
return (0);
}
static int
ofwd_close(struct open_file *f)
{
#if !defined(__powerpc__)
#endif
}
return (0);
}
static int
{
return (EINVAL);
}
static void
{
}