Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / ll / include / ll_mod.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: ll_mod.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 2004 by Sun Microsystems, Inc.
* All rights reserved.
*
* @(#)ll_mod.h 1.3 04/08/04
*/
#ifndef _LL_MOD_H
#define _LL_MOD_H
#include "pci.h"
#include "pci_dev.h"
#include "ll_impl.h"
#include "dr.h"
#include "module.h"
#define TARGET_PAGE_SIZE 0x2000 /* This should _not_ be here.*/
#define TARGET_PAGE_OFFSET (TARGET_PAGE_SIZE - 1) /* Ditto. */
struct ll_rdce {
struct ll_rdce *prev, *next;
uint32_t ino;
char name[LL_MAXNAMELEN];
};
class LL : public Module, public genericPciDev{
private:
//mmi_instance_t instance;
bool initialized;
public:
ll_structT *sp;
struct ll_rdce *rdce_head;
struct ll_rdce *rdce_tail;
private:
ll_structT *allocation_obj();
int LL::reg_access(char *buf, LWord paddr, bool_t wr);
uint32_t rd_status();
uint32_t rd_errorcode();
uint32_t rd_arg_addr();
uint32_t rd_res_addr();
void wr_control(uint32_t val);
void wr_arg_addr(uint32_t val);
void wr_res_addr(uint32_t val);
void cmd_read();
void cmd_write();
void cmd_getattr();
void cmd_setattr();
void cmd_access();
void cmd_lookup();
void cmd_create();
void cmd_remove();
void cmd_rename();
void cmd_mkdir();
void cmd_rmdir();
void cmd_readdir();
void cmd_symlink();
void cmd_readlink();
void path_canon(char *canonpath, const char *path, const char *name);
int rdc_init(struct ll_fhandle *fhp);
void dma_in(uint64_t vaddr, void *data, long count);
void dma_out(uint64_t vaddr, void *data, long count);
uint64_t get_translation(uint64_t vaddr);
void crc(uint32_t *crcp, uchar_t *bp, size_t n);
bool dump(FILE *);
bool restore(FILE *);
public:
LL(const char *modname, const char *instance_name);
~LL();
public: // Module interface
const char *get_help();
bool parse_arg(const char *);
bool check_args();
void init_done();
void module_added(mmi_instance_t, const char*);
void module_deleted(mmi_instance_t, const char*);
void modinfo();
void *get_interface(const char*);
void get_dev_props();
private:
uint64_t pciMem32_base;
uint64_t pciMem32_size;
//pure virtual functions of genricPciDev class
mmi_instance_t pciDev_getInstance();
const char * pciDev_getName();
void pciDev_confAccessCb(bool_t wr, uint64_t offset, uint8_t size);
//override the pciTarget_mem32access function
pciXactnStatus pciTarget_mem32access(uint64_t offset, bool wr,uint64_t * buf, uint8_t size);
void initPci();
};
#endif /* LL_MOD_H */