xref: /openbsd/sys/dev/spdmemvar.h (revision b95f7d00)
1*b95f7d00Smiod /*	$OpenBSD: spdmemvar.h,v 1.1 2010/03/22 21:20:56 miod Exp $	*/
2*b95f7d00Smiod /* $NetBSD: spdmem.c,v 1.3 2007/09/20 23:09:59 xtraeme Exp $ */
3*b95f7d00Smiod 
4*b95f7d00Smiod /*
5*b95f7d00Smiod  * Copyright (c) 2007 Jonathan Gray <jsg@openbsd.org>
6*b95f7d00Smiod  *
7*b95f7d00Smiod  * Permission to use, copy, modify, and distribute this software for any
8*b95f7d00Smiod  * purpose with or without fee is hereby granted, provided that the above
9*b95f7d00Smiod  * copyright notice and this permission notice appear in all copies.
10*b95f7d00Smiod  *
11*b95f7d00Smiod  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12*b95f7d00Smiod  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13*b95f7d00Smiod  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14*b95f7d00Smiod  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15*b95f7d00Smiod  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16*b95f7d00Smiod  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17*b95f7d00Smiod  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18*b95f7d00Smiod  */
19*b95f7d00Smiod 
20*b95f7d00Smiod /*
21*b95f7d00Smiod  * Copyright (c) 2007 Nicolas Joly
22*b95f7d00Smiod  * Copyright (c) 2007 Paul Goyette
23*b95f7d00Smiod  * Copyright (c) 2007 Tobias Nygren
24*b95f7d00Smiod  * All rights reserved.
25*b95f7d00Smiod  *
26*b95f7d00Smiod  * Redistribution and use in source and binary forms, with or without
27*b95f7d00Smiod  * modification, are permitted provided that the following conditions
28*b95f7d00Smiod  * are met:
29*b95f7d00Smiod  * 1. Redistributions of source code must retain the above copyright
30*b95f7d00Smiod  *    notice, this list of conditions and the following disclaimer.
31*b95f7d00Smiod  * 2. Redistributions in binary form must reproduce the above copyright
32*b95f7d00Smiod  *    notice, this list of conditions and the following disclaimer in the
33*b95f7d00Smiod  *    documentation and/or other materials provided with the distribution.
34*b95f7d00Smiod  * 3. The name of the author may not be used to endorse or promote products
35*b95f7d00Smiod  *    derived from this software without specific prior written permission.
36*b95f7d00Smiod  *
37*b95f7d00Smiod  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
38*b95f7d00Smiod  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
39*b95f7d00Smiod  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40*b95f7d00Smiod  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
41*b95f7d00Smiod  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42*b95f7d00Smiod  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43*b95f7d00Smiod  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44*b95f7d00Smiod  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45*b95f7d00Smiod  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46*b95f7d00Smiod  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47*b95f7d00Smiod  * POSSIBILITY OF SUCH DAMAGE.
48*b95f7d00Smiod  */
49*b95f7d00Smiod 
50*b95f7d00Smiod /*
51*b95f7d00Smiod  * Serial Presence Detect (SPD) memory identification
52*b95f7d00Smiod  */
53*b95f7d00Smiod 
54*b95f7d00Smiod struct spdmem {
55*b95f7d00Smiod 	uint8_t sm_len;
56*b95f7d00Smiod 	uint8_t sm_size;
57*b95f7d00Smiod 	uint8_t sm_type;
58*b95f7d00Smiod 	uint8_t sm_data[60];
59*b95f7d00Smiod 	uint8_t	sm_cksum;
60*b95f7d00Smiod } __packed;
61*b95f7d00Smiod 
62*b95f7d00Smiod struct spdmem_softc {
63*b95f7d00Smiod 	struct device	sc_dev;
64*b95f7d00Smiod 	uint8_t		(*sc_read)(struct spdmem_softc *, uint8_t);
65*b95f7d00Smiod 	struct spdmem	sc_spd_data;
66*b95f7d00Smiod };
67*b95f7d00Smiod 
68*b95f7d00Smiod void	spdmem_attach_common(struct spdmem_softc *);
69*b95f7d00Smiod int	spdmem_probe(struct spdmem_softc *);
70