qemu/include/hw/misc/macio/macio.h
<<
>>
Prefs
   1/*
   2 * PowerMac MacIO device emulation
   3 *
   4 * Copyright (c) 2005-2007 Fabrice Bellard
   5 * Copyright (c) 2007 Jocelyn Mayer
   6 *
   7 * Permission is hereby granted, free of charge, to any person obtaining a copy
   8 * of this software and associated documentation files (the "Software"), to deal
   9 * in the Software without restriction, including without limitation the rights
  10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11 * copies of the Software, and to permit persons to whom the Software is
  12 * furnished to do so, subject to the following conditions:
  13 *
  14 * The above copyright notice and this permission notice shall be included in
  15 * all copies or substantial portions of the Software.
  16 *
  17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23 * THE SOFTWARE.
  24 */
  25
  26#ifndef MACIO_H
  27#define MACIO_H
  28
  29#include "hw/char/escc.h"
  30#include "hw/intc/heathrow_pic.h"
  31#include "hw/misc/macio/cuda.h"
  32#include "hw/misc/macio/gpio.h"
  33#include "hw/misc/macio/pmu.h"
  34#include "hw/ppc/mac_dbdma.h"
  35#include "hw/ppc/openpic.h"
  36
  37/* MacIO virtual bus */
  38#define TYPE_MACIO_BUS "macio-bus"
  39#define MACIO_BUS(obj) OBJECT_CHECK(MacIOBusState, (obj), TYPE_MACIO_BUS)
  40
  41typedef struct MacIOBusState {
  42    /*< private >*/
  43    BusState parent_obj;
  44} MacIOBusState;
  45
  46/* MacIO IDE */
  47#define TYPE_MACIO_IDE "macio-ide"
  48#define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE)
  49
  50typedef struct MACIOIDEState {
  51    /*< private >*/
  52    SysBusDevice parent_obj;
  53    /*< public >*/
  54    uint32_t addr;
  55    uint32_t channel;
  56    qemu_irq real_ide_irq;
  57    qemu_irq real_dma_irq;
  58    qemu_irq ide_irq;
  59    qemu_irq dma_irq;
  60
  61    MemoryRegion mem;
  62    IDEBus bus;
  63    IDEDMA dma;
  64    void *dbdma;
  65    bool dma_active;
  66    uint32_t timing_reg;
  67    uint32_t irq_reg;
  68} MACIOIDEState;
  69
  70void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table);
  71void macio_ide_register_dma(MACIOIDEState *ide);
  72
  73#define TYPE_MACIO "macio"
  74#define MACIO(obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO)
  75
  76typedef struct MacIOState {
  77    /*< private >*/
  78    PCIDevice parent;
  79    /*< public >*/
  80
  81    MacIOBusState macio_bus;
  82    MemoryRegion bar;
  83    CUDAState cuda;
  84    PMUState pmu;
  85    DBDMAState dbdma;
  86    ESCCState escc;
  87    uint64_t frequency;
  88} MacIOState;
  89
  90#define TYPE_OLDWORLD_MACIO "macio-oldworld"
  91#define OLDWORLD_MACIO(obj) \
  92    OBJECT_CHECK(OldWorldMacIOState, (obj), TYPE_OLDWORLD_MACIO)
  93
  94typedef struct OldWorldMacIOState {
  95    /*< private >*/
  96    MacIOState parent_obj;
  97    /*< public >*/
  98
  99    HeathrowState *pic;
 100
 101    MacIONVRAMState nvram;
 102    MACIOIDEState ide[2];
 103} OldWorldMacIOState;
 104
 105#define TYPE_NEWWORLD_MACIO "macio-newworld"
 106#define NEWWORLD_MACIO(obj) \
 107    OBJECT_CHECK(NewWorldMacIOState, (obj), TYPE_NEWWORLD_MACIO)
 108
 109typedef struct NewWorldMacIOState {
 110    /*< private >*/
 111    MacIOState parent_obj;
 112    /*< public >*/
 113
 114    bool has_pmu;
 115    bool has_adb;
 116    OpenPICState *pic;
 117    MACIOIDEState ide[2];
 118    MacIOGPIOState gpio;
 119} NewWorldMacIOState;
 120
 121#endif /* MACIO_H */
 122