Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / ll / include / ll_impl.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: ll_impl.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
/*
* Copyright (C) 2001, Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "@(#)1.3 02/09/24 ll_impl.h"
#ifndef _LL_IMPL_H
#define _LL_IMPL_H
#define LL_REG_ADDR_MASK 0x000000ff
#define LL_REG_SR 0x00000000 /* status */
#define LL_REG_CR 0x00000004 /* control */
#define LL_REG_ECR 0x00000008 /* errorcode */
#define LL_REG_ARG_ADDR 0x0000000c /* dma argument address */
#define LL_REG_RES_ADDR 0x00000010 /* dma result address */
/* Status Register */
#define LL_SR_BUSY 0x1 /* busy - command in progress */
/* Command Register */
#define LL_CR_RESERVED 0x1
#define LL_CR_READ 0x2
#define LL_CR_WRITE 0x3
#define LL_CR_GETATTR 0x4
#define LL_CR_SETATTR 0x5
#define LL_CR_ACCESS 0x6
#define LL_CR_LOOKUP 0x7
#define LL_CR_CREATE 0x8
#define LL_CR_REMOVE 0x9
#define LL_CR_RENAME 0xa
#define LL_CR_MKDIR 0xb
#define LL_CR_RMDIR 0xc
#define LL_CR_READDIR 0xd
#define LL_CR_SYMLINK 0xe
#define LL_CR_READLINK 0xf
//
// 09/24/2002 SL The small size of names/paths caused blaze failure
// (SpecJBB, long file names produced by SpecJBB).
// The modification below requires coordinated modification
// of LLFS/LL solaris modules
//
#ifdef OLD_LL
#define LL_MAXPATHLEN 256
#define LL_MAXNAMELEN 64
#else
#define LL_MAXPATHLEN 1024
#define LL_MAXNAMELEN 512
#endif // OLD_LL
enum ll_pcibus_no {
LL_PCIBUS_A,
LL_PCIBUS_B
};
struct ll_fhandle {
char path[LL_MAXPATHLEN];
} ll_fhandle_t;
typedef struct {
struct ll_fhandle fh;
uint64_t offset;
uint32_t count;
} ll_read_arg_t;
#define LL_XFER_SIZE 8192
typedef struct {
uint32_t count;
uchar_t buf[LL_XFER_SIZE];
} ll_read_res_t;
typedef struct {
struct ll_fhandle fh;
uint64_t offset;
uint32_t count;
uchar_t buf[LL_XFER_SIZE];
} ll_write_arg_t;
typedef struct {
uint32_t count;
} ll_write_res_t;
typedef struct {
struct ll_fhandle fh;
} ll_getattr_arg_t;
enum ll_attr_type {
LL_TYPE_BAD = 0,
LL_TYPE_REG = 1,
LL_TYPE_DIR = 2,
LL_TYPE_LNK = 3
};
struct ll_attr {
enum ll_attr_type type; /* file type */
uint32_t mode; /* protection mode bits */
uint32_t nlink; /* # hard links */
uint32_t uid; /* User ID of the file's owner */
uint32_t gid; /* Group ID of the file's owner */
uint64_t size; /* file size in bytes */
int32_t atime; /* time of last access */
int32_t mtime; /* time of last data modification */
int32_t ctime; /* time of last status change */
uint32_t ino; /* inode number */
};
typedef struct {
struct ll_attr attr;
} ll_getattr_res_t;
#define LL_MASK_NONE 0x0
#define LL_MASK_MODE 0x1
#define LL_MASK_UID 0x2
#define LL_MASK_GID 0x4
#define LL_MASK_SIZE 0x8
#define LL_MASK_ATIME 0x10
#define LL_MASK_MTIME 0x20
typedef struct {
struct ll_fhandle fh;
uint_t mask;
struct ll_attr attr;
} ll_setattr_arg_t;
#define LL_AMODE_READ 0x1
#define LL_AMODE_WRITE 0x2
#define LL_AMODE_EXEC 0x4
typedef struct {
struct ll_fhandle fh;
uint_t amode;
} ll_access_arg_t;
typedef struct {
struct ll_fhandle dir_fh;
char name[LL_MAXNAMELEN];
} ll_lookup_arg_t;
typedef struct {
struct ll_fhandle fh;
enum ll_attr_type type; /* file type */
} ll_lookup_res_t;
typedef struct {
struct ll_fhandle dir_fh;
uint_t mode;
char name[LL_MAXNAMELEN];
} ll_create_arg_t;
typedef struct {
struct ll_fhandle fh;
} ll_create_res_t;
typedef struct {
struct ll_fhandle dir_fh;
char name[LL_MAXNAMELEN];
} ll_remove_arg_t;
typedef struct {
struct ll_fhandle odir_fh;
char oname[LL_MAXNAMELEN];
struct ll_fhandle ndir_fh;
char nname[LL_MAXNAMELEN];
} ll_rename_arg_t;
typedef struct {
struct ll_fhandle dir_fh;
uint_t mode;
char name[LL_MAXNAMELEN];
} ll_mkdir_arg_t;
typedef struct {
struct ll_fhandle fh;
} ll_mkdir_res_t;
typedef struct {
struct ll_fhandle dir_fh;
char name[LL_MAXNAMELEN];
} ll_rmdir_arg_t;
typedef struct {
struct ll_fhandle fh;
uint64_t offset;
} ll_readdir_arg_t;
struct ll_readdir_ent {
int reclen;
uint32_t ino;
char name[1];
};
#define LL_DB_XFER_SIZE 1024
typedef struct {
uint32_t entries;
uchar_t buf[LL_DB_XFER_SIZE];
} ll_readdir_res_t;
typedef struct {
struct ll_fhandle dir_fh;
char lname[LL_MAXNAMELEN];
char tname[LL_MAXNAMELEN];
} ll_symlink_arg_t;
typedef struct {
struct ll_fhandle fh;
} ll_readlink_arg_t;
typedef struct {
char path[LL_MAXPATHLEN];
} ll_readlink_res_t;
typedef struct ll_struct {
enum ll_pcibus_no busno;
uint32_t reg_sr; /* status register */
uint32_t reg_cr; /* command register */
uint32_t reg_ecr; /* errorcode register */
uint32_t reg_arg_addr; /* dma argument address register */
uint32_t reg_res_addr; /* dma result address register */
} ll_structT;
#endif /* _LL_IMPL_H */