VirtualBox

Changeset 17064 in vbox for trunk


Ignore:
Timestamp:
Feb 24, 2009 1:00:29 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43287
Message:

Linux hostdrivers: removed Linux 2.4.x compatibility

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r16029 r17064  
    185185
    186186/* check kernel version */
    187 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
     187#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    188188# error Unsupported kernel version!
    189189#endif
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r15999 r17064  
    6464#ifdef CONFIG_X86_LOCAL_APIC
    6565# include <asm/apic.h>
    66 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    67 #  include <asm/nmi.h>
    68 # endif
     66# include <asm/nmi.h>
    6967#endif
    7068#ifdef VBOX_WITH_SUSPEND_NOTIFICATION
    7169# include <linux/platform_device.h>
    72 #endif
    73 
    74 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    75 # include <asm/pgtable.h>
    76 # define global_flush_tlb __flush_tlb_global
    7770#endif
    7871
     
    8780#  define VBOX_DEV_FMASK     (S_IRUGO | S_IWUGO)
    8881# endif
    89 
    90 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    91 
    92 #  define VBOX_REGISTER_DEVFS()                         \
    93 ({                                                      \
    94     void *rc = NULL;                                    \
    95     if (devfs_mk_cdev(MKDEV(DEVICE_MAJOR, 0),           \
    96                   S_IFCHR | VBOX_DEV_FMASK,             \
    97                   DEVICE_NAME) == 0)                    \
    98         rc = (void *)' '; /* return not NULL */         \
    99     rc;                                                 \
    100  })
    101 
    102 #  define VBOX_UNREGISTER_DEVFS(handle)                 \
    103     devfs_remove(DEVICE_NAME);
    104 
    105 # else /* < 2.6.0 */
    106 
    107 #  define VBOX_REGISTER_DEVFS()                         \
    108     devfs_register(NULL, DEVICE_NAME, DEVFS_FL_DEFAULT, \
    109                    DEVICE_MAJOR, 0,                     \
    110                    S_IFCHR | VBOX_DEV_FMASK,            \
    111                    &gFileOpsVBoxDrv, NULL)
    112 
    113 #  define VBOX_UNREGISTER_DEVFS(handle)                 \
    114     if (handle != NULL)                                 \
    115         devfs_unregister(handle)
    116 
    117 # endif /* < 2.6.0 */
    11882#endif /* CONFIG_DEV_FS && !CONFIG_VBOXDEV_AS_MISC */
    119 
    120 #ifndef CONFIG_VBOXDRV_AS_MISC
    121 # if defined(CONFIG_DEVFS_FS) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 0)
    122 #  define VBOX_REGISTER_DEVICE(a,b,c)     devfs_register_chrdev(a,b,c)
    123 #  define VBOX_UNREGISTER_DEVICE(a,b)     devfs_unregister_chrdev(a,b)
    124 # else
    125 #  define VBOX_REGISTER_DEVICE(a,b,c)     register_chrdev(a,b,c)
    126 #  define VBOX_UNREGISTER_DEVICE(a,b)     unregister_chrdev(a,b)
    127 # endif
    128 #endif /* !CONFIG_VBOXDRV_AS_MISC */
    129 
    13083
    13184#ifdef CONFIG_X86_HIGH_ENTRY
     
    184137 */
    185138static SUPDRVDEVEXT         g_DevExt;
    186 
    187 /** Registered devfs device handle. */
    188 #if defined(CONFIG_DEVFS_FS) && !defined(CONFIG_VBOXDRV_AS_MISC)
    189 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    190 static void                *g_hDevFsVBoxDrv = NULL;
    191 # else
    192 static devfs_handle_t       g_hDevFsVBoxDrv = NULL;
    193 # endif
    194 #endif
    195139
    196140#ifndef CONFIG_VBOXDRV_AS_MISC
     
    265209    name:       DEVICE_NAME,
    266210    fops:       &gFileOpsVBoxDrv,
    267 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && \
    268      LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)
     211# if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)
    269212    devfs_name: DEVICE_NAME,
    270213# endif
     
    447390     * we don't allow to setup an NMI watchdog.
    448391     */
    449 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && !defined(VBOX_REDHAT_KABI)
     392# if !defined(VBOX_REDHAT_KABI)
    450393    /*
    451394     * First test: NMI actiated? Works only works with Linux 2.6 -- 2.4 does not export
    452395     *             the nmi_watchdog variable.
    453396     */
    454 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || \
    455       (defined CONFIG_X86_64 && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
     397#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined CONFIG_X86_64
    456398#   ifdef DO_DISABLE_NMI
    457399    if (nmi_atomic_read(&nmi_active) > 0)
     
    531473            if ((GET_APIC_DELIVERY_MODE(v) == APIC_MODE_NMI) && !(v & APIC_LVT_MASKED))
    532474            {
    533 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || \
    534      (defined CONFIG_X86_64 && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
     475# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined CONFIG_X86_64
    535476                printk(KERN_ERR DEVICE_NAME
    536477                ": NMI watchdog either active or at least initialized. Please disable the NMI\n"
     
    539480                return -EINVAL;
    540481# else /* < 2.6.19 */
    541 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && !defined(VBOX_REDHAT_KABI)
     482#  if !defined(VBOX_REDHAT_KABI)
    542483nmi_activated:
    543484#  endif
     
    572513     */
    573514    g_iModuleMajor = DEVICE_MAJOR;
    574     rc = VBOX_REGISTER_DEVICE((dev_t)g_iModuleMajor, DEVICE_NAME, &gFileOpsVBoxDrv);
     515    rc = register_chrdev((dev_t)g_iModuleMajor, DEVICE_NAME, &gFileOpsVBoxDrv);
    575516    if (rc < 0)
    576517    {
    577         dprintf(("VBOX_REGISTER_DEVICE failed with rc=%#x!\n", rc));
     518        dprintf(("register_chrdev() failed with rc=%#x!\n", rc));
    578519        return rc;
    579520    }
     
    588529    rc = 0;
    589530
    590 #ifdef CONFIG_DEVFS_FS
     531# ifdef CONFIG_DEVFS_FS
    591532    /*
    592533     * Register a device entry
    593534     */
    594     g_hDevFsVBoxDrv = VBOX_REGISTER_DEVFS();
    595     if (g_hDevFsVBoxDrv == NULL)
     535    if (devfs_mk_cdev(MKDEV(DEVICE_MAJOR, 0), S_IFCHR | VBOX_DEV_FMASK, DEVICE_NAME) != 0)
    596536    {
    597537        dprintf(("devfs_register failed!\n"));
    598538        rc = -EINVAL;
    599539    }
    600 #endif
     540# endif
    601541#endif /* !CONFIG_VBOXDRV_AS_MISC */
    602542    if (!rc)
     
    658598         */
    659599#if defined(CONFIG_DEVFS_FS) && !defined(CONFIG_VBOXDRV_AS_MISC)
    660         VBOX_UNREGISTER_DEVFS(g_hDevFsVBoxDrv);
     600        devfs_remove(DEVICE_NAME);
    661601#endif
    662602    }
     
    665605    dprintf(("VBoxDrv::ModuleInit returning %#x (minor:%d)\n", rc, gMiscDevice.minor));
    666606#else
    667     VBOX_UNREGISTER_DEVICE(g_iModuleMajor, DEVICE_NAME);
     607    unregister_chrdev(g_iModuleMajor, DEVICE_NAME);
    668608    dprintf(("VBoxDrv::ModuleInit returning %#x (major:%d)\n", rc, g_iModuleMajor));
    669609#endif
     
    701641     * Unregister a device entry
    702642     */
    703     VBOX_UNREGISTER_DEVFS(g_hDevFsVBoxDrv);
     643    devfs_remove(DEVICE_NAME);
    704644# endif /* devfs */
    705     VBOX_UNREGISTER_DEVICE(g_iModuleMajor, DEVICE_NAME);
     645    unregister_chrdev(g_iModuleMajor, DEVICE_NAME);
    706646#endif /* !CONFIG_VBOXDRV_AS_MISC */
    707647
     
    10811021#endif
    10821022
    1083 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    10841023module_param(force_async_tsc, int, 0444);
    1085 #else
    1086 MODULE_PARM(force_async_tsc, "i");
    1087 #endif
    10881024MODULE_PARM_DESC(force_async_tsc, "force the asynchronous TSC mode");
    10891025
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette