aboutsummaryrefslogtreecommitdiff
path: root/include/hw/timer/m48t59.h
blob: ddbbda26af6fbdcf26f267bff1d0000d4079460b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef NVRAM_H
#define NVRAM_H

#include "qemu-common.h"
#include "qom/object.h"

/* NVRAM helpers */
typedef uint32_t (*nvram_read_t)(void *private, uint32_t addr);
typedef void (*nvram_write_t)(void *private, uint32_t addr, uint32_t val);
typedef struct nvram_t {
    void *opaque;
    nvram_read_t read_fn;
    nvram_write_t write_fn;
} nvram_t;

uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr);
int NVRAM_get_string (nvram_t *nvram, uint8_t *dst, uint16_t addr, int max);

int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
                          const char *arch,
                          uint32_t RAM_size, int boot_device,
                          uint32_t kernel_image, uint32_t kernel_size,
                          const char *cmdline,
                          uint32_t initrd_image, uint32_t initrd_size,
                          uint32_t NVRAM_image,
                          int width, int height, int depth);

#define TYPE_SYSBUS_M48T59 "m48t59"

typedef struct M48t59State M48t59State;

void m48t59_write (void *private, uint32_t addr, uint32_t val);
uint32_t m48t59_read (void *private, uint32_t addr);
void m48t59_toggle_lock (void *private, int lock);
M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
                             int type);
M48t59State *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
                         uint32_t io_base, uint16_t size, int type);

#define TYPE_NVRAM "nvram"

#define NVRAM_CLASS(klass) \
    OBJECT_CLASS_CHECK(NvramClass, (klass), TYPE_NVRAM)
#define NVRAM_GET_CLASS(obj) \
    OBJECT_GET_CLASS(NvramClass, (obj), TYPE_NVRAM)
#define NVRAM(obj) \
    INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM)

typedef struct Nvram {
    Object parent;
} Nvram;

typedef struct NvramClass {
    InterfaceClass parent;

    uint32_t (*read)(Nvram *obj, uint32_t addr);
    void (*write)(Nvram *obj, uint32_t addr, uint32_t val);
    void (*toggle_lock)(Nvram *obj, int lock);
} NvramClass;

#endif /* !NVRAM_H */