1235778Sgber/*- 2235778Sgber * Copyright (c) 2012 Semihalf. 3235778Sgber * All rights reserved. 4235778Sgber * 5235778Sgber * Redistribution and use in source and binary forms, with or without 6235778Sgber * modification, are permitted provided that the following conditions 7235778Sgber * are met: 8235778Sgber * 1. Redistributions of source code must retain the above copyright 9235778Sgber * notice, this list of conditions and the following disclaimer. 10235778Sgber * 2. Redistributions in binary form must reproduce the above copyright 11235778Sgber * notice, this list of conditions and the following disclaimer in the 12235778Sgber * documentation and/or other materials provided with the distribution. 13235778Sgber * 14235778Sgber * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15235778Sgber * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16235778Sgber * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17235778Sgber * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18235778Sgber * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19235778Sgber * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20235778Sgber * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21235778Sgber * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22235778Sgber * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23235778Sgber * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24235778Sgber * SUCH DAMAGE. 25235778Sgber * 26235778Sgber * $FreeBSD: stable/10/sys/sys/slicer.h 318159 2017-05-10 21:42:16Z marius $ 27235778Sgber */ 28235778Sgber 29235778Sgber#ifndef _FLASH_SLICER_H_ 30318159Smarius#define _FLASH_SLICER_H_ 31235778Sgber 32235778Sgber#include <sys/types.h> 33235778Sgber 34318159Smarius#define FLASH_SLICES_MAX_NUM 8 35318159Smarius#define FLASH_SLICES_MAX_NAME_LEN (32 + 1) 36235778Sgber 37235778Sgber#define FLASH_SLICES_FLAG_NONE 0 38235778Sgber#define FLASH_SLICES_FLAG_RO 1 /* Read only */ 39235778Sgber 40318159Smarius#define FLASH_SLICES_FMT "%ss.%s" 41318159Smarius 42235778Sgberstruct flash_slice { 43235778Sgber off_t base; 44235778Sgber off_t size; 45318159Smarius const char *label; 46235778Sgber unsigned int flags; 47235778Sgber}; 48235778Sgber 49235778Sgber#ifdef _KERNEL 50318159Smarius 51318159Smariustypedef int (*flash_slicer_t)(device_t dev, const char *provider, 52318159Smarius struct flash_slice *slices, int *slices_num); 53318159Smarius 54318159Smarius#define FLASH_SLICES_TYPE_NAND 0 55318159Smarius#define FLASH_SLICES_TYPE_CFI 1 56318159Smarius#define FLASH_SLICES_TYPE_SPI 2 57318159Smarius#define FLASH_SLICES_TYPE_MMC 3 58318159Smarius 59318159Smarius/* Use NULL for deregistering a slicer */ 60318159Smariusvoid flash_register_slicer(flash_slicer_t slicer, u_int type, bool force); 61318159Smarius 62235778Sgber#endif /* _KERNEL */ 63235778Sgber 64235778Sgber#endif /* _FLASH_SLICER_H_ */ 65