Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / ll / include / ll_impl.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ll_impl.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23/*
24 * Copyright (C) 2001, Sun Microsystems, Inc.
25 * All rights reserved.
26 */
27#pragma ident "@(#)1.3 02/09/24 ll_impl.h"
28
29#ifndef _LL_IMPL_H
30#define _LL_IMPL_H
31
32#define LL_REG_ADDR_MASK 0x000000ff
33#define LL_REG_SR 0x00000000 /* status */
34#define LL_REG_CR 0x00000004 /* control */
35#define LL_REG_ECR 0x00000008 /* errorcode */
36#define LL_REG_ARG_ADDR 0x0000000c /* dma argument address */
37#define LL_REG_RES_ADDR 0x00000010 /* dma result address */
38
39/* Status Register */
40#define LL_SR_BUSY 0x1 /* busy - command in progress */
41
42/* Command Register */
43#define LL_CR_RESERVED 0x1
44#define LL_CR_READ 0x2
45#define LL_CR_WRITE 0x3
46#define LL_CR_GETATTR 0x4
47#define LL_CR_SETATTR 0x5
48#define LL_CR_ACCESS 0x6
49#define LL_CR_LOOKUP 0x7
50#define LL_CR_CREATE 0x8
51#define LL_CR_REMOVE 0x9
52#define LL_CR_RENAME 0xa
53#define LL_CR_MKDIR 0xb
54#define LL_CR_RMDIR 0xc
55#define LL_CR_READDIR 0xd
56#define LL_CR_SYMLINK 0xe
57#define LL_CR_READLINK 0xf
58
59
60//
61// 09/24/2002 SL The small size of names/paths caused blaze failure
62// (SpecJBB, long file names produced by SpecJBB).
63// The modification below requires coordinated modification
64// of LLFS/LL solaris modules
65//
66#ifdef OLD_LL
67
68#define LL_MAXPATHLEN 256
69#define LL_MAXNAMELEN 64
70
71#else
72
73#define LL_MAXPATHLEN 1024
74#define LL_MAXNAMELEN 512
75
76#endif // OLD_LL
77
78enum ll_pcibus_no {
79 LL_PCIBUS_A,
80 LL_PCIBUS_B
81};
82
83struct ll_fhandle {
84 char path[LL_MAXPATHLEN];
85} ll_fhandle_t;
86
87typedef struct {
88 struct ll_fhandle fh;
89 uint64_t offset;
90 uint32_t count;
91} ll_read_arg_t;
92
93#define LL_XFER_SIZE 8192
94
95typedef struct {
96 uint32_t count;
97 uchar_t buf[LL_XFER_SIZE];
98} ll_read_res_t;
99
100typedef struct {
101 struct ll_fhandle fh;
102 uint64_t offset;
103 uint32_t count;
104 uchar_t buf[LL_XFER_SIZE];
105} ll_write_arg_t;
106
107typedef struct {
108 uint32_t count;
109} ll_write_res_t;
110
111typedef struct {
112 struct ll_fhandle fh;
113} ll_getattr_arg_t;
114
115enum ll_attr_type {
116 LL_TYPE_BAD = 0,
117 LL_TYPE_REG = 1,
118 LL_TYPE_DIR = 2,
119 LL_TYPE_LNK = 3
120};
121
122struct ll_attr {
123 enum ll_attr_type type; /* file type */
124 uint32_t mode; /* protection mode bits */
125 uint32_t nlink; /* # hard links */
126 uint32_t uid; /* User ID of the file's owner */
127 uint32_t gid; /* Group ID of the file's owner */
128 uint64_t size; /* file size in bytes */
129 int32_t atime; /* time of last access */
130 int32_t mtime; /* time of last data modification */
131 int32_t ctime; /* time of last status change */
132 uint32_t ino; /* inode number */
133};
134
135typedef struct {
136 struct ll_attr attr;
137} ll_getattr_res_t;
138
139#define LL_MASK_NONE 0x0
140#define LL_MASK_MODE 0x1
141#define LL_MASK_UID 0x2
142#define LL_MASK_GID 0x4
143#define LL_MASK_SIZE 0x8
144#define LL_MASK_ATIME 0x10
145#define LL_MASK_MTIME 0x20
146
147typedef struct {
148 struct ll_fhandle fh;
149 uint_t mask;
150 struct ll_attr attr;
151} ll_setattr_arg_t;
152
153#define LL_AMODE_READ 0x1
154#define LL_AMODE_WRITE 0x2
155#define LL_AMODE_EXEC 0x4
156
157typedef struct {
158 struct ll_fhandle fh;
159 uint_t amode;
160} ll_access_arg_t;
161
162typedef struct {
163 struct ll_fhandle dir_fh;
164 char name[LL_MAXNAMELEN];
165} ll_lookup_arg_t;
166
167typedef struct {
168 struct ll_fhandle fh;
169 enum ll_attr_type type; /* file type */
170} ll_lookup_res_t;
171
172typedef struct {
173 struct ll_fhandle dir_fh;
174 uint_t mode;
175 char name[LL_MAXNAMELEN];
176} ll_create_arg_t;
177
178typedef struct {
179 struct ll_fhandle fh;
180} ll_create_res_t;
181
182typedef struct {
183 struct ll_fhandle dir_fh;
184 char name[LL_MAXNAMELEN];
185} ll_remove_arg_t;
186
187typedef struct {
188 struct ll_fhandle odir_fh;
189 char oname[LL_MAXNAMELEN];
190 struct ll_fhandle ndir_fh;
191 char nname[LL_MAXNAMELEN];
192} ll_rename_arg_t;
193
194typedef struct {
195 struct ll_fhandle dir_fh;
196 uint_t mode;
197 char name[LL_MAXNAMELEN];
198} ll_mkdir_arg_t;
199
200typedef struct {
201 struct ll_fhandle fh;
202} ll_mkdir_res_t;
203
204typedef struct {
205 struct ll_fhandle dir_fh;
206 char name[LL_MAXNAMELEN];
207} ll_rmdir_arg_t;
208
209typedef struct {
210 struct ll_fhandle fh;
211 uint64_t offset;
212} ll_readdir_arg_t;
213
214struct ll_readdir_ent {
215 int reclen;
216 uint32_t ino;
217 char name[1];
218};
219
220#define LL_DB_XFER_SIZE 1024
221
222typedef struct {
223 uint32_t entries;
224 uchar_t buf[LL_DB_XFER_SIZE];
225} ll_readdir_res_t;
226
227typedef struct {
228 struct ll_fhandle dir_fh;
229 char lname[LL_MAXNAMELEN];
230 char tname[LL_MAXNAMELEN];
231} ll_symlink_arg_t;
232
233typedef struct {
234 struct ll_fhandle fh;
235} ll_readlink_arg_t;
236
237typedef struct {
238 char path[LL_MAXPATHLEN];
239} ll_readlink_res_t;
240
241typedef struct ll_struct {
242 enum ll_pcibus_no busno;
243
244 uint32_t reg_sr; /* status register */
245 uint32_t reg_cr; /* command register */
246 uint32_t reg_ecr; /* errorcode register */
247 uint32_t reg_arg_addr; /* dma argument address register */
248 uint32_t reg_res_addr; /* dma result address register */
249} ll_structT;
250
251#endif /* _LL_IMPL_H */
252
253
254