~vcs-imports/qemu/maemo

« back to all changes in this revision

Viewing changes to hw/pl080.c

  • Committer: Riku Voipio
  • Date: 2009-06-08 15:31:58 UTC
  • mfrom: (6281.2.366)
  • mto: This revision was merged to the branch mainline in revision 6452.
  • Revision ID: git-v1:759b334a9739814df2883aa4c41b1c0f5670e90a
Merge commit 'gnu/master' into test

Epic merge

Conflicts:
        Makefile
        block.c
        block.h
        configure
        hw/boards.h
        hw/flash.h
        hw/integratorcp.c
        hw/nand.c
        hw/omap2.c
        hw/omap_i2c.c
        hw/sd.c
        hw/smc91c111.c
        hw/tsc2005.c
        hw/tusb6010.c
        hw/usb-musb.c
        linux-user/syscall.c
        target-arm/machine.c
        target-arm/translate.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This code is licenced under the GPL.
8
8
 */
9
9
 
10
 
#include "hw.h"
11
 
#include "primecell.h"
 
10
#include "sysbus.h"
12
11
 
13
12
#define PL080_MAX_CHANNELS 8
14
13
#define PL080_CONF_E    0x1
37
36
} pl080_channel;
38
37
 
39
38
typedef struct {
 
39
    SysBusDevice busdev;
40
40
    uint8_t tc_int;
41
41
    uint8_t tc_mask;
42
42
    uint8_t err_int;
93
93
    if ((s->conf & PL080_CONF_E) == 0)
94
94
        return;
95
95
 
96
 
cpu_abort(cpu_single_env, "DMA active\n");
 
96
hw_error("DMA active\n");
97
97
    /* If we are already in the middle of a DMA operation then indicate that
98
98
       there may be new DMA requests and return immediately.  */
99
99
    if (s->running) {
111
111
                continue;
112
112
            flow = (ch->conf >> 11) & 7;
113
113
            if (flow >= 4) {
114
 
                cpu_abort(cpu_single_env,
 
114
                hw_error(
115
115
                    "pl080_run: Peripheral flow control not implemented\n");
116
116
            }
117
117
            src_id = (ch->conf >> 1) & 0x1f;
242
242
        return s->sync;
243
243
    default:
244
244
    bad_offset:
245
 
        cpu_abort(cpu_single_env, "pl080_read: Bad offset %x\n", (int)offset);
 
245
        hw_error("pl080_read: Bad offset %x\n", (int)offset);
246
246
        return 0;
247
247
    }
248
248
}
288
288
    case 10: /* SoftLBReq */
289
289
    case 11: /* SoftLSReq */
290
290
        /* ??? Implement these.  */
291
 
        cpu_abort(cpu_single_env, "pl080_write: Soft DMA not implemented\n");
 
291
        hw_error("pl080_write: Soft DMA not implemented\n");
292
292
        break;
293
293
    case 12: /* Configuration */
294
294
        s->conf = value;
295
295
        if (s->conf & (PL080_CONF_M1 | PL080_CONF_M1)) {
296
 
            cpu_abort(cpu_single_env,
297
 
                      "pl080_write: Big-endian DMA not implemented\n");
 
296
            hw_error("pl080_write: Big-endian DMA not implemented\n");
298
297
        }
299
298
        pl080_run(s);
300
299
        break;
303
302
        break;
304
303
    default:
305
304
    bad_offset:
306
 
        cpu_abort(cpu_single_env, "pl080_write: Bad offset %x\n", (int)offset);
 
305
        hw_error("pl080_write: Bad offset %x\n", (int)offset);
307
306
    }
308
307
    pl080_update(s);
309
308
}
320
319
   pl080_write
321
320
};
322
321
 
323
 
/* The PL080 and PL081 are the same except for the number of channels
324
 
   they implement (8 and 2 respectively).  */
325
 
void *pl080_init(uint32_t base, qemu_irq irq, int nchannels)
 
322
static void pl08x_init(SysBusDevice *dev, int nchannels)
326
323
{
327
324
    int iomemtype;
328
 
    pl080_state *s;
 
325
    pl080_state *s = FROM_SYSBUS(pl080_state, dev);
329
326
 
330
 
    s = (pl080_state *)qemu_mallocz(sizeof(pl080_state));
331
327
    iomemtype = cpu_register_io_memory(0, pl080_readfn,
332
328
                                       pl080_writefn, s);
333
 
    cpu_register_physical_memory(base, 0x00001000, iomemtype);
334
 
    s->irq = irq;
 
329
    sysbus_init_mmio(dev, 0x1000, iomemtype);
 
330
    sysbus_init_irq(dev, &s->irq);
335
331
    s->nchannels = nchannels;
336
332
    /* ??? Save/restore.  */
337
 
    return s;
338
 
}
 
333
}
 
334
 
 
335
static void pl080_init(SysBusDevice *dev)
 
336
{
 
337
    pl08x_init(dev, 8);
 
338
}
 
339
 
 
340
static void pl081_init(SysBusDevice *dev)
 
341
{
 
342
    pl08x_init(dev, 2);
 
343
}
 
344
 
 
345
/* The PL080 and PL081 are the same except for the number of channels
 
346
   they implement (8 and 2 respectively).  */
 
347
static void pl080_register_devices(void)
 
348
{
 
349
    sysbus_register_dev("pl080", sizeof(pl080_state), pl080_init);
 
350
    sysbus_register_dev("pl081", sizeof(pl080_state), pl081_init);
 
351
}
 
352
 
 
353
device_init(pl080_register_devices)