svn commit: r210183 - projects/ofed/head/sys/ofed/include/linux
Jeff Roberson
jeff at FreeBSD.org
Sat Jul 17 01:40:41 UTC 2010
Author: jeff
Date: Sat Jul 17 01:40:41 2010
New Revision: 210183
URL: http://svn.freebsd.org/changeset/base/210183
Log:
- Various refinements to the linux wrappers.
Sponsored by: Isilon Systems, iX Systems, and Panasas.
Added:
projects/ofed/head/sys/ofed/include/linux/delay.h
projects/ofed/head/sys/ofed/include/linux/hardirq.h
projects/ofed/head/sys/ofed/include/linux/rtnetlink.h
projects/ofed/head/sys/ofed/include/linux/vmalloc.h
Modified:
projects/ofed/head/sys/ofed/include/linux/compiler.h
projects/ofed/head/sys/ofed/include/linux/device.h
projects/ofed/head/sys/ofed/include/linux/dmapool.h
projects/ofed/head/sys/ofed/include/linux/file.h
projects/ofed/head/sys/ofed/include/linux/fs.h
projects/ofed/head/sys/ofed/include/linux/if_ether.h
projects/ofed/head/sys/ofed/include/linux/interrupt.h
projects/ofed/head/sys/ofed/include/linux/jiffies.h
projects/ofed/head/sys/ofed/include/linux/kernel.h
projects/ofed/head/sys/ofed/include/linux/kthread.h
projects/ofed/head/sys/ofed/include/linux/linux_compat.c
projects/ofed/head/sys/ofed/include/linux/list.h
projects/ofed/head/sys/ofed/include/linux/log2.h
projects/ofed/head/sys/ofed/include/linux/module.h
projects/ofed/head/sys/ofed/include/linux/netdevice.h
projects/ofed/head/sys/ofed/include/linux/pci.h
projects/ofed/head/sys/ofed/include/linux/sched.h
projects/ofed/head/sys/ofed/include/linux/string.h
projects/ofed/head/sys/ofed/include/linux/sysfs.h
projects/ofed/head/sys/ofed/include/linux/types.h
Modified: projects/ofed/head/sys/ofed/include/linux/compiler.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/compiler.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/compiler.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -46,6 +46,7 @@
#define __bitwise
#define __devinitdata
#define __init
+#define __devinit
#define __exit
#define __stringify(x) #x
#define __attribute_const__ __attribute__((__const__))
@@ -54,4 +55,6 @@
#define unlikely(x) __builtin_expect(!!(x), 0)
#define typeof(x) __typeof(x)
+#define uninitialized_var(x) x = x
+
#endif /* _LINUX_COMPILER_H_ */
Added: projects/ofed/head/sys/ofed/include/linux/delay.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/delay.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -0,0 +1,27 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
Modified: projects/ofed/head/sys/ofed/include/linux/device.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/device.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/device.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -41,24 +41,30 @@
#include <sys/bus.h>
+enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED, IRQ_WAKE_THREAD, };
+typedef enum irqreturn irqreturn_t;
+
struct class {
const char *name;
struct module *owner;
devclass_t bsdclass;
};
-struct linux_device {
- struct linux_device *parent;
+struct device {
+ struct device *parent;
device_t bsddev;
dev_t devt;
struct class *class;
- void (*release)(struct linux_device *dev);
+ void (*release)(struct device *dev);
+ irqreturn_t (*irqhandler)(int, void *);
+ void *irqtag;
struct kobject kobj;
uint64_t *dma_mask;
void *driver_data;
+
};
-#define device linux_device
+/* #define device linux_device */
struct class_attribute {
struct attribute attr;
Modified: projects/ofed/head/sys/ofed/include/linux/dmapool.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/dmapool.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/dmapool.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -40,7 +40,7 @@ struct dma_pool {
};
static inline struct dma_pool *
-dma_pool_create(char *name, struct linux_device *dev, size_t size,
+dma_pool_create(char *name, struct device *dev, size_t size,
size_t align, size_t boundary)
{
struct dma_pool *pool;
Modified: projects/ofed/head/sys/ofed/include/linux/file.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/file.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/file.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -29,12 +29,18 @@
#define _LINUX_FILE_H_
#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/filedesc.h>
+#include <sys/refcount.h>
+#include <sys/proc.h>
+
+#include <linux/fs.h>
struct linux_file;
#undef file
-struct fileops linuxfileops;
+extern struct fileops linuxfileops;
static inline struct linux_file *
linux_fget(unsigned int fd)
@@ -67,9 +73,9 @@ put_unused_fd(unsigned int fd)
}
static inline void
-fd_install(unsigned int fd, struct file *file)
+fd_install(unsigned int fd, struct linux_file *filp)
{
- file->f_ops = &linuxfileops;
+ filp->_file->f_ops = &linuxfileops;
}
#define file linux_file
Modified: projects/ofed/head/sys/ofed/include/linux/fs.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/fs.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/fs.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -30,12 +30,12 @@
#include <sys/systm.h>
#include <sys/conf.h>
-#include <sys/types.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <linux/types.h>
#include <linux/wait.h>
+#include <linux/semaphore.h>
struct module;
struct kiocb;
@@ -52,6 +52,8 @@ struct files_struct;
#define i_cdev v_rdev
#define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
+#define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
+
typedef struct files_struct *fl_owner_t;
Added: projects/ofed/head/sys/ofed/include/linux/hardirq.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/hardirq.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _LINUX_HARDIRQ_H_
+#define _LINUX_HARDIRQ_H_
+
+#define synchronize_irq(irq) panic("Unimplemented");
+
+#endif /* _LINUX_HARDIRQ_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/if_ether.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/if_ether.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/if_ether.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -28,7 +28,8 @@
#ifndef _LINUX_IF_ETHER_H_
#define _LINUX_IF_ETHER_H_
-#include <sys/types.h>
+#include <linux/types.h>
+
#include <net/ethernet.h>
#define ETH_P_8021Q ETHERTYPE_VLAN
Modified: projects/ofed/head/sys/ofed/include/linux/interrupt.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/interrupt.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/interrupt.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -29,4 +29,53 @@
#ifndef _LINUX_INTERRUPT_H_
#define _LINUX_INTERRUPT_H_
+#include <linux/device.h>
+
+#include <sys/bus.h>
+#include <sys/rman.h>
+
+typedef irqreturn_t (*irq_handler_t)(int, void *);
+
+#define IRQ_RETVAL(x) ((x) != IRQ_NONE)
+
+#define IRQF_SHARED RF_SHAREABLE
+
+static void
+_irq_handler(void *device)
+{
+ struct device *dev;
+
+ dev = device;
+ dev->irqhandler(0, dev);
+}
+
+static inline int
+request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
+ const char *name, void *device)
+{
+ struct resource *res;
+ struct device *dev;
+ int error;
+ int rid;
+
+ dev = device;
+ rid = 0;
+ res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, flags | RF_ACTIVE);
+ if (res == NULL)
+ return (-ENXIO);
+ error = bus_setup_intr(dev, res, INTR_TYPE_NET | INTR_MPSAFE, NULL,
+ _irq_handler, dev, &dev->irqtag);
+ if (error)
+ return (-error);
+ dev->irqhandler = handler;
+
+ return 0;
+}
+
+static inline void
+free_irq(unsigned int irq, void *device)
+{
+ /* XXX */
+}
+
#endif /* _LINUX_INTERRUPT_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/jiffies.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/jiffies.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/jiffies.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -27,7 +27,8 @@
*/
#ifndef _LINUX_JIFFIES_H_
#define _LINUX_JIFFIES_H_
-#include <sys/types.h>
+#include <linux/types.h>
+
#include <sys/time.h>
#include <sys/kernel.h>
@@ -48,5 +49,6 @@ msecs_to_jiffies(int msec)
#define time_after_eq(a, b) ((long)(a) - (long)(b) >= 0)
#define time_before_eq(a, b) time_after_eq(b, a)
+#define HZ hz
#endif /* _LINUX_JIFFIES_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/kernel.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/kernel.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/kernel.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/libkern.h>
#include <sys/stat.h>
+#include <sys/smp.h>
#include <linux/bitops.h>
#include <linux/compiler.h>
@@ -48,9 +49,11 @@
#define BUG() panic("BUG")
#define BUG_ON(condition) do { if (condition) BUG(); } while(0)
+#define WARN_ON BUG_ON
#undef ALIGN
#define ALIGN(x, y) roundup2((x), (y))
+#define DIV_ROUND_UP howmany
#define printk(X...) printf(X)
#define udelay(t) DELAY(t)
@@ -77,4 +80,6 @@
#define min_t(type, _x, _y) (type)(_x) < (type)(_y) ? (type)(_x) : (_y)
#define max_t(type, _x, _y) (type)(_x) > (type)(_y) ? (type)(_x) : (_y)
+#define num_possible_cpus() mp_ncpus
+
#endif /* _LINUX_KERNEL_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/kthread.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/kthread.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/kthread.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -28,11 +28,16 @@
#ifndef _LINUX_KTHREAD_H_
#define _LINUX_KTHREAD_H_
-#include <linux/slab.h>
-#include <linux/sched.h>
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/sleepqueue.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+
static inline void
_kthread_fn(void *arg)
{
Modified: projects/ofed/head/sys/ofed/include/linux/linux_compat.c
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/linux_compat.c Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/linux_compat.c Sat Jul 17 01:40:41 2010 (r210183)
@@ -51,7 +51,8 @@ MALLOC_DEFINE(M_LINUX_DMA, "lnxdma", "Li
#define RB_ROOT(head) (head)->rbh_root
struct class miscclass;
-struct linux_device miscroot;
+struct device miscroot;
+struct list_head pci_drivers;
int
panic_cmp(struct rb_node *one, struct rb_node *two)
@@ -118,6 +119,7 @@ linux_compat_init(void)
miscclass.name = "misc";
class_register(&miscclass);
miscroot.bsddev = root_bus;
+ INIT_LIST_HEAD(&pci_drivers);
}
module_init(linux_compat_init);
Modified: projects/ofed/head/sys/ofed/include/linux/list.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/list.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/list.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -33,8 +33,9 @@
* FreeBSD header which requires it here so it is resolved with the correct
* definition prior to the undef.
*/
+#include <linux/types.h>
+
#include <sys/param.h>
-#include <sys/types.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/lock.h>
@@ -42,12 +43,16 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/conf.h>
-
#include <sys/socket.h>
+
#include <net/if_types.h>
+
#include <netinet/in.h>
#include <netinet/in_pcb.h>
+#include <vm/vm.h>
+#include <vm/vm_object.h>
+
#define prefetch(x)
struct list_head {
Modified: projects/ofed/head/sys/ofed/include/linux/log2.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/log2.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/log2.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -29,7 +29,8 @@
#ifndef _LINUX_LOG2_H_
#define _LINUX_LOG2_H_
-#include <sys/types.h>
+#include <linux/types.h>
+
#include <sys/libkern.h>
static inline unsigned long
@@ -38,6 +39,12 @@ roundup_pow_of_two(unsigned long x)
return (1UL << flsl(x - 1));
}
+static inline int
+is_power_of_2(unsigned long n)
+{
+ return (n == roundup_pow_of_two(n));
+}
+
static inline unsigned long
rounddown_pow_of_two(unsigned long x)
{
Modified: projects/ofed/head/sys/ofed/include/linux/module.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/module.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/module.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -37,10 +37,12 @@
#define MODULE_AUTHOR(name)
#define MODULE_DESCRIPTION(name)
#define MODULE_LICENSE(name)
+#define MODULE_VERSION(name)
#define THIS_MODULE ((struct module *)0)
#define EXPORT_SYMBOL(name)
+#define EXPORT_SYMBOL_GPL(name)
#define module_init(fn) \
SYSINIT(fn, SI_SUB_DRIVERS, SI_ORDER_ANY, (fn), NULL)
Modified: projects/ofed/head/sys/ofed/include/linux/netdevice.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/netdevice.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/netdevice.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -28,8 +28,9 @@
#ifndef _LINUX_NETDEVICE_H_
#define _LINUX_NETDEVICE_H_
+#include <linux/types.h>
+
#include <sys/socket.h>
-#include <sys/types.h>
#include <net/if_types.h>
#include <net/if.h>
@@ -55,4 +56,7 @@ extern struct net init_net;
#define dev_get_by_index(n, idx) ifnet_byindex_ref((idx))
#define dev_put(d) if_rele((d))
+#define netif_running(dev) !!(dev->if_drv_flags & IFF_DRV_RUNNING)
+#define netif_oper_up(dev) !!(dev->if_flags & IFF_UP)
+
#endif /* _LINUX_NETDEVICE_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/pci.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/pci.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/pci.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -31,12 +31,12 @@
#include <linux/types.h>
-#include <sys/pciio.h>
-#include <sys/kobj.h>
+#include <sys/param.h>
#include <sys/bus.h>
+#include <sys/pciio.h>
#include <sys/rman.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
#include <dev/pci/pci_private.h>
#include <machine/resource.h>
@@ -84,12 +84,12 @@ struct pci_driver {
devclass_t bsdclass;
};
-struct list_head pci_drivers;
+extern struct list_head pci_drivers;
#define __devexit_p(x) x
struct pci_dev {
- struct linux_device dev;
+ struct device dev;
struct pci_driver *pdrv;
uint64_t dma_mask;
uint16_t device;
@@ -97,16 +97,23 @@ struct pci_dev {
};
static inline struct resource_list_entry *
-_pci_get_rle(struct pci_dev *pdev, int bar)
+_pci_get_rle(struct pci_dev *pdev, int type, int rid)
{
struct pci_devinfo *dinfo;
struct resource_list *rl;
- struct resource_list_entry *rle;
dinfo = device_get_ivars(pdev->dev.bsddev);
rl = &dinfo->resources;
- if ((rle = resource_list_find(rl, SYS_RES_MEMORY, bar)) == NULL)
- rle = resource_list_find(rl, SYS_RES_IOPORT, bar);
+ return resource_list_find(rl, type, rid);
+}
+
+static inline struct resource_list_entry *
+_pci_get_bar(struct pci_dev *pdev, int bar)
+{
+ struct resource_list_entry *rle;
+
+ if ((rle = _pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL)
+ rle = _pci_get_rle(pdev, SYS_RES_IOPORT, bar);
return (rle);
}
@@ -115,7 +122,7 @@ pci_resource_start(struct pci_dev *pdev,
{
struct resource_list_entry *rle;
- if ((rle = _pci_get_rle(pdev, bar)) == NULL)
+ if ((rle = _pci_get_bar(pdev, bar)) == NULL)
return (0);
return rle->start;
}
@@ -125,7 +132,7 @@ pci_resource_len(struct pci_dev *pdev, i
{
struct resource_list_entry *rle;
- if ((rle = _pci_get_rle(pdev, bar)) == NULL)
+ if ((rle = _pci_get_bar(pdev, bar)) == NULL)
return (0);
return rle->count;
}
@@ -138,7 +145,7 @@ pci_resource_flags(struct pci_dev *pdev,
{
struct resource_list_entry *rle;
- if ((rle = _pci_get_rle(pdev, bar)) == NULL)
+ if ((rle = _pci_get_bar(pdev, bar)) == NULL)
return (0);
return rle->type;
}
@@ -193,7 +200,6 @@ pci_request_region(struct pci_dev *pdev,
int type;
type = pci_resource_flags(pdev, bar);
-
rid = PCIR_BAR(bar);
if (bus_alloc_resource_any(pdev->dev.bsddev, type, &rid,
RF_ACTIVE) == NULL)
@@ -206,7 +212,7 @@ pci_release_region(struct pci_dev *pdev,
{
struct resource_list_entry *rle;
- if ((rle = _pci_get_rle(pdev, bar)) == NULL)
+ if ((rle = _pci_get_bar(pdev, bar)) == NULL)
return;
bus_release_resource(pdev->dev.bsddev, rle->type, rle->rid, rle->res);
}
@@ -255,6 +261,7 @@ linux_pci_probe(device_t dev)
static inline int
linux_pci_attach(device_t dev)
{
+ struct resource_list_entry *rle;
struct pci_dev *pdev;
struct pci_driver *pdrv;
struct pci_device_id *id;
@@ -268,6 +275,9 @@ linux_pci_attach(device_t dev)
pdev->pdrv = pdrv;
kobject_init(&pdev->dev.kobj, NULL);
kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev));
+ rle = _pci_get_rle(pdev, SYS_RES_IRQ, 0);
+ if (rle)
+ pdev->irq = rle->start;
error = pdrv->probe(pdev, id);
if (error)
return (-error);
@@ -297,8 +307,6 @@ pci_register_driver(struct pci_driver *p
devclass_t bus;
int error;
- if (pci_drivers.prev == NULL && pci_drivers.next == NULL)
- INIT_LIST_HEAD(&pci_drivers);
list_add(&pdrv->links, &pci_drivers);
bus = devclass_find("pci");
pdrv->driver.name = pdrv->name;
Added: projects/ofed/head/sys/ofed/include/linux/rtnetlink.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/rtnetlink.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -0,0 +1,27 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
Modified: projects/ofed/head/sys/ofed/include/linux/sched.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/sched.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/sched.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -100,4 +100,6 @@ do { \
kick_proc0(); \
} while (0)
+#define cond_resched() sched_relinquish(curthread)
+
#endif /* _LINUX_SCHED_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/string.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/string.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/string.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -29,12 +29,12 @@
#ifndef _LINUX_STRING_H_
#define _LINUX_STRING_H_
-#include <sys/types.h>
-#include <sys/libkern.h>
#include <linux/types.h>
#include <linux/gfp.h>
#include <linux/slab.h>
+#include <sys/libkern.h>
+
static inline void *
kmemdup(const void *src, size_t len, gfp_t gfp)
{
Modified: projects/ofed/head/sys/ofed/include/linux/sysfs.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/sysfs.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/sysfs.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -41,4 +41,11 @@ struct sysfs_ops {
size_t);
};
+struct attribute_group {
+ const char *name;
+ mode_t (*is_visible)(struct kobject *,
+ struct attribute *, int);
+ struct attribute **attrs;
+};
+
#endif /* _LINUX_SYSFS_H_ */
Modified: projects/ofed/head/sys/ofed/include/linux/types.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/types.h Sat Jul 17 01:39:44 2010 (r210182)
+++ projects/ofed/head/sys/ofed/include/linux/types.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -28,6 +28,7 @@
#ifndef _LINUX_TYPES_H_
#define _LINUX_TYPES_H_
+#include <sys/cdefs.h>
#include <sys/types.h>
#include <linux/compiler.h>
#include <asm/types.h>
Added: projects/ofed/head/sys/ofed/include/linux/vmalloc.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/vmalloc.h Sat Jul 17 01:40:41 2010 (r210183)
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINUX_VMALLOC_H_
+#define _LINUX_VMALLOC_H_
+
+#endif /* _LINUX_VMALLOC_H_ */
More information about the svn-src-projects
mailing list