Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / include / helpers.h
1 /******************************************************************************
2  * Copyright (c) 2007, 2012, 2013 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12 /*
13  * USB SLOF Prototypes
14  */
15
16 #ifndef _USB_SLOF_H
17 #define _USB_SLOF_H
18
19 #include <stdint.h>
20
21 extern uint32_t SLOF_GetTimer(void);
22 extern void SLOF_msleep(uint32_t time);
23 extern void SLOF_usleep(uint32_t time);
24 extern void *SLOF_dma_alloc(long size);
25 extern void SLOF_dma_free(void *virt, long size);
26 extern void *SLOF_alloc_mem(long size);
27 extern void *SLOF_alloc_mem_aligned(long size, long align);
28 extern void SLOF_free_mem(void *addr, long size);
29 extern long SLOF_dma_map_in(void *virt, long size, int cacheable);
30 extern void SLOF_dma_map_out(long phys, void *virt, long size);
31 extern long SLOF_pci_config_read32(long offset);
32 extern long SLOF_pci_config_read16(long offset);
33 extern void SLOF_pci_config_write32(long offset, long value);
34 extern void SLOF_pci_config_write16(long offset, long value);
35 extern void *SLOF_translate_my_address(void *addr);
36
37 #define offset_of(type, member) ((long) &((type *)0)->member)
38 #define container_of(ptr, type, member) ({                      \
39                         const typeof(((type *)0)->member)* struct_ptr = (ptr); \
40                         (type *)((char *)struct_ptr - offset_of(type, member)); })
41
42 #endif