2 * Copyright (c) 2007, Juniper Networks, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the author nor the names of any co-contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #ifndef _DEV_CFI_VAR_H_
33 #define _DEV_CFI_VAR_H_
43 struct resource *sc_res;
44 bus_space_handle_t sc_handle;
45 bus_space_tag_t sc_tag;
48 u_int sc_size; /* Flash size. */
49 u_int sc_width; /* Interface width. */
50 u_int sc_regions; /* Erase regions. */
51 struct cfi_region *sc_region; /* Array of region info. */
54 u_int sc_erase_timeout;
55 u_int sc_write_timeout;
58 struct proc *sc_opened; /* Process that has us opened. */
66 extern char cfi_driver_name[];
67 extern devclass_t cfi_devclass;
68 extern devclass_t cfi_diskclass;
70 int cfi_probe(device_t);
71 int cfi_attach(device_t);
72 int cfi_detach(device_t);
74 uint32_t cfi_read(struct cfi_softc *, u_int);
75 uint8_t cfi_read_qry(struct cfi_softc *, u_int);
76 int cfi_write_block(struct cfi_softc *);
77 int cfi_block_start(struct cfi_softc *, u_int);
78 int cfi_block_finish(struct cfi_softc *);
80 #ifdef CFI_SUPPORT_STRATAFLASH
81 int cfi_intel_get_factory_pr(struct cfi_softc *sc, uint64_t *);
82 int cfi_intel_get_oem_pr(struct cfi_softc *sc, uint64_t *);
83 int cfi_intel_set_oem_pr(struct cfi_softc *sc, uint64_t);
84 int cfi_intel_get_plr(struct cfi_softc *sc, uint32_t *);
85 int cfi_intel_set_plr(struct cfi_softc *sc);
86 #endif /* CFI_SUPPORT_STRATAFLASH */
87 #endif /* _DEV_CFI_VAR_H_ */