1 /* $NetBSD: gemini_lpcvar.h,v 1.1 2008/11/09 09:15:42 cliff Exp $ */
3 #ifndef _ARM_GEMINI_LPCVAR_H
4 #define _ARM_GEMINI_LPCVAR_H
7 #include <sys/device.h>
8 #include <machine/bus.h>
10 #define GEMINI_LPC_LDN_ALL -1 /* "global" LDN */
12 typedef void * lpctag_t
;
13 typedef void * lpcintrtag_t
;
15 typedef struct gemini_lpc_attach_args
{
22 bus_space_tag_t lpc_iot
;
23 } gemini_lpc_attach_args_t
;
26 #define LPC_FL_ENABLED 0x01 /* device is enabled */
28 typedef struct gemini_lpc_bus_ops
{
29 uint8_t (*lpc_pnp_read
)(lpctag_t
, int, uint
);
30 void (*lpc_pnp_write
)(lpctag_t
, int, uint
, uint8_t);
31 void (*lpc_pnp_enter
)(lpctag_t
);
32 void (*lpc_pnp_exit
)(lpctag_t
);
33 void *(*lpc_intr_establish
)(lpctag_t
, uint
, int, int,
34 int (*)(void *), void *);
35 void (*lpc_intr_disestablish
)(lpctag_t
, void *);
36 } gemini_lpc_bus_ops_t
;
38 typedef struct gemini_lpc_softc
{
43 bus_space_tag_t sc_iot
;
44 bus_space_handle_t sc_ioh
;
46 struct gemini_lpc_bus_ops
*sc_bus_ops
;
51 lpc_pnp_read(lpctag_t tag
, int ldn
, uint off
)
53 gemini_lpc_softc_t
*sc
= tag
;
54 return (*sc
->sc_bus_ops
->lpc_pnp_read
)(tag
, ldn
, off
);
58 lpc_pnp_write(lpctag_t tag
, int ldn
, uint off
, uint8_t val
)
60 gemini_lpc_softc_t
*sc
= tag
;
61 return (*sc
->sc_bus_ops
->lpc_pnp_write
)(tag
, ldn
, off
, val
);
65 lpc_pnp_enter(lpctag_t tag
)
67 gemini_lpc_softc_t
*sc
= tag
;
68 return (*sc
->sc_bus_ops
->lpc_pnp_enter
)(tag
);
72 lpc_pnp_exit(lpctag_t tag
)
74 gemini_lpc_softc_t
*sc
= tag
;
75 return (*sc
->sc_bus_ops
->lpc_pnp_exit
)(tag
);
79 lpc_intr_establish(lpctag_t tag
, uint intr
, int ipl
, int ist
,
80 int (*func
)(void *), void *arg
)
82 gemini_lpc_softc_t
*sc
= tag
;
85 ih
= (*sc
->sc_bus_ops
->lpc_intr_establish
)
86 (tag
, intr
, ipl
, ist
, func
, arg
);
92 lpc_intr_disestablish(lpctag_t tag
, void *ih
)
94 gemini_lpc_softc_t
*sc
= tag
;
95 return (*sc
->sc_bus_ops
->lpc_intr_disestablish
)(tag
, ih
);
102 #endif /* _ARM_GEMINI_LPCVAR_H */