1 /* $Id: upa.h,v 1.1 2009/02/28 16:48:11 fredette Exp $ */
2 
3 /* tme/bus/upa.h - public header file for UPA bus emulation */
4 
5 /*
6  * Copyright (c) 2008 Matt Fredette
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by Matt Fredette.
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _TME_BUS_UPA_H
37 #define _TME_BUS_UPA_H
38 
39 #include <tme/common.h>
40 _TME_RCSID("$Id: upa.h,v 1.1 2009/02/28 16:48:11 fredette Exp $");
41 
42 /* includes: */
43 #include <tme/element.h>
44 #include <tme/completion.h>
45 #undef TME_BUS_VERSION
46 #define TME_BUS_VERSION TME_X_VERSION(0, 0)
47 #include <tme/generic/bus.h>
48 
49 /* macros: */
50 
51 /* UPA capabilities: */
52 #define TME_UPA_UPACAP_HANDLERSLAVE		TME_BIT(4)
53 #define TME_UPA_UPACAP_INTERRUPTMASTER		TME_BIT(3)
54 #define TME_UPA_UPACAP_SLAVE_INT_L		TME_BIT(2)
55 #define TME_UPA_UPACAP_CACHEMASTER		TME_BIT(1)
56 #define TME_UPA_UPACAP_MASTER			TME_BIT(0)
57 
58 /* fields in a UPA port ID register: */
59 #define TME_UPA_PORT_ID_COOKIE			(((tme_uint64_t) 0xfc) << 56)
60 #define TME_UPA_PORT_ID_ECC_NOT_VALID		(((tme_uint64_t) 1) << 34)
61 #define TME_UPA_PORT_ID_ONEREAD			(((tme_uint64_t) 1) << 33)
62 #define TME_UPA_PORT_ID_PINT_RDQ		((((tme_uint64_t) 1) << 32) - (((tme_uint64_t) 1) << 31))
63 #define TME_UPA_PORT_ID_PREQ_DQ			((((tme_uint32_t) 2) << 30) - (1 << 25))
64 #define TME_UPA_PORT_ID_PREQ_RQ			((2 << 24) - (1 << 21))
65 #define TME_UPA_PORT_ID_UPACAP			((2 << 20) - (1 << 16))
66 #define TME_UPA_PORT_ID_ID			((2 << 15) - (1 << 0))
67 
68 /* fields in a UPA port config register: */
69 #define TME_UPA_PORT_CONFIG_SCIQ1		((2 << 7) - (1 << 4))
70 #define TME_UPA_PORT_CONFIG_SCIQ0		((2 << 3) - (1 << 0))
71 
72 /* types: */
73 
74 /* a UPA bus connection: */
75 struct tme_upa_bus_connection {
76 
77   /* a generic bus connection: */
78   struct tme_bus_connection tme_upa_bus_connection;
79 
80   /* the master ID for this connection: */
81   tme_uint32_t tme_upa_bus_connection_mid;
82 
83   /* the UPA interrupt function: */
84 #ifdef TME_HAVE_INT64_T
85   void (*tme_upa_bus_interrupt) _TME_P((struct tme_upa_bus_connection *,
86 					tme_uint32_t,
87 					const tme_uint64_t *,
88 					struct tme_completion *));
89 #endif /* TME_HAVE_INT64_T */
90 };
91 
92 #endif /* !_TME_BUS_UPA_H */
93