Annotation of qemu/hw/spapr_vio.h, revision 1.1.1.2

1.1       root        1: #ifndef _HW_SPAPR_VIO_H
                      2: #define _HW_SPAPR_VIO_H
                      3: /*
                      4:  * QEMU sPAPR VIO bus definitions
                      5:  *
                      6:  * Copyright (c) 2010 David Gibson, IBM Corporation <[email protected]>
                      7:  * Based on the s390 virtio bus definitions:
                      8:  * Copyright (c) 2009 Alexander Graf <[email protected]>
                      9:  *
                     10:  * This library is free software; you can redistribute it and/or
                     11:  * modify it under the terms of the GNU Lesser General Public
                     12:  * License as published by the Free Software Foundation; either
                     13:  * version 2 of the License, or (at your option) any later version.
                     14:  *
                     15:  * This library is distributed in the hope that it will be useful,
                     16:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     18:  * Lesser General Public License for more details.
                     19:  *
                     20:  * You should have received a copy of the GNU Lesser General Public
                     21:  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
                     22:  */
                     23: 
                     24: #define SPAPR_VIO_TCE_PAGE_SHIFT   12
                     25: #define SPAPR_VIO_TCE_PAGE_SIZE    (1ULL << SPAPR_VIO_TCE_PAGE_SHIFT)
                     26: #define SPAPR_VIO_TCE_PAGE_MASK    (SPAPR_VIO_TCE_PAGE_SIZE - 1)
                     27: 
                     28: enum VIOsPAPR_TCEAccess {
                     29:     SPAPR_TCE_FAULT = 0,
                     30:     SPAPR_TCE_RO = 1,
                     31:     SPAPR_TCE_WO = 2,
                     32:     SPAPR_TCE_RW = 3,
                     33: };
                     34: 
                     35: #define SPAPR_VTY_BASE_ADDRESS     0x30000000
                     36: 
                     37: struct VIOsPAPRDevice;
                     38: 
                     39: typedef struct VIOsPAPR_RTCE {
                     40:     uint64_t tce;
                     41: } VIOsPAPR_RTCE;
                     42: 
                     43: typedef struct VIOsPAPR_CRQ {
                     44:     uint64_t qladdr;
                     45:     uint32_t qsize;
                     46:     uint32_t qnext;
                     47:     int(*SendFunc)(struct VIOsPAPRDevice *vdev, uint8_t *crq);
                     48: } VIOsPAPR_CRQ;
                     49: 
                     50: typedef struct VIOsPAPRDevice {
                     51:     DeviceState qdev;
                     52:     uint32_t reg;
                     53:     uint32_t flags;
                     54: #define VIO_PAPR_FLAG_DMA_BYPASS        0x1
                     55:     qemu_irq qirq;
                     56:     uint32_t vio_irq_num;
                     57:     target_ulong signal_state;
                     58:     uint32_t rtce_window_size;
                     59:     VIOsPAPR_RTCE *rtce_table;
1.1.1.2 ! root       60:     int kvmtce_fd;
1.1       root       61:     VIOsPAPR_CRQ crq;
                     62: } VIOsPAPRDevice;
                     63: 
1.1.1.2 ! root       64: #define DEFINE_SPAPR_PROPERTIES(type, field, default_reg, default_dma_window) \
        !            65:         DEFINE_PROP_UINT32("reg", type, field.reg, default_reg), \
        !            66:         DEFINE_PROP_UINT32("dma-window", type, field.rtce_window_size, \
        !            67:                            default_dma_window)
        !            68: 
1.1       root       69: typedef struct VIOsPAPRBus {
                     70:     BusState bus;
                     71: } VIOsPAPRBus;
                     72: 
                     73: typedef struct {
                     74:     DeviceInfo qdev;
                     75:     const char *dt_name, *dt_type, *dt_compatible;
                     76:     target_ulong signal_mask;
                     77:     int (*init)(VIOsPAPRDevice *dev);
                     78:     void (*hcalls)(VIOsPAPRBus *bus);
                     79:     int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off);
                     80: } VIOsPAPRDeviceInfo;
                     81: 
                     82: extern VIOsPAPRBus *spapr_vio_bus_init(void);
                     83: extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
                     84: extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info);
                     85: extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);
1.1.1.2 ! root       86: extern int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus);
1.1       root       87: 
                     88: extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);
                     89: 
                     90: int spapr_vio_check_tces(VIOsPAPRDevice *dev, target_ulong ioba,
                     91:                          target_ulong len,
                     92:                          enum VIOsPAPR_TCEAccess access);
                     93: 
                     94: int spapr_tce_dma_read(VIOsPAPRDevice *dev, uint64_t taddr,
                     95:                        void *buf, uint32_t size);
                     96: int spapr_tce_dma_write(VIOsPAPRDevice *dev, uint64_t taddr,
                     97:                         const void *buf, uint32_t size);
                     98: int spapr_tce_dma_zero(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t size);
                     99: void stb_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint8_t val);
                    100: void sth_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint16_t val);
                    101: void stw_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t val);
                    102: void stq_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint64_t val);
                    103: uint64_t ldq_tce(VIOsPAPRDevice *dev, uint64_t taddr);
                    104: 
                    105: int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq);
                    106: 
                    107: void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len);
1.1.1.2 ! root      108: void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev);
        !           109: void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd);
        !           110: void spapr_vscsi_create(VIOsPAPRBus *bus, uint32_t reg);
1.1       root      111: 
1.1.1.2 ! root      112: VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus);
1.1       root      113: 
                    114: int spapr_tce_set_bypass(uint32_t unit, uint32_t enable);
                    115: void spapr_vio_quiesce(void);
                    116: 
                    117: #endif /* _HW_SPAPR_VIO_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.