Statistics
| Branch: | Revision:

root / hw / m48t59.c @ f5654039

History | View | Annotate | Download (19.7 kB)

1 a541f297 bellard
/*
2 819385c5 bellard
 * QEMU M48T59 and M48T08 NVRAM emulation for PPC PREP and Sparc platforms
3 5fafdf24 ths
 *
4 3ccacc4a blueswir1
 * Copyright (c) 2003-2005, 2007 Jocelyn Mayer
5 5fafdf24 ths
 *
6 a541f297 bellard
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 a541f297 bellard
 * of this software and associated documentation files (the "Software"), to deal
8 a541f297 bellard
 * in the Software without restriction, including without limitation the rights
9 a541f297 bellard
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 a541f297 bellard
 * copies of the Software, and to permit persons to whom the Software is
11 a541f297 bellard
 * furnished to do so, subject to the following conditions:
12 a541f297 bellard
 *
13 a541f297 bellard
 * The above copyright notice and this permission notice shall be included in
14 a541f297 bellard
 * all copies or substantial portions of the Software.
15 a541f297 bellard
 *
16 a541f297 bellard
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 a541f297 bellard
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 a541f297 bellard
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 a541f297 bellard
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 a541f297 bellard
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 a541f297 bellard
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 a541f297 bellard
 * THE SOFTWARE.
23 a541f297 bellard
 */
24 87ecb68b pbrook
#include "hw.h"
25 87ecb68b pbrook
#include "nvram.h"
26 87ecb68b pbrook
#include "qemu-timer.h"
27 87ecb68b pbrook
#include "sysemu.h"
28 d27cf0ae Blue Swirl
#include "sysbus.h"
29 f80237d4 Blue Swirl
#include "isa.h"
30 a541f297 bellard
31 13ab5daa bellard
//#define DEBUG_NVRAM
32 a541f297 bellard
33 13ab5daa bellard
#if defined(DEBUG_NVRAM)
34 001faf32 Blue Swirl
#define NVRAM_PRINTF(fmt, ...) do { printf(fmt , ## __VA_ARGS__); } while (0)
35 a541f297 bellard
#else
36 001faf32 Blue Swirl
#define NVRAM_PRINTF(fmt, ...) do { } while (0)
37 a541f297 bellard
#endif
38 a541f297 bellard
39 819385c5 bellard
/*
40 4aed2c33 blueswir1
 * The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
41 819385c5 bellard
 * alarm and a watchdog timer and related control registers. In the
42 819385c5 bellard
 * PPC platform there is also a nvram lock function.
43 819385c5 bellard
 */
44 930f3fe1 Blue Swirl
45 930f3fe1 Blue Swirl
/*
46 930f3fe1 Blue Swirl
 * Chipset docs:
47 930f3fe1 Blue Swirl
 * http://www.st.com/stonline/products/literature/ds/2410/m48t02.pdf
48 930f3fe1 Blue Swirl
 * http://www.st.com/stonline/products/literature/ds/2411/m48t08.pdf
49 930f3fe1 Blue Swirl
 * http://www.st.com/stonline/products/literature/od/7001/m48t59y.pdf
50 930f3fe1 Blue Swirl
 */
51 930f3fe1 Blue Swirl
52 43a34704 Blue Swirl
struct M48t59State {
53 a541f297 bellard
    /* Hardware parameters */
54 d537cf6c pbrook
    qemu_irq IRQ;
55 a541f297 bellard
    uint32_t io_base;
56 ee6847d1 Gerd Hoffmann
    uint32_t size;
57 a541f297 bellard
    /* RTC management */
58 a541f297 bellard
    time_t   time_offset;
59 a541f297 bellard
    time_t   stop_time;
60 a541f297 bellard
    /* Alarm & watchdog */
61 f6503059 balrog
    struct tm alarm;
62 a541f297 bellard
    struct QEMUTimer *alrm_timer;
63 a541f297 bellard
    struct QEMUTimer *wd_timer;
64 a541f297 bellard
    /* NVRAM storage */
65 a541f297 bellard
    uint8_t *buffer;
66 42c812b9 Blue Swirl
    /* Model parameters */
67 42c812b9 Blue Swirl
    uint32_t type; /* 2 = m48t02, 8 = m48t08, 59 = m48t59 */
68 42c812b9 Blue Swirl
    /* NVRAM storage */
69 42c812b9 Blue Swirl
    uint16_t addr;
70 42c812b9 Blue Swirl
    uint8_t  lock;
71 c5df018e bellard
};
72 a541f297 bellard
73 f80237d4 Blue Swirl
typedef struct M48t59ISAState {
74 f80237d4 Blue Swirl
    ISADevice busdev;
75 43a34704 Blue Swirl
    M48t59State state;
76 9936d6e4 Richard Henderson
    MemoryRegion io;
77 f80237d4 Blue Swirl
} M48t59ISAState;
78 f80237d4 Blue Swirl
79 f80237d4 Blue Swirl
typedef struct M48t59SysBusState {
80 f80237d4 Blue Swirl
    SysBusDevice busdev;
81 43a34704 Blue Swirl
    M48t59State state;
82 f80237d4 Blue Swirl
} M48t59SysBusState;
83 f80237d4 Blue Swirl
84 a541f297 bellard
/* Fake timer functions */
85 a541f297 bellard
86 a541f297 bellard
/* Alarm management */
87 a541f297 bellard
static void alarm_cb (void *opaque)
88 a541f297 bellard
{
89 f6503059 balrog
    struct tm tm;
90 a541f297 bellard
    uint64_t next_time;
91 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
92 a541f297 bellard
93 d537cf6c pbrook
    qemu_set_irq(NVRAM->IRQ, 1);
94 5fafdf24 ths
    if ((NVRAM->buffer[0x1FF5] & 0x80) == 0 &&
95 a541f297 bellard
        (NVRAM->buffer[0x1FF4] & 0x80) == 0 &&
96 a541f297 bellard
        (NVRAM->buffer[0x1FF3] & 0x80) == 0 &&
97 a541f297 bellard
        (NVRAM->buffer[0x1FF2] & 0x80) == 0) {
98 f6503059 balrog
        /* Repeat once a month */
99 f6503059 balrog
        qemu_get_timedate(&tm, NVRAM->time_offset);
100 f6503059 balrog
        tm.tm_mon++;
101 f6503059 balrog
        if (tm.tm_mon == 13) {
102 f6503059 balrog
            tm.tm_mon = 1;
103 f6503059 balrog
            tm.tm_year++;
104 f6503059 balrog
        }
105 f6503059 balrog
        next_time = qemu_timedate_diff(&tm) - NVRAM->time_offset;
106 a541f297 bellard
    } else if ((NVRAM->buffer[0x1FF5] & 0x80) != 0 &&
107 a541f297 bellard
               (NVRAM->buffer[0x1FF4] & 0x80) == 0 &&
108 a541f297 bellard
               (NVRAM->buffer[0x1FF3] & 0x80) == 0 &&
109 a541f297 bellard
               (NVRAM->buffer[0x1FF2] & 0x80) == 0) {
110 f6503059 balrog
        /* Repeat once a day */
111 f6503059 balrog
        next_time = 24 * 60 * 60;
112 a541f297 bellard
    } else if ((NVRAM->buffer[0x1FF5] & 0x80) != 0 &&
113 a541f297 bellard
               (NVRAM->buffer[0x1FF4] & 0x80) != 0 &&
114 a541f297 bellard
               (NVRAM->buffer[0x1FF3] & 0x80) == 0 &&
115 a541f297 bellard
               (NVRAM->buffer[0x1FF2] & 0x80) == 0) {
116 f6503059 balrog
        /* Repeat once an hour */
117 f6503059 balrog
        next_time = 60 * 60;
118 a541f297 bellard
    } else if ((NVRAM->buffer[0x1FF5] & 0x80) != 0 &&
119 a541f297 bellard
               (NVRAM->buffer[0x1FF4] & 0x80) != 0 &&
120 a541f297 bellard
               (NVRAM->buffer[0x1FF3] & 0x80) != 0 &&
121 a541f297 bellard
               (NVRAM->buffer[0x1FF2] & 0x80) == 0) {
122 f6503059 balrog
        /* Repeat once a minute */
123 f6503059 balrog
        next_time = 60;
124 a541f297 bellard
    } else {
125 f6503059 balrog
        /* Repeat once a second */
126 f6503059 balrog
        next_time = 1;
127 a541f297 bellard
    }
128 74475455 Paolo Bonzini
    qemu_mod_timer(NVRAM->alrm_timer, qemu_get_clock_ns(vm_clock) +
129 f6503059 balrog
                    next_time * 1000);
130 d537cf6c pbrook
    qemu_set_irq(NVRAM->IRQ, 0);
131 a541f297 bellard
}
132 a541f297 bellard
133 43a34704 Blue Swirl
static void set_alarm(M48t59State *NVRAM)
134 f6503059 balrog
{
135 f6503059 balrog
    int diff;
136 f6503059 balrog
    if (NVRAM->alrm_timer != NULL) {
137 f6503059 balrog
        qemu_del_timer(NVRAM->alrm_timer);
138 f6503059 balrog
        diff = qemu_timedate_diff(&NVRAM->alarm) - NVRAM->time_offset;
139 f6503059 balrog
        if (diff > 0)
140 f6503059 balrog
            qemu_mod_timer(NVRAM->alrm_timer, diff * 1000);
141 f6503059 balrog
    }
142 f6503059 balrog
}
143 a541f297 bellard
144 f6503059 balrog
/* RTC management helpers */
145 43a34704 Blue Swirl
static inline void get_time(M48t59State *NVRAM, struct tm *tm)
146 a541f297 bellard
{
147 f6503059 balrog
    qemu_get_timedate(tm, NVRAM->time_offset);
148 a541f297 bellard
}
149 a541f297 bellard
150 43a34704 Blue Swirl
static void set_time(M48t59State *NVRAM, struct tm *tm)
151 a541f297 bellard
{
152 f6503059 balrog
    NVRAM->time_offset = qemu_timedate_diff(tm);
153 f6503059 balrog
    set_alarm(NVRAM);
154 a541f297 bellard
}
155 a541f297 bellard
156 a541f297 bellard
/* Watchdog management */
157 a541f297 bellard
static void watchdog_cb (void *opaque)
158 a541f297 bellard
{
159 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
160 a541f297 bellard
161 a541f297 bellard
    NVRAM->buffer[0x1FF0] |= 0x80;
162 a541f297 bellard
    if (NVRAM->buffer[0x1FF7] & 0x80) {
163 a541f297 bellard
        NVRAM->buffer[0x1FF7] = 0x00;
164 a541f297 bellard
        NVRAM->buffer[0x1FFC] &= ~0x40;
165 13ab5daa bellard
        /* May it be a hw CPU Reset instead ? */
166 d7d02e3c bellard
        qemu_system_reset_request();
167 a541f297 bellard
    } else {
168 d537cf6c pbrook
        qemu_set_irq(NVRAM->IRQ, 1);
169 d537cf6c pbrook
        qemu_set_irq(NVRAM->IRQ, 0);
170 a541f297 bellard
    }
171 a541f297 bellard
}
172 a541f297 bellard
173 43a34704 Blue Swirl
static void set_up_watchdog(M48t59State *NVRAM, uint8_t value)
174 a541f297 bellard
{
175 a541f297 bellard
    uint64_t interval; /* in 1/16 seconds */
176 a541f297 bellard
177 868d585a j_mayer
    NVRAM->buffer[0x1FF0] &= ~0x80;
178 a541f297 bellard
    if (NVRAM->wd_timer != NULL) {
179 a541f297 bellard
        qemu_del_timer(NVRAM->wd_timer);
180 868d585a j_mayer
        if (value != 0) {
181 868d585a j_mayer
            interval = (1 << (2 * (value & 0x03))) * ((value >> 2) & 0x1F);
182 868d585a j_mayer
            qemu_mod_timer(NVRAM->wd_timer, ((uint64_t)time(NULL) * 1000) +
183 868d585a j_mayer
                           ((interval * 1000) >> 4));
184 868d585a j_mayer
        }
185 a541f297 bellard
    }
186 a541f297 bellard
}
187 a541f297 bellard
188 a541f297 bellard
/* Direct access to NVRAM */
189 897b4c6c j_mayer
void m48t59_write (void *opaque, uint32_t addr, uint32_t val)
190 a541f297 bellard
{
191 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
192 a541f297 bellard
    struct tm tm;
193 a541f297 bellard
    int tmp;
194 a541f297 bellard
195 819385c5 bellard
    if (addr > 0x1FF8 && addr < 0x2000)
196 819385c5 bellard
        NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
197 4aed2c33 blueswir1
198 4aed2c33 blueswir1
    /* check for NVRAM access */
199 4aed2c33 blueswir1
    if ((NVRAM->type == 2 && addr < 0x7f8) ||
200 4aed2c33 blueswir1
        (NVRAM->type == 8 && addr < 0x1ff8) ||
201 4aed2c33 blueswir1
        (NVRAM->type == 59 && addr < 0x1ff0))
202 819385c5 bellard
        goto do_write;
203 4aed2c33 blueswir1
204 4aed2c33 blueswir1
    /* TOD access */
205 819385c5 bellard
    switch (addr) {
206 a541f297 bellard
    case 0x1FF0:
207 a541f297 bellard
        /* flags register : read-only */
208 a541f297 bellard
        break;
209 a541f297 bellard
    case 0x1FF1:
210 a541f297 bellard
        /* unused */
211 a541f297 bellard
        break;
212 a541f297 bellard
    case 0x1FF2:
213 a541f297 bellard
        /* alarm seconds */
214 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x7F);
215 819385c5 bellard
        if (tmp >= 0 && tmp <= 59) {
216 f6503059 balrog
            NVRAM->alarm.tm_sec = tmp;
217 819385c5 bellard
            NVRAM->buffer[0x1FF2] = val;
218 f6503059 balrog
            set_alarm(NVRAM);
219 819385c5 bellard
        }
220 a541f297 bellard
        break;
221 a541f297 bellard
    case 0x1FF3:
222 a541f297 bellard
        /* alarm minutes */
223 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x7F);
224 819385c5 bellard
        if (tmp >= 0 && tmp <= 59) {
225 f6503059 balrog
            NVRAM->alarm.tm_min = tmp;
226 819385c5 bellard
            NVRAM->buffer[0x1FF3] = val;
227 f6503059 balrog
            set_alarm(NVRAM);
228 819385c5 bellard
        }
229 a541f297 bellard
        break;
230 a541f297 bellard
    case 0x1FF4:
231 a541f297 bellard
        /* alarm hours */
232 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x3F);
233 819385c5 bellard
        if (tmp >= 0 && tmp <= 23) {
234 f6503059 balrog
            NVRAM->alarm.tm_hour = tmp;
235 819385c5 bellard
            NVRAM->buffer[0x1FF4] = val;
236 f6503059 balrog
            set_alarm(NVRAM);
237 819385c5 bellard
        }
238 a541f297 bellard
        break;
239 a541f297 bellard
    case 0x1FF5:
240 a541f297 bellard
        /* alarm date */
241 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x1F);
242 819385c5 bellard
        if (tmp != 0) {
243 f6503059 balrog
            NVRAM->alarm.tm_mday = tmp;
244 819385c5 bellard
            NVRAM->buffer[0x1FF5] = val;
245 f6503059 balrog
            set_alarm(NVRAM);
246 819385c5 bellard
        }
247 a541f297 bellard
        break;
248 a541f297 bellard
    case 0x1FF6:
249 a541f297 bellard
        /* interrupts */
250 819385c5 bellard
        NVRAM->buffer[0x1FF6] = val;
251 a541f297 bellard
        break;
252 a541f297 bellard
    case 0x1FF7:
253 a541f297 bellard
        /* watchdog */
254 819385c5 bellard
        NVRAM->buffer[0x1FF7] = val;
255 819385c5 bellard
        set_up_watchdog(NVRAM, val);
256 a541f297 bellard
        break;
257 a541f297 bellard
    case 0x1FF8:
258 4aed2c33 blueswir1
    case 0x07F8:
259 a541f297 bellard
        /* control */
260 4aed2c33 blueswir1
       NVRAM->buffer[addr] = (val & ~0xA0) | 0x90;
261 a541f297 bellard
        break;
262 a541f297 bellard
    case 0x1FF9:
263 4aed2c33 blueswir1
    case 0x07F9:
264 a541f297 bellard
        /* seconds (BCD) */
265 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x7F);
266 a541f297 bellard
        if (tmp >= 0 && tmp <= 59) {
267 a541f297 bellard
            get_time(NVRAM, &tm);
268 a541f297 bellard
            tm.tm_sec = tmp;
269 a541f297 bellard
            set_time(NVRAM, &tm);
270 a541f297 bellard
        }
271 f6503059 balrog
        if ((val & 0x80) ^ (NVRAM->buffer[addr] & 0x80)) {
272 a541f297 bellard
            if (val & 0x80) {
273 a541f297 bellard
                NVRAM->stop_time = time(NULL);
274 a541f297 bellard
            } else {
275 a541f297 bellard
                NVRAM->time_offset += NVRAM->stop_time - time(NULL);
276 a541f297 bellard
                NVRAM->stop_time = 0;
277 a541f297 bellard
            }
278 a541f297 bellard
        }
279 f6503059 balrog
        NVRAM->buffer[addr] = val & 0x80;
280 a541f297 bellard
        break;
281 a541f297 bellard
    case 0x1FFA:
282 4aed2c33 blueswir1
    case 0x07FA:
283 a541f297 bellard
        /* minutes (BCD) */
284 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x7F);
285 a541f297 bellard
        if (tmp >= 0 && tmp <= 59) {
286 a541f297 bellard
            get_time(NVRAM, &tm);
287 a541f297 bellard
            tm.tm_min = tmp;
288 a541f297 bellard
            set_time(NVRAM, &tm);
289 a541f297 bellard
        }
290 a541f297 bellard
        break;
291 a541f297 bellard
    case 0x1FFB:
292 4aed2c33 blueswir1
    case 0x07FB:
293 a541f297 bellard
        /* hours (BCD) */
294 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x3F);
295 a541f297 bellard
        if (tmp >= 0 && tmp <= 23) {
296 a541f297 bellard
            get_time(NVRAM, &tm);
297 a541f297 bellard
            tm.tm_hour = tmp;
298 a541f297 bellard
            set_time(NVRAM, &tm);
299 a541f297 bellard
        }
300 a541f297 bellard
        break;
301 a541f297 bellard
    case 0x1FFC:
302 4aed2c33 blueswir1
    case 0x07FC:
303 a541f297 bellard
        /* day of the week / century */
304 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x07);
305 a541f297 bellard
        get_time(NVRAM, &tm);
306 a541f297 bellard
        tm.tm_wday = tmp;
307 a541f297 bellard
        set_time(NVRAM, &tm);
308 4aed2c33 blueswir1
        NVRAM->buffer[addr] = val & 0x40;
309 a541f297 bellard
        break;
310 a541f297 bellard
    case 0x1FFD:
311 4aed2c33 blueswir1
    case 0x07FD:
312 a541f297 bellard
        /* date */
313 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x1F);
314 a541f297 bellard
        if (tmp != 0) {
315 a541f297 bellard
            get_time(NVRAM, &tm);
316 a541f297 bellard
            tm.tm_mday = tmp;
317 a541f297 bellard
            set_time(NVRAM, &tm);
318 a541f297 bellard
        }
319 a541f297 bellard
        break;
320 a541f297 bellard
    case 0x1FFE:
321 4aed2c33 blueswir1
    case 0x07FE:
322 a541f297 bellard
        /* month */
323 abd0c6bd Paul Brook
        tmp = from_bcd(val & 0x1F);
324 a541f297 bellard
        if (tmp >= 1 && tmp <= 12) {
325 a541f297 bellard
            get_time(NVRAM, &tm);
326 a541f297 bellard
            tm.tm_mon = tmp - 1;
327 a541f297 bellard
            set_time(NVRAM, &tm);
328 a541f297 bellard
        }
329 a541f297 bellard
        break;
330 a541f297 bellard
    case 0x1FFF:
331 4aed2c33 blueswir1
    case 0x07FF:
332 a541f297 bellard
        /* year */
333 abd0c6bd Paul Brook
        tmp = from_bcd(val);
334 a541f297 bellard
        if (tmp >= 0 && tmp <= 99) {
335 a541f297 bellard
            get_time(NVRAM, &tm);
336 180b700d bellard
            if (NVRAM->type == 8)
337 abd0c6bd Paul Brook
                tm.tm_year = from_bcd(val) + 68; // Base year is 1968
338 180b700d bellard
            else
339 abd0c6bd Paul Brook
                tm.tm_year = from_bcd(val);
340 a541f297 bellard
            set_time(NVRAM, &tm);
341 a541f297 bellard
        }
342 a541f297 bellard
        break;
343 a541f297 bellard
    default:
344 13ab5daa bellard
        /* Check lock registers state */
345 819385c5 bellard
        if (addr >= 0x20 && addr <= 0x2F && (NVRAM->lock & 1))
346 13ab5daa bellard
            break;
347 819385c5 bellard
        if (addr >= 0x30 && addr <= 0x3F && (NVRAM->lock & 2))
348 13ab5daa bellard
            break;
349 819385c5 bellard
    do_write:
350 819385c5 bellard
        if (addr < NVRAM->size) {
351 819385c5 bellard
            NVRAM->buffer[addr] = val & 0xFF;
352 a541f297 bellard
        }
353 a541f297 bellard
        break;
354 a541f297 bellard
    }
355 a541f297 bellard
}
356 a541f297 bellard
357 897b4c6c j_mayer
uint32_t m48t59_read (void *opaque, uint32_t addr)
358 a541f297 bellard
{
359 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
360 a541f297 bellard
    struct tm tm;
361 a541f297 bellard
    uint32_t retval = 0xFF;
362 a541f297 bellard
363 4aed2c33 blueswir1
    /* check for NVRAM access */
364 4aed2c33 blueswir1
    if ((NVRAM->type == 2 && addr < 0x078f) ||
365 4aed2c33 blueswir1
        (NVRAM->type == 8 && addr < 0x1ff8) ||
366 4aed2c33 blueswir1
        (NVRAM->type == 59 && addr < 0x1ff0))
367 819385c5 bellard
        goto do_read;
368 4aed2c33 blueswir1
369 4aed2c33 blueswir1
    /* TOD access */
370 819385c5 bellard
    switch (addr) {
371 a541f297 bellard
    case 0x1FF0:
372 a541f297 bellard
        /* flags register */
373 a541f297 bellard
        goto do_read;
374 a541f297 bellard
    case 0x1FF1:
375 a541f297 bellard
        /* unused */
376 a541f297 bellard
        retval = 0;
377 a541f297 bellard
        break;
378 a541f297 bellard
    case 0x1FF2:
379 a541f297 bellard
        /* alarm seconds */
380 a541f297 bellard
        goto do_read;
381 a541f297 bellard
    case 0x1FF3:
382 a541f297 bellard
        /* alarm minutes */
383 a541f297 bellard
        goto do_read;
384 a541f297 bellard
    case 0x1FF4:
385 a541f297 bellard
        /* alarm hours */
386 a541f297 bellard
        goto do_read;
387 a541f297 bellard
    case 0x1FF5:
388 a541f297 bellard
        /* alarm date */
389 a541f297 bellard
        goto do_read;
390 a541f297 bellard
    case 0x1FF6:
391 a541f297 bellard
        /* interrupts */
392 a541f297 bellard
        goto do_read;
393 a541f297 bellard
    case 0x1FF7:
394 a541f297 bellard
        /* A read resets the watchdog */
395 a541f297 bellard
        set_up_watchdog(NVRAM, NVRAM->buffer[0x1FF7]);
396 a541f297 bellard
        goto do_read;
397 a541f297 bellard
    case 0x1FF8:
398 4aed2c33 blueswir1
    case 0x07F8:
399 a541f297 bellard
        /* control */
400 a541f297 bellard
        goto do_read;
401 a541f297 bellard
    case 0x1FF9:
402 4aed2c33 blueswir1
    case 0x07F9:
403 a541f297 bellard
        /* seconds (BCD) */
404 a541f297 bellard
        get_time(NVRAM, &tm);
405 abd0c6bd Paul Brook
        retval = (NVRAM->buffer[addr] & 0x80) | to_bcd(tm.tm_sec);
406 a541f297 bellard
        break;
407 a541f297 bellard
    case 0x1FFA:
408 4aed2c33 blueswir1
    case 0x07FA:
409 a541f297 bellard
        /* minutes (BCD) */
410 a541f297 bellard
        get_time(NVRAM, &tm);
411 abd0c6bd Paul Brook
        retval = to_bcd(tm.tm_min);
412 a541f297 bellard
        break;
413 a541f297 bellard
    case 0x1FFB:
414 4aed2c33 blueswir1
    case 0x07FB:
415 a541f297 bellard
        /* hours (BCD) */
416 a541f297 bellard
        get_time(NVRAM, &tm);
417 abd0c6bd Paul Brook
        retval = to_bcd(tm.tm_hour);
418 a541f297 bellard
        break;
419 a541f297 bellard
    case 0x1FFC:
420 4aed2c33 blueswir1
    case 0x07FC:
421 a541f297 bellard
        /* day of the week / century */
422 a541f297 bellard
        get_time(NVRAM, &tm);
423 4aed2c33 blueswir1
        retval = NVRAM->buffer[addr] | tm.tm_wday;
424 a541f297 bellard
        break;
425 a541f297 bellard
    case 0x1FFD:
426 4aed2c33 blueswir1
    case 0x07FD:
427 a541f297 bellard
        /* date */
428 a541f297 bellard
        get_time(NVRAM, &tm);
429 abd0c6bd Paul Brook
        retval = to_bcd(tm.tm_mday);
430 a541f297 bellard
        break;
431 a541f297 bellard
    case 0x1FFE:
432 4aed2c33 blueswir1
    case 0x07FE:
433 a541f297 bellard
        /* month */
434 a541f297 bellard
        get_time(NVRAM, &tm);
435 abd0c6bd Paul Brook
        retval = to_bcd(tm.tm_mon + 1);
436 a541f297 bellard
        break;
437 a541f297 bellard
    case 0x1FFF:
438 4aed2c33 blueswir1
    case 0x07FF:
439 a541f297 bellard
        /* year */
440 a541f297 bellard
        get_time(NVRAM, &tm);
441 5fafdf24 ths
        if (NVRAM->type == 8)
442 abd0c6bd Paul Brook
            retval = to_bcd(tm.tm_year - 68); // Base year is 1968
443 180b700d bellard
        else
444 abd0c6bd Paul Brook
            retval = to_bcd(tm.tm_year);
445 a541f297 bellard
        break;
446 a541f297 bellard
    default:
447 13ab5daa bellard
        /* Check lock registers state */
448 819385c5 bellard
        if (addr >= 0x20 && addr <= 0x2F && (NVRAM->lock & 1))
449 13ab5daa bellard
            break;
450 819385c5 bellard
        if (addr >= 0x30 && addr <= 0x3F && (NVRAM->lock & 2))
451 13ab5daa bellard
            break;
452 819385c5 bellard
    do_read:
453 819385c5 bellard
        if (addr < NVRAM->size) {
454 819385c5 bellard
            retval = NVRAM->buffer[addr];
455 a541f297 bellard
        }
456 a541f297 bellard
        break;
457 a541f297 bellard
    }
458 819385c5 bellard
    if (addr > 0x1FF9 && addr < 0x2000)
459 9ed1e667 blueswir1
       NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);
460 a541f297 bellard
461 a541f297 bellard
    return retval;
462 a541f297 bellard
}
463 a541f297 bellard
464 897b4c6c j_mayer
void m48t59_set_addr (void *opaque, uint32_t addr)
465 a541f297 bellard
{
466 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
467 897b4c6c j_mayer
468 a541f297 bellard
    NVRAM->addr = addr;
469 a541f297 bellard
}
470 a541f297 bellard
471 897b4c6c j_mayer
void m48t59_toggle_lock (void *opaque, int lock)
472 13ab5daa bellard
{
473 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
474 897b4c6c j_mayer
475 13ab5daa bellard
    NVRAM->lock ^= 1 << lock;
476 13ab5daa bellard
}
477 13ab5daa bellard
478 a541f297 bellard
/* IO access to NVRAM */
479 a541f297 bellard
static void NVRAM_writeb (void *opaque, uint32_t addr, uint32_t val)
480 a541f297 bellard
{
481 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
482 a541f297 bellard
483 9ed1e667 blueswir1
    NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
484 a541f297 bellard
    switch (addr) {
485 a541f297 bellard
    case 0:
486 a541f297 bellard
        NVRAM->addr &= ~0x00FF;
487 a541f297 bellard
        NVRAM->addr |= val;
488 a541f297 bellard
        break;
489 a541f297 bellard
    case 1:
490 a541f297 bellard
        NVRAM->addr &= ~0xFF00;
491 a541f297 bellard
        NVRAM->addr |= val << 8;
492 a541f297 bellard
        break;
493 a541f297 bellard
    case 3:
494 b1f88301 Blue Swirl
        m48t59_write(NVRAM, NVRAM->addr, val);
495 a541f297 bellard
        NVRAM->addr = 0x0000;
496 a541f297 bellard
        break;
497 a541f297 bellard
    default:
498 a541f297 bellard
        break;
499 a541f297 bellard
    }
500 a541f297 bellard
}
501 a541f297 bellard
502 a541f297 bellard
static uint32_t NVRAM_readb (void *opaque, uint32_t addr)
503 a541f297 bellard
{
504 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
505 13ab5daa bellard
    uint32_t retval;
506 a541f297 bellard
507 13ab5daa bellard
    switch (addr) {
508 13ab5daa bellard
    case 3:
509 819385c5 bellard
        retval = m48t59_read(NVRAM, NVRAM->addr);
510 13ab5daa bellard
        break;
511 13ab5daa bellard
    default:
512 13ab5daa bellard
        retval = -1;
513 13ab5daa bellard
        break;
514 13ab5daa bellard
    }
515 9ed1e667 blueswir1
    NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);
516 a541f297 bellard
517 13ab5daa bellard
    return retval;
518 a541f297 bellard
}
519 a541f297 bellard
520 c227f099 Anthony Liguori
static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
521 e1bb04f7 bellard
{
522 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
523 3b46e624 ths
524 819385c5 bellard
    m48t59_write(NVRAM, addr, value & 0xff);
525 e1bb04f7 bellard
}
526 e1bb04f7 bellard
527 c227f099 Anthony Liguori
static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value)
528 e1bb04f7 bellard
{
529 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
530 3b46e624 ths
531 819385c5 bellard
    m48t59_write(NVRAM, addr, (value >> 8) & 0xff);
532 819385c5 bellard
    m48t59_write(NVRAM, addr + 1, value & 0xff);
533 e1bb04f7 bellard
}
534 e1bb04f7 bellard
535 c227f099 Anthony Liguori
static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
536 e1bb04f7 bellard
{
537 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
538 3b46e624 ths
539 819385c5 bellard
    m48t59_write(NVRAM, addr, (value >> 24) & 0xff);
540 819385c5 bellard
    m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff);
541 819385c5 bellard
    m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff);
542 819385c5 bellard
    m48t59_write(NVRAM, addr + 3, value & 0xff);
543 e1bb04f7 bellard
}
544 e1bb04f7 bellard
545 c227f099 Anthony Liguori
static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
546 e1bb04f7 bellard
{
547 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
548 819385c5 bellard
    uint32_t retval;
549 3b46e624 ths
550 819385c5 bellard
    retval = m48t59_read(NVRAM, addr);
551 e1bb04f7 bellard
    return retval;
552 e1bb04f7 bellard
}
553 e1bb04f7 bellard
554 c227f099 Anthony Liguori
static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr)
555 e1bb04f7 bellard
{
556 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
557 819385c5 bellard
    uint32_t retval;
558 3b46e624 ths
559 819385c5 bellard
    retval = m48t59_read(NVRAM, addr) << 8;
560 819385c5 bellard
    retval |= m48t59_read(NVRAM, addr + 1);
561 e1bb04f7 bellard
    return retval;
562 e1bb04f7 bellard
}
563 e1bb04f7 bellard
564 c227f099 Anthony Liguori
static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr)
565 e1bb04f7 bellard
{
566 43a34704 Blue Swirl
    M48t59State *NVRAM = opaque;
567 819385c5 bellard
    uint32_t retval;
568 e1bb04f7 bellard
569 819385c5 bellard
    retval = m48t59_read(NVRAM, addr) << 24;
570 819385c5 bellard
    retval |= m48t59_read(NVRAM, addr + 1) << 16;
571 819385c5 bellard
    retval |= m48t59_read(NVRAM, addr + 2) << 8;
572 819385c5 bellard
    retval |= m48t59_read(NVRAM, addr + 3);
573 e1bb04f7 bellard
    return retval;
574 e1bb04f7 bellard
}
575 e1bb04f7 bellard
576 d60efc6b Blue Swirl
static CPUWriteMemoryFunc * const nvram_write[] = {
577 e1bb04f7 bellard
    &nvram_writeb,
578 e1bb04f7 bellard
    &nvram_writew,
579 e1bb04f7 bellard
    &nvram_writel,
580 e1bb04f7 bellard
};
581 e1bb04f7 bellard
582 d60efc6b Blue Swirl
static CPUReadMemoryFunc * const nvram_read[] = {
583 e1bb04f7 bellard
    &nvram_readb,
584 e1bb04f7 bellard
    &nvram_readw,
585 e1bb04f7 bellard
    &nvram_readl,
586 e1bb04f7 bellard
};
587 819385c5 bellard
588 fd484ae4 Juan Quintela
static const VMStateDescription vmstate_m48t59 = {
589 fd484ae4 Juan Quintela
    .name = "m48t59",
590 fd484ae4 Juan Quintela
    .version_id = 1,
591 fd484ae4 Juan Quintela
    .minimum_version_id = 1,
592 fd484ae4 Juan Quintela
    .minimum_version_id_old = 1,
593 fd484ae4 Juan Quintela
    .fields      = (VMStateField[]) {
594 fd484ae4 Juan Quintela
        VMSTATE_UINT8(lock, M48t59State),
595 fd484ae4 Juan Quintela
        VMSTATE_UINT16(addr, M48t59State),
596 fd484ae4 Juan Quintela
        VMSTATE_VBUFFER_UINT32(buffer, M48t59State, 0, NULL, 0, size),
597 fd484ae4 Juan Quintela
        VMSTATE_END_OF_LIST()
598 fd484ae4 Juan Quintela
    }
599 fd484ae4 Juan Quintela
};
600 3ccacc4a blueswir1
601 43a34704 Blue Swirl
static void m48t59_reset_common(M48t59State *NVRAM)
602 3ccacc4a blueswir1
{
603 6e6b7363 blueswir1
    NVRAM->addr = 0;
604 6e6b7363 blueswir1
    NVRAM->lock = 0;
605 3ccacc4a blueswir1
    if (NVRAM->alrm_timer != NULL)
606 3ccacc4a blueswir1
        qemu_del_timer(NVRAM->alrm_timer);
607 3ccacc4a blueswir1
608 3ccacc4a blueswir1
    if (NVRAM->wd_timer != NULL)
609 3ccacc4a blueswir1
        qemu_del_timer(NVRAM->wd_timer);
610 3ccacc4a blueswir1
}
611 3ccacc4a blueswir1
612 285e468d Blue Swirl
static void m48t59_reset_isa(DeviceState *d)
613 285e468d Blue Swirl
{
614 285e468d Blue Swirl
    M48t59ISAState *isa = container_of(d, M48t59ISAState, busdev.qdev);
615 43a34704 Blue Swirl
    M48t59State *NVRAM = &isa->state;
616 285e468d Blue Swirl
617 285e468d Blue Swirl
    m48t59_reset_common(NVRAM);
618 285e468d Blue Swirl
}
619 285e468d Blue Swirl
620 285e468d Blue Swirl
static void m48t59_reset_sysbus(DeviceState *d)
621 285e468d Blue Swirl
{
622 285e468d Blue Swirl
    M48t59SysBusState *sys = container_of(d, M48t59SysBusState, busdev.qdev);
623 43a34704 Blue Swirl
    M48t59State *NVRAM = &sys->state;
624 285e468d Blue Swirl
625 285e468d Blue Swirl
    m48t59_reset_common(NVRAM);
626 285e468d Blue Swirl
}
627 285e468d Blue Swirl
628 9936d6e4 Richard Henderson
static const MemoryRegionPortio m48t59_portio[] = {
629 9936d6e4 Richard Henderson
    {0, 4, 1, .read = NVRAM_readb, .write = NVRAM_writeb },
630 9936d6e4 Richard Henderson
    PORTIO_END_OF_LIST(),
631 9936d6e4 Richard Henderson
};
632 9936d6e4 Richard Henderson
633 9936d6e4 Richard Henderson
static const MemoryRegionOps m48t59_io_ops = {
634 9936d6e4 Richard Henderson
    .old_portio = m48t59_portio,
635 9936d6e4 Richard Henderson
};
636 9936d6e4 Richard Henderson
637 a541f297 bellard
/* Initialisation routine */
638 43a34704 Blue Swirl
M48t59State *m48t59_init(qemu_irq IRQ, target_phys_addr_t mem_base,
639 43a34704 Blue Swirl
                         uint32_t io_base, uint16_t size, int type)
640 a541f297 bellard
{
641 d27cf0ae Blue Swirl
    DeviceState *dev;
642 d27cf0ae Blue Swirl
    SysBusDevice *s;
643 f80237d4 Blue Swirl
    M48t59SysBusState *d;
644 51f9b84e Hervé Poussineau
    M48t59State *state;
645 d27cf0ae Blue Swirl
646 d27cf0ae Blue Swirl
    dev = qdev_create(NULL, "m48t59");
647 ee6847d1 Gerd Hoffmann
    qdev_prop_set_uint32(dev, "type", type);
648 ee6847d1 Gerd Hoffmann
    qdev_prop_set_uint32(dev, "size", size);
649 ee6847d1 Gerd Hoffmann
    qdev_prop_set_uint32(dev, "io_base", io_base);
650 e23a1b33 Markus Armbruster
    qdev_init_nofail(dev);
651 d27cf0ae Blue Swirl
    s = sysbus_from_qdev(dev);
652 51f9b84e Hervé Poussineau
    d = FROM_SYSBUS(M48t59SysBusState, s);
653 51f9b84e Hervé Poussineau
    state = &d->state;
654 d27cf0ae Blue Swirl
    sysbus_connect_irq(s, 0, IRQ);
655 819385c5 bellard
    if (io_base != 0) {
656 51f9b84e Hervé Poussineau
        register_ioport_read(io_base, 0x04, 1, NVRAM_readb, state);
657 51f9b84e Hervé Poussineau
        register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, state);
658 819385c5 bellard
    }
659 e1bb04f7 bellard
    if (mem_base != 0) {
660 d27cf0ae Blue Swirl
        sysbus_mmio_map(s, 0, mem_base);
661 e1bb04f7 bellard
    }
662 d27cf0ae Blue Swirl
663 51f9b84e Hervé Poussineau
    return state;
664 d27cf0ae Blue Swirl
}
665 d27cf0ae Blue Swirl
666 43a34704 Blue Swirl
M48t59State *m48t59_init_isa(uint32_t io_base, uint16_t size, int type)
667 d27cf0ae Blue Swirl
{
668 f80237d4 Blue Swirl
    M48t59ISAState *d;
669 f80237d4 Blue Swirl
    ISADevice *dev;
670 43a34704 Blue Swirl
    M48t59State *s;
671 f80237d4 Blue Swirl
672 f80237d4 Blue Swirl
    dev = isa_create("m48t59_isa");
673 f80237d4 Blue Swirl
    qdev_prop_set_uint32(&dev->qdev, "type", type);
674 f80237d4 Blue Swirl
    qdev_prop_set_uint32(&dev->qdev, "size", size);
675 f80237d4 Blue Swirl
    qdev_prop_set_uint32(&dev->qdev, "io_base", io_base);
676 e23a1b33 Markus Armbruster
    qdev_init_nofail(&dev->qdev);
677 f80237d4 Blue Swirl
    d = DO_UPCAST(M48t59ISAState, busdev, dev);
678 f80237d4 Blue Swirl
    s = &d->state;
679 d27cf0ae Blue Swirl
680 9936d6e4 Richard Henderson
    memory_region_init_io(&d->io, &m48t59_io_ops, s, "m48t59", 4);
681 f80237d4 Blue Swirl
    if (io_base != 0) {
682 9936d6e4 Richard Henderson
        isa_register_ioport(dev, &d->io, io_base);
683 f80237d4 Blue Swirl
    }
684 d27cf0ae Blue Swirl
685 f80237d4 Blue Swirl
    return s;
686 f80237d4 Blue Swirl
}
687 d27cf0ae Blue Swirl
688 43a34704 Blue Swirl
static void m48t59_init_common(M48t59State *s)
689 f80237d4 Blue Swirl
{
690 7267c094 Anthony Liguori
    s->buffer = g_malloc0(s->size);
691 d27cf0ae Blue Swirl
    if (s->type == 59) {
692 74475455 Paolo Bonzini
        s->alrm_timer = qemu_new_timer_ns(vm_clock, &alarm_cb, s);
693 74475455 Paolo Bonzini
        s->wd_timer = qemu_new_timer_ns(vm_clock, &watchdog_cb, s);
694 819385c5 bellard
    }
695 f6503059 balrog
    qemu_get_timedate(&s->alarm, 0);
696 13ab5daa bellard
697 fd484ae4 Juan Quintela
    vmstate_register(NULL, -1, &vmstate_m48t59, s);
698 f80237d4 Blue Swirl
}
699 f80237d4 Blue Swirl
700 f80237d4 Blue Swirl
static int m48t59_init_isa1(ISADevice *dev)
701 f80237d4 Blue Swirl
{
702 f80237d4 Blue Swirl
    M48t59ISAState *d = DO_UPCAST(M48t59ISAState, busdev, dev);
703 43a34704 Blue Swirl
    M48t59State *s = &d->state;
704 f80237d4 Blue Swirl
705 f80237d4 Blue Swirl
    isa_init_irq(dev, &s->IRQ, 8);
706 f80237d4 Blue Swirl
    m48t59_init_common(s);
707 f80237d4 Blue Swirl
708 81a322d4 Gerd Hoffmann
    return 0;
709 d27cf0ae Blue Swirl
}
710 3ccacc4a blueswir1
711 f80237d4 Blue Swirl
static int m48t59_init1(SysBusDevice *dev)
712 f80237d4 Blue Swirl
{
713 f80237d4 Blue Swirl
    M48t59SysBusState *d = FROM_SYSBUS(M48t59SysBusState, dev);
714 43a34704 Blue Swirl
    M48t59State *s = &d->state;
715 f80237d4 Blue Swirl
    int mem_index;
716 f80237d4 Blue Swirl
717 f80237d4 Blue Swirl
    sysbus_init_irq(dev, &s->IRQ);
718 f80237d4 Blue Swirl
719 2507c12a Alexander Graf
    mem_index = cpu_register_io_memory(nvram_read, nvram_write, s,
720 2507c12a Alexander Graf
                                       DEVICE_NATIVE_ENDIAN);
721 f80237d4 Blue Swirl
    sysbus_init_mmio(dev, s->size, mem_index);
722 f80237d4 Blue Swirl
    m48t59_init_common(s);
723 f80237d4 Blue Swirl
724 f80237d4 Blue Swirl
    return 0;
725 f80237d4 Blue Swirl
}
726 f80237d4 Blue Swirl
727 f80237d4 Blue Swirl
static ISADeviceInfo m48t59_isa_info = {
728 f80237d4 Blue Swirl
    .init = m48t59_init_isa1,
729 f80237d4 Blue Swirl
    .qdev.name = "m48t59_isa",
730 f80237d4 Blue Swirl
    .qdev.size = sizeof(M48t59ISAState),
731 285e468d Blue Swirl
    .qdev.reset = m48t59_reset_isa,
732 f80237d4 Blue Swirl
    .qdev.no_user = 1,
733 f80237d4 Blue Swirl
    .qdev.props = (Property[]) {
734 f80237d4 Blue Swirl
        DEFINE_PROP_UINT32("size",    M48t59ISAState, state.size,    -1),
735 f80237d4 Blue Swirl
        DEFINE_PROP_UINT32("type",    M48t59ISAState, state.type,    -1),
736 f80237d4 Blue Swirl
        DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base,  0),
737 f80237d4 Blue Swirl
        DEFINE_PROP_END_OF_LIST(),
738 f80237d4 Blue Swirl
    }
739 f80237d4 Blue Swirl
};
740 f80237d4 Blue Swirl
741 ee6847d1 Gerd Hoffmann
static SysBusDeviceInfo m48t59_info = {
742 ee6847d1 Gerd Hoffmann
    .init = m48t59_init1,
743 ee6847d1 Gerd Hoffmann
    .qdev.name  = "m48t59",
744 f80237d4 Blue Swirl
    .qdev.size = sizeof(M48t59SysBusState),
745 285e468d Blue Swirl
    .qdev.reset = m48t59_reset_sysbus,
746 ee6847d1 Gerd Hoffmann
    .qdev.props = (Property[]) {
747 f80237d4 Blue Swirl
        DEFINE_PROP_UINT32("size",    M48t59SysBusState, state.size,    -1),
748 f80237d4 Blue Swirl
        DEFINE_PROP_UINT32("type",    M48t59SysBusState, state.type,    -1),
749 f80237d4 Blue Swirl
        DEFINE_PROP_HEX32( "io_base", M48t59SysBusState, state.io_base,  0),
750 01274424 Gerd Hoffmann
        DEFINE_PROP_END_OF_LIST(),
751 ee6847d1 Gerd Hoffmann
    }
752 ee6847d1 Gerd Hoffmann
};
753 ee6847d1 Gerd Hoffmann
754 d27cf0ae Blue Swirl
static void m48t59_register_devices(void)
755 d27cf0ae Blue Swirl
{
756 ee6847d1 Gerd Hoffmann
    sysbus_register_withprop(&m48t59_info);
757 f80237d4 Blue Swirl
    isa_qdev_register(&m48t59_isa_info);
758 a541f297 bellard
}
759 d27cf0ae Blue Swirl
760 d27cf0ae Blue Swirl
device_init(m48t59_register_devices)