xref: /openbmc/qemu/include/hw/rtc/m48t59.h (revision ea9cea93)
1819ce6b2SPhilippe Mathieu-Daudé /*
2819ce6b2SPhilippe Mathieu-Daudé  * QEMU M48T59 and M48T08 NVRAM emulation
3819ce6b2SPhilippe Mathieu-Daudé  *
4819ce6b2SPhilippe Mathieu-Daudé  * Copyright (c) 2003-2005, 2007 Jocelyn Mayer
5819ce6b2SPhilippe Mathieu-Daudé  * Copyright (c) 2013 Hervé Poussineau
6819ce6b2SPhilippe Mathieu-Daudé  *
7819ce6b2SPhilippe Mathieu-Daudé  * Permission is hereby granted, free of charge, to any person obtaining a copy
8819ce6b2SPhilippe Mathieu-Daudé  * of this software and associated documentation files (the "Software"), to deal
9819ce6b2SPhilippe Mathieu-Daudé  * in the Software without restriction, including without limitation the rights
10819ce6b2SPhilippe Mathieu-Daudé  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11819ce6b2SPhilippe Mathieu-Daudé  * copies of the Software, and to permit persons to whom the Software is
12819ce6b2SPhilippe Mathieu-Daudé  * furnished to do so, subject to the following conditions:
13819ce6b2SPhilippe Mathieu-Daudé  *
14819ce6b2SPhilippe Mathieu-Daudé  * The above copyright notice and this permission notice shall be included in
15819ce6b2SPhilippe Mathieu-Daudé  * all copies or substantial portions of the Software.
16819ce6b2SPhilippe Mathieu-Daudé  *
17819ce6b2SPhilippe Mathieu-Daudé  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18819ce6b2SPhilippe Mathieu-Daudé  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19819ce6b2SPhilippe Mathieu-Daudé  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20819ce6b2SPhilippe Mathieu-Daudé  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21819ce6b2SPhilippe Mathieu-Daudé  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22819ce6b2SPhilippe Mathieu-Daudé  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23819ce6b2SPhilippe Mathieu-Daudé  * THE SOFTWARE.
24819ce6b2SPhilippe Mathieu-Daudé  */
25819ce6b2SPhilippe Mathieu-Daudé 
26819ce6b2SPhilippe Mathieu-Daudé #ifndef HW_RTC_M48T59_H
27819ce6b2SPhilippe Mathieu-Daudé #define HW_RTC_M48T59_H
28819ce6b2SPhilippe Mathieu-Daudé 
29819ce6b2SPhilippe Mathieu-Daudé #include "exec/hwaddr.h"
30819ce6b2SPhilippe Mathieu-Daudé #include "qom/object.h"
31819ce6b2SPhilippe Mathieu-Daudé 
32819ce6b2SPhilippe Mathieu-Daudé #define TYPE_NVRAM "nvram"
33819ce6b2SPhilippe Mathieu-Daudé 
34db1015e9SEduardo Habkost typedef struct NvramClass NvramClass;
358110fa1dSEduardo Habkost DECLARE_CLASS_CHECKERS(NvramClass, NVRAM,
368110fa1dSEduardo Habkost                        TYPE_NVRAM)
37819ce6b2SPhilippe Mathieu-Daudé #define NVRAM(obj) \
38819ce6b2SPhilippe Mathieu-Daudé     INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM)
39819ce6b2SPhilippe Mathieu-Daudé 
40819ce6b2SPhilippe Mathieu-Daudé typedef struct Nvram Nvram;
41819ce6b2SPhilippe Mathieu-Daudé 
42db1015e9SEduardo Habkost struct NvramClass {
43819ce6b2SPhilippe Mathieu-Daudé     InterfaceClass parent;
44819ce6b2SPhilippe Mathieu-Daudé 
45819ce6b2SPhilippe Mathieu-Daudé     uint32_t (*read)(Nvram *obj, uint32_t addr);
46819ce6b2SPhilippe Mathieu-Daudé     void (*write)(Nvram *obj, uint32_t addr, uint32_t val);
47819ce6b2SPhilippe Mathieu-Daudé     void (*toggle_lock)(Nvram *obj, int lock);
48db1015e9SEduardo Habkost };
49819ce6b2SPhilippe Mathieu-Daudé 
50*ea9cea93SMarkus Armbruster #endif /* HW_RTC_M48T59_H */
51