2005-04-17 02:20:36 +04:00
/*
* IBM PowerPC Virtual I / O Infrastructure Support .
*
2005-10-24 08:32:35 +04:00
* Copyright ( c ) 2003 IBM Corp .
* Dave Engebretsen engebret @ us . ibm . com
* Santiago Leon santil @ us . ibm . com
2005-04-17 02:20:36 +04:00
*
2005-10-24 08:32:35 +04:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version
* 2 of the License , or ( at your option ) any later version .
2005-04-17 02:20:36 +04:00
*/
2005-10-24 08:32:35 +04:00
# ifndef _ASM_POWERPC_VIO_H
# define _ASM_POWERPC_VIO_H
2005-12-17 00:43:46 +03:00
# ifdef __KERNEL__
2005-04-17 02:20:36 +04:00
# include <linux/init.h>
# include <linux/errno.h>
# include <linux/device.h>
# include <linux/dma-mapping.h>
2005-08-17 10:42:59 +04:00
# include <linux/mod_devicetable.h>
2005-08-17 10:41:44 +04:00
2005-04-17 02:20:36 +04:00
# include <asm/hvcall.h>
# include <asm/scatterlist.h>
2005-08-17 10:41:44 +04:00
/*
2005-04-17 02:20:36 +04:00
* Architecture - specific constants for drivers to
* extract attributes of the device using vio_get_attribute ( )
2005-08-17 10:41:44 +04:00
*/
2005-04-17 02:20:36 +04:00
# define VETH_MAC_ADDR "local-mac-address"
# define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters"
/* End architecture-specific constants */
# define h_vio_signal(ua, mode) \
plpar_hcall_norets ( H_VIO_SIGNAL , ua , mode )
# define VIO_IRQ_DISABLE 0UL
# define VIO_IRQ_ENABLE 1UL
struct iommu_table ;
2005-08-17 10:41:44 +04:00
/*
* The vio_dev structure is used to describe virtual I / O devices .
*/
struct vio_dev {
2006-07-12 09:35:54 +04:00
const char * name ;
const char * type ;
2005-08-17 10:41:44 +04:00
uint32_t unit_address ;
unsigned int irq ;
struct device dev ;
} ;
2005-04-17 02:20:36 +04:00
struct vio_driver {
2005-08-17 10:41:44 +04:00
const struct vio_device_id * id_table ;
int ( * probe ) ( struct vio_dev * dev , const struct vio_device_id * id ) ;
int ( * remove ) ( struct vio_dev * dev ) ;
2005-04-17 02:20:36 +04:00
struct device_driver driver ;
} ;
2005-08-17 10:41:44 +04:00
extern int vio_register_driver ( struct vio_driver * drv ) ;
extern void vio_unregister_driver ( struct vio_driver * drv ) ;
extern void __devinit vio_unregister_device ( struct vio_dev * dev ) ;
struct device_node ;
2008-02-05 06:15:12 +03:00
extern struct vio_dev * vio_register_device_node (
2005-08-17 10:41:44 +04:00
struct device_node * node_vdev ) ;
2006-04-27 11:18:21 +04:00
extern const void * vio_get_attribute ( struct vio_dev * vdev , char * which ,
2005-08-17 10:41:44 +04:00
int * length ) ;
2006-04-27 11:18:21 +04:00
# ifdef CONFIG_PPC_PSERIES
extern struct vio_dev * vio_find_node ( struct device_node * vnode ) ;
2005-08-17 10:41:44 +04:00
extern int vio_enable_interrupts ( struct vio_dev * dev ) ;
extern int vio_disable_interrupts ( struct vio_dev * dev ) ;
2007-07-23 05:55:32 +04:00
# else
static inline int vio_enable_interrupts ( struct vio_dev * dev )
{
return 0 ;
}
2005-08-17 10:41:44 +04:00
# endif
2005-04-17 02:20:36 +04:00
static inline struct vio_driver * to_vio_driver ( struct device_driver * drv )
{
return container_of ( drv , struct vio_driver , driver ) ;
}
static inline struct vio_dev * to_vio_dev ( struct device * dev )
{
return container_of ( dev , struct vio_dev , dev ) ;
}
2005-12-17 00:43:46 +03:00
# endif /* __KERNEL__ */
2005-10-24 08:32:35 +04:00
# endif /* _ASM_POWERPC_VIO_H */