Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: SS_Csr.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 | #ifndef SS_CSR_H | |
24 | #define SS_CSR_H | |
25 | /************************************************************************ | |
26 | ** | |
27 | ** Copyright (C) 2006, Sun Microsystems, Inc. | |
28 | ** | |
29 | ** Sun considers its source code as an unpublished, proprietary | |
30 | ** trade secret and it is available only under strict license provisions. | |
31 | ** This copyright notice is placed here only to protect Sun in the event | |
32 | ** the source is deemed a published work. Disassembly, decompilation, | |
33 | ** or other means of reducing the object code to human readable form | |
34 | ** is prohibited by the license agreement under which this code is | |
35 | ** provided to the user or company in possession of this copy. | |
36 | ** | |
37 | *************************************************************************/ | |
38 | #include "SS_Io.h" | |
39 | #include "MemoryTransaction.h" | |
40 | ||
41 | class SS_Csr | |
42 | { | |
43 | public: | |
44 | // a derived class must define a static access_io() function to be | |
45 | // registered in SS_Io to handle I/O address operation. | |
46 | ||
47 | //static int access_io(void* obj, int sid, int type, uint64_t addr, uint32_t size, uint64_t* data, uint64_t bitmask); | |
48 | ||
49 | SS_Csr() : followme_(false) { } | |
50 | ||
51 | /** | |
52 | * potential read access type includes: READ, INTERNAL, etc. | |
53 | * | |
54 | * INTERNAL will allow read from WO registers/fields. | |
55 | */ | |
56 | virtual int read64(SS_Paddr pa, | |
57 | uint64_t *data, | |
58 | int access=MemoryTransaction::READ, | |
59 | int sid=-1) | |
60 | { return SS_Io::NOT_HANDLED; } | |
61 | ||
62 | /** | |
63 | * potential write access type includes: WRITE, INTERNAL, FOLLOW_ME, | |
64 | * MEM_SLAM, LITTLE_ENDIAN, etc | |
65 | * | |
66 | * when set FOLLOW_ME, write a csr follow-me value to the corresponding | |
67 | * csr register, the write does not affect the real csr register value, the | |
68 | * follow-me value is kept in a special queue, and follows a "FIFO & | |
69 | * use-once-and discard" rule. | |
70 | * | |
71 | * INTERNAL will allow write to RO (and non-reserved) registers/fields. | |
72 | */ | |
73 | virtual int write64(SS_Paddr pa, | |
74 | uint64_t value, | |
75 | int access=MemoryTransaction::WRITE, | |
76 | int sid=-1) | |
77 | { return SS_Io::NOT_HANDLED; } | |
78 | ||
79 | void set_followme(bool val) { followme_ = val; } | |
80 | bool get_followme() { return followme_; } | |
81 | ||
82 | protected: | |
83 | // a derived class should define a address_map() function to check on | |
84 | // valid csr address ranges. | |
85 | SS_Io::access_io_status address_map( SS_Paddr paddr, int access, int sid) { return SS_Io::NOT_HANDLED; } | |
86 | ||
87 | bool followme_; | |
88 | }; | |
89 | ||
90 | #endif /* SS_CSR_RANGE_H */ |