cfi_var.h revision 233553
1284990Scy/*- 2284990Scy * Copyright (c) 2007, Juniper Networks, Inc. 3284990Scy * All rights reserved. 4284990Scy * 5284990Scy * Redistribution and use in source and binary forms, with or without 6284990Scy * modification, are permitted provided that the following conditions 7284990Scy * are met: 8284990Scy * 1. Redistributions of source code must retain the above copyright 9284990Scy * notice, this list of conditions and the following disclaimer. 10289999Sglebius * 2. Redistributions in binary form must reproduce the above copyright 11289999Sglebius * notice, this list of conditions and the following disclaimer in the 12289999Sglebius * documentation and/or other materials provided with the distribution. 13289999Sglebius * 3. Neither the name of the author nor the names of any co-contributors 14289999Sglebius * may be used to endorse or promote products derived from this software 15289999Sglebius * without specific prior written permission. 16289999Sglebius * 17289999Sglebius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18289999Sglebius * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19289999Sglebius * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20289999Sglebius * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21289999Sglebius * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22289999Sglebius * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23289999Sglebius * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24289999Sglebius * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25284990Scy * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26284990Scy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27284990Scy * SUCH DAMAGE. 28289999Sglebius * 29289999Sglebius * $FreeBSD: head/sys/dev/cfi/cfi_var.h 233553 2012-03-27 15:13:12Z jchandra $ 30284990Scy */ 31284990Scy 32284990Scy#ifndef _DEV_CFI_VAR_H_ 33284990Scy#define _DEV_CFI_VAR_H_ 34284990Scy 35284990Scystruct cfi_region { 36284990Scy u_int r_blocks; 37284990Scy u_int r_blksz; 38289999Sglebius}; 39289999Sglebius 40289999Sglebiusstruct cfi_softc { 41284990Scy device_t sc_dev; 42284990Scy 43284990Scy struct resource *sc_res; 44284990Scy bus_space_handle_t sc_handle; 45284990Scy bus_space_tag_t sc_tag; 46284990Scy int sc_rid; 47284990Scy 48284990Scy u_int sc_size; /* Flash size. */ 49284990Scy u_int sc_width; /* Interface width. */ 50284990Scy u_int sc_regions; /* Erase regions. */ 51284990Scy struct cfi_region *sc_region; /* Array of region info. */ 52284990Scy 53289999Sglebius u_int sc_cmdset; 54289999Sglebius u_int sc_erase_timeout; 55284990Scy u_int sc_write_timeout; 56284990Scy 57284990Scy struct cdev *sc_nod; 58289999Sglebius struct proc *sc_opened; /* Process that has us opened. */ 59284990Scy 60284990Scy u_char *sc_wrbuf; 61284990Scy u_int sc_wrbufsz; 62289999Sglebius u_int sc_wrofs; 63284990Scy u_int sc_writing; 64289999Sglebius}; 65289999Sglebius 66284990Scyextern char cfi_driver_name[]; 67284990Scyextern devclass_t cfi_devclass; 68284990Scyextern devclass_t cfi_diskclass; 69284990Scy 70284990Scyint cfi_probe(device_t); 71284990Scyint cfi_attach(device_t); 72289999Sglebiusint cfi_detach(device_t); 73289999Sglebius 74284990Scyuint32_t cfi_read_raw(struct cfi_softc *, u_int); 75284990Scyuint32_t cfi_read(struct cfi_softc *, u_int); 76284990Scyuint8_t cfi_read_qry(struct cfi_softc *, u_int); 77284990Scyint cfi_write_block(struct cfi_softc *); 78284990Scyint cfi_block_start(struct cfi_softc *, u_int); 79284990Scyint cfi_block_finish(struct cfi_softc *); 80284990Scy 81284990Scy#ifdef CFI_SUPPORT_STRATAFLASH 82284990Scyint cfi_intel_get_factory_pr(struct cfi_softc *sc, uint64_t *); 83284990Scyint cfi_intel_get_oem_pr(struct cfi_softc *sc, uint64_t *); 84284990Scyint cfi_intel_set_oem_pr(struct cfi_softc *sc, uint64_t); 85289999Sglebiusint cfi_intel_get_plr(struct cfi_softc *sc, uint32_t *); 86289999Sglebiusint cfi_intel_set_plr(struct cfi_softc *sc); 87284990Scy#endif /* CFI_SUPPORT_STRATAFLASH */ 88284990Scy#endif /* _DEV_CFI_VAR_H_ */ 89284990Scy