virtpci.h revision 90addb0218d47a886c846a22d75979fe5bf3471b
1/* virtpci.h 2 * 3 * Copyright (C) 2010 - 2013 UNISYS CORPORATION 4 * All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or (at 9 * your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 14 * NON INFRINGEMENT. See the GNU General Public License for more 15 * details. 16 */ 17 18/* 19 * Unisys Virtual PCI driver header 20 */ 21 22#ifndef __VIRTPCI_H__ 23#define __VIRTPCI_H__ 24 25#include "uisqueue.h" 26#include <linux/version.h> 27#include <linux/uuid.h> 28 29#define PCI_DEVICE_ID_VIRTHBA 0xAA00 30#define PCI_DEVICE_ID_VIRTNIC 0xAB00 31 32struct scsi_adap_info { 33 void *scsihost; /* scsi host if this device is a scsi hba */ 34 struct vhba_wwnn wwnn; /* the world wide node name of vhba */ 35 struct vhba_config_max max; /* various max specifications used 36 * to config vhba */ 37}; 38 39struct net_adap_info { 40 struct net_device *netdev; /* network device if this 41 * device is a NIC */ 42 u8 mac_addr[MAX_MACADDR_LEN]; 43 int num_rcv_bufs; 44 unsigned mtu; 45 uuid_le zoneGuid; 46}; 47 48typedef enum { 49 VIRTHBA_TYPE = 0, 50 VIRTNIC_TYPE = 1, 51 VIRTBUS_TYPE = 6, 52} VIRTPCI_DEV_TYPE; 53 54struct virtpci_dev { 55 VIRTPCI_DEV_TYPE devtype; /* indicates type of the 56 * virtual pci device */ 57 struct virtpci_driver *mydriver; /* which driver has allocated 58 * this device */ 59 unsigned short vendor; /* vendor id for device */ 60 unsigned short device; /* device id for device */ 61 U32 busNo; /* number of bus on which device exists */ 62 U32 deviceNo; /* device's number on the bus */ 63 struct InterruptInfo intr; /* interrupt info */ 64 struct device generic_dev; /* generic device */ 65 union { 66 struct scsi_adap_info scsi; 67 struct net_adap_info net; 68 }; 69 70 struct uisqueue_info queueinfo; /* holds ptr to channel where cmds & 71 * rsps are queued & retrieved */ 72 struct virtpci_dev *next; /* points to next virtpci device */ 73}; 74 75struct virtpci_driver { 76 struct list_head node; 77 const char *name; /* the name of the driver in sysfs */ 78 const char *version; 79 const char *vertag; 80 const char *build_date; 81 const char *build_time; 82 const struct pci_device_id *id_table; /* must be non-NULL for probe 83 * to be called */ 84 int (*probe)(struct virtpci_dev *dev, 85 const struct pci_device_id *id); /* device inserted */ 86 void (*remove)(struct virtpci_dev *dev); /* Device removed (NULL if 87 * not a hot-plug capable 88 * driver) */ 89 int (*suspend)(struct virtpci_dev *dev, 90 u32 state); /* Device suspended */ 91 int (*resume)(struct virtpci_dev *dev); /* Device woken up */ 92 int (*enable_wake)(struct virtpci_dev *dev, 93 u32 state, int enable); /* Enable wake event */ 94 struct device_driver core_driver; /* VIRTPCI core fills this in */ 95}; 96 97#define driver_to_virtpci_driver(in_drv) \ 98 container_of(in_drv, struct virtpci_driver, core_driver) 99#define device_to_virtpci_dev(in_dev) \ 100 container_of(in_dev, struct virtpci_dev, generic_dev) 101 102int virtpci_register_driver(struct virtpci_driver *); 103void virtpci_unregister_driver(struct virtpci_driver *); 104 105#endif /* __VIRTPCI_H__ */ 106