Rev 3502 | Rev 3549 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3502 | Rev 3514 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2008 Pavel Rimsky |
2 | * Copyright (c) 2008 Pavel Rimsky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
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 |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup sparc64 |
29 | /** @addtogroup sparc64 |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #ifndef KERN_sparc64_SGCN_H_ |
35 | #ifndef KERN_sparc64_SGCN_H_ |
36 | #define KERN_sparc64_SGCN_H_ |
36 | #define KERN_sparc64_SGCN_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | 39 | ||
40 | /* number of bytes in the TOC magic, including the terminating '\0' */ |
40 | /* number of bytes in the TOC magic, including the terminating '\0' */ |
41 | #define TOC_MAGIC_BYTES 8 |
41 | #define TOC_MAGIC_BYTES 8 |
42 | 42 | ||
43 | /* number of bytes in the TOC key, including the terminating '\0' */ |
43 | /* number of bytes in the TOC key, including the terminating '\0' */ |
44 | #define TOC_KEY_SIZE 8 |
44 | #define TOC_KEY_SIZE 8 |
45 | 45 | ||
46 | /* maximum number of entries in the SRAM table of contents */ |
46 | /* maximum number of entries in the SRAM table of contents */ |
47 | #define MAX_TOC_ENTRIES 32 |
47 | #define MAX_TOC_ENTRIES 32 |
48 | 48 | ||
49 | /* number of bytes in the SGCN buffer magic, including the terminating '\0' */ |
49 | /* number of bytes in the SGCN buffer magic, including the terminating '\0' */ |
50 | #define SGCN_MAGIC_BYTES 4 |
50 | #define SGCN_MAGIC_BYTES 4 |
51 | 51 | ||
52 | /** |
52 | /** |
53 | * Entry in the SRAM table of contents. Describes one segment of the SRAM |
53 | * Entry in the SRAM table of contents. Describes one segment of the SRAM |
54 | * which serves a particular purpose (e.g. OBP serial console, Solaris serial |
54 | * which serves a particular purpose (e.g. OBP serial console, Solaris serial |
55 | * console, Solaris mailbox,...). |
55 | * console, Solaris mailbox,...). |
56 | */ |
56 | */ |
57 | typedef struct { |
57 | typedef struct { |
58 | /** key (e.g. "OBPCONS", "SOLCONS", "SOLMBOX",...) */ |
58 | /** key (e.g. "OBPCONS", "SOLCONS", "SOLMBOX",...) */ |
59 | char key[TOC_KEY_SIZE]; |
59 | char key[TOC_KEY_SIZE]; |
60 | 60 | ||
61 | /** size of the segment in bytes */ |
61 | /** size of the segment in bytes */ |
62 | uint32_t size; |
62 | uint32_t size; |
63 | 63 | ||
64 | /** offset of the segment within SRAM */ |
64 | /** offset of the segment within SRAM */ |
65 | uint32_t offset; |
65 | uint32_t offset; |
66 | } __attribute ((packed)) toc_entry_t; |
66 | } __attribute ((packed)) toc_entry_t; |
67 | 67 | ||
68 | /** |
68 | /** |
69 | * SRAM table of contents. Describes all segments within the SRAM. |
69 | * SRAM table of contents. Describes all segments within the SRAM. |
70 | */ |
70 | */ |
71 | typedef struct { |
71 | typedef struct { |
72 | /** hard-wired to "TOCSRAM" */ |
72 | /** hard-wired to "TOCSRAM" */ |
73 | char magic[TOC_MAGIC_BYTES]; |
73 | char magic[TOC_MAGIC_BYTES]; |
74 | 74 | ||
75 | /** we don't need this */ |
75 | /** we don't need this */ |
76 | char unused[8]; |
76 | char unused[8]; |
77 | 77 | ||
78 | /** TOC entries */ |
78 | /** TOC entries */ |
79 | toc_entry_t keys[MAX_TOC_ENTRIES]; |
79 | toc_entry_t keys[MAX_TOC_ENTRIES]; |
80 | } __attribute__ ((packed)) iosram_toc_t; |
80 | } __attribute__ ((packed)) iosram_toc_t; |
81 | 81 | ||
82 | /** |
82 | /** |
83 | * SGCN buffer header. It is placed at the very beginning of the SGCN |
83 | * SGCN buffer header. It is placed at the very beginning of the SGCN |
84 | * buffer. |
84 | * buffer. |
85 | */ |
85 | */ |
86 | typedef struct { |
86 | typedef struct { |
87 | /** hard-wired to "CON" */ |
87 | /** hard-wired to "CON" */ |
88 | char magic[SGCN_MAGIC_BYTES]; |
88 | char magic[SGCN_MAGIC_BYTES]; |
89 | 89 | ||
90 | /** we don't need this */ |
90 | /** we don't need this */ |
91 | char unused[8]; |
91 | char unused[8]; |
92 | 92 | ||
93 | /** offset within the SGCN buffer of the input buffer start */ |
93 | /** offset within the SGCN buffer of the input buffer start */ |
94 | uint32_t in_begin; |
94 | uint32_t in_begin; |
95 | 95 | ||
96 | /** offset within the SGCN buffer of the input buffer end */ |
96 | /** offset within the SGCN buffer of the input buffer end */ |
97 | uint32_t in_end; |
97 | uint32_t in_end; |
98 | 98 | ||
99 | /** offset within the SGCN buffer of the input buffer read pointer */ |
99 | /** offset within the SGCN buffer of the input buffer read pointer */ |
100 | uint32_t in_rdptr; |
100 | uint32_t in_rdptr; |
101 | 101 | ||
102 | /** offset within the SGCN buffer of the input buffer write pointer */ |
102 | /** offset within the SGCN buffer of the input buffer write pointer */ |
103 | uint32_t in_wrptr; |
103 | uint32_t in_wrptr; |
104 | 104 | ||
105 | /** offset within the SGCN buffer of the output buffer start */ |
105 | /** offset within the SGCN buffer of the output buffer start */ |
106 | uint32_t out_begin; |
106 | uint32_t out_begin; |
107 | 107 | ||
108 | /** offset within the SGCN buffer of the output buffer end */ |
108 | /** offset within the SGCN buffer of the output buffer end */ |
109 | uint32_t out_end; |
109 | uint32_t out_end; |
110 | 110 | ||
111 | /** offset within the SGCN buffer of the output buffer read pointer */ |
111 | /** offset within the SGCN buffer of the output buffer read pointer */ |
112 | uint32_t out_rdptr; |
112 | uint32_t out_rdptr; |
113 | 113 | ||
114 | /** offset within the SGCN buffer of the output buffer write pointer */ |
114 | /** offset within the SGCN buffer of the output buffer write pointer */ |
115 | uint32_t out_wrptr; |
115 | uint32_t out_wrptr; |
116 | } __attribute__ ((packed)) sgcn_buffer_header_t; |
116 | } __attribute__ ((packed)) sgcn_buffer_header_t; |
117 | 117 | ||
118 | void sgcn_init(void); |
118 | void sgcn_init(void); |
- | 119 | void sgcn_poll(void); |
|
119 | 120 | ||
120 | #endif |
121 | #endif |
121 | 122 | ||
122 | /** @} |
123 | /** @} |
123 | */ |
124 | */ |