xref: /netbsd-src/sys/arch/playstation2/dev/spdvar.h (revision aad6ef8bb53467e46ac6eaf569f9972623d96e56)
1*aad6ef8bSmartin /*	$NetBSD: spdvar.h,v 1.5 2014/03/31 11:25:49 martin Exp $	*/
2*aad6ef8bSmartin 
3*aad6ef8bSmartin /*-
4*aad6ef8bSmartin  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5*aad6ef8bSmartin  * All rights reserved.
6*aad6ef8bSmartin  *
7*aad6ef8bSmartin  * This code is derived from software contributed to The NetBSD Foundation
8*aad6ef8bSmartin  * by UCHIYAMA Yasushi.
9*aad6ef8bSmartin  *
10*aad6ef8bSmartin  * Redistribution and use in source and binary forms, with or without
11*aad6ef8bSmartin  * modification, are permitted provided that the following conditions
12*aad6ef8bSmartin  * are met:
13*aad6ef8bSmartin  * 1. Redistributions of source code must retain the above copyright
14*aad6ef8bSmartin  *    notice, this list of conditions and the following disclaimer.
15*aad6ef8bSmartin  * 2. Redistributions in binary form must reproduce the above copyright
16*aad6ef8bSmartin  *    notice, this list of conditions and the following disclaimer in the
17*aad6ef8bSmartin  *    documentation and/or other materials provided with the distribution.
18*aad6ef8bSmartin  *
19*aad6ef8bSmartin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*aad6ef8bSmartin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*aad6ef8bSmartin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*aad6ef8bSmartin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*aad6ef8bSmartin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*aad6ef8bSmartin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*aad6ef8bSmartin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*aad6ef8bSmartin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*aad6ef8bSmartin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*aad6ef8bSmartin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*aad6ef8bSmartin  * POSSIBILITY OF SUCH DAMAGE.
30*aad6ef8bSmartin  */
31*aad6ef8bSmartin 
32*aad6ef8bSmartin enum spd_slot {
33*aad6ef8bSmartin 	SPD_HDD,
34*aad6ef8bSmartin 	SPD_NIC
35*aad6ef8bSmartin };
36*aad6ef8bSmartin 
37*aad6ef8bSmartin struct spd_attach_args {
38*aad6ef8bSmartin 	enum spd_slot spa_slot;
39*aad6ef8bSmartin 	const char *spa_product_name;
40*aad6ef8bSmartin };
41*aad6ef8bSmartin 
42*aad6ef8bSmartin /* interrupt */
43*aad6ef8bSmartin void *spd_intr_establish(enum spd_slot, int (*)(void *), void *);
44*aad6ef8bSmartin void spd_intr_disestablish(void *);
45*aad6ef8bSmartin 
46*aad6ef8bSmartin /* EEPROM */
47*aad6ef8bSmartin void spd_eeprom_read(int, u_int16_t *, int);
48*aad6ef8bSmartin 
49*aad6ef8bSmartin /* HDD LED */
50*aad6ef8bSmartin #define SPD_LED_OFF()							\
51*aad6ef8bSmartin {									\
52*aad6ef8bSmartin 		*(volatile u_int8_t *)SPD_IO_DIR_REG8 = SPD_IO_LED;	\
53*aad6ef8bSmartin 		*(volatile u_int8_t *)SPD_IO_DATA_REG8 = SPD_IO_LED;\
54*aad6ef8bSmartin }
55*aad6ef8bSmartin #define SPD_LED_ON()							\
56*aad6ef8bSmartin {									\
57*aad6ef8bSmartin 		*(volatile u_int8_t *)SPD_IO_DIR_REG8 = SPD_IO_LED;	\
58*aad6ef8bSmartin 		*(volatile u_int8_t *)SPD_IO_DATA_REG8 = 0;		\
59*aad6ef8bSmartin }
60