1/* 2 * Copyright (C) 2002 Benno Rice <benno@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_disk.c 125975 2004-02-18 21:36:53Z phk $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/bio.h> 34#include <sys/bus.h> 35#include <sys/conf.h> 36#include <sys/kernel.h> 37#include <sys/limits.h> --- 5 unchanged lines hidden (view full) --- 43#include <machine/md_var.h> 44#include <machine/nexusvar.h> 45 46#define OFWD_BLOCKSIZE 512 47 48struct ofwd_softc 49{ 50 device_t ofwd_dev; |
51 struct disk *ofwd_disk; |
52 phandle_t ofwd_package; 53 ihandle_t ofwd_instance; 54}; 55 56/* 57 * Disk device bus interface. 58 */ 59static void ofwd_identify(driver_t *, device_t); --- 138 unchanged lines hidden (view full) --- 198 OF_getprop(nexus_get_node(dev), "file", fname, sizeof(fname)); 199 device_printf(dev, "located at %s, file %s\n", path, fname); 200 sc->ofwd_instance = OF_open(path); 201 if (sc->ofwd_instance == -1) { 202 device_printf(dev, "could not create instance\n"); 203 return (ENXIO); 204 } 205 |
206 sc->ofwd_disk = disk_alloc(); 207 sc->ofwd_disk->d_strategy = ofwd_strategy; 208 sc->ofwd_disk->d_name = "ofwd"; 209 sc->ofwd_disk->d_sectorsize = OFWD_BLOCKSIZE; 210 sc->ofwd_disk->d_mediasize = (off_t)33554432 * OFWD_BLOCKSIZE; 211 sc->ofwd_disk->d_fwsectors = 0; 212 sc->ofwd_disk->d_fwheads = 0; 213 sc->ofwd_disk->d_drv1 = sc; 214 sc->ofwd_disk->d_maxsize = PAGE_SIZE; 215 sc->ofwd_disk->d_unit = device_get_unit(dev); 216 sc->ofwd_disk->d_flags = DISKFLAG_NEEDSGIANT; 217 disk_create(sc->ofwd_disk, DISK_VERSION); |
218 219 return (0); 220} |