Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 3 Sep 2009 15:25:26 +0000 (08:25 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 3 Sep 2009 15:25:26 +0000 (08:25 -0700)
sys/dev/netif/mxge/if_mxge_var.h
sys/emulation/linux/linux_file.c
sys/kern/subr_disk.c
sys/platform/pc32/acpica5/acpi_wakeup.c
sys/platform/pc64/acpica5/acpi_wakeup.c

index 93a98bd..05bc9cc 100644 (file)
@@ -301,11 +301,11 @@ struct mxge_media_type
 #if __FreeBSD_version < 800053
 
 #if defined (__GNUC__)
-  #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__
+  #if defined __i386 || defined i386 || defined __i386__ || defined __x86_64__
     #define wmb()  __asm__ __volatile__ ("sfence;": : :"memory")
-  #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9 
+  #elif defined sparc64 || defined __sparcv9
     #define wmb()  __asm__ __volatile__ ("membar #MemIssue": : :"memory")
-  #elif #cpu(sparc) || defined sparc || defined __sparc__
+  #elif defined sparc || defined __sparc__
     #define wmb()  __asm__ __volatile__ ("stbar;": : :"memory")
   #else
     #define wmb()      /* XXX just to make this compile */
index c665e0b..b4402f7 100644 (file)
@@ -327,7 +327,7 @@ again:
        inp = buf;
        outp = (caddr_t)args->dirent;
        resid = nbytes;
-       if (auio.uio_resid >= buflen);
+       if (auio.uio_resid >= buflen)
                goto eof;
        len = buflen - auio.uio_resid;
        cookiep = cookies;
index fa039ac..66c9502 100644 (file)
 #include <sys/lock.h>
 
 static MALLOC_DEFINE(M_DISK, "disk", "disk data");
+static int disk_debug_enable = 0;
 
 static void disk_msg_autofree_reply(lwkt_port_t, lwkt_msg_t);
 static void disk_msg_core(void *);
@@ -150,6 +151,18 @@ struct objcache_malloc_args disk_msg_malloc_args = {
 static struct lwkt_port disk_dispose_port;
 static struct lwkt_port disk_msg_port;
 
+static int
+disk_debug(int level, char *fmt, ...)
+{
+       __va_list ap;
+
+       __va_start(ap, fmt);
+       if (level <= disk_debug_enable)
+               kvprintf(fmt, ap);
+       __va_end(ap);
+
+       return 0;
+}
 
 static int
 disk_probe_slice(struct disk *dp, cdev_t dev, int slice, int reprobe)
@@ -163,6 +176,10 @@ disk_probe_slice(struct disk *dp, cdev_t dev, int slice, int reprobe)
        int sno;
        u_int i;
 
+       disk_debug(2,
+                   "disk_probe_slice (begin): %s (%s)\n",
+                       dev->si_name, dp->d_cdev->si_name);
+
        sno = slice ? slice - 1 : 0;
 
        ops = &disklabel32_ops;
@@ -241,6 +258,9 @@ disk_probe(struct disk *dp, int reprobe)
        KKASSERT (info->d_media_blksize != 0);
 
        dp->d_slice = dsmakeslicestruct(BASE_SLICE, info);
+       disk_debug(1,
+                   "disk_probe (begin): %s\n",
+                       dp->d_cdev->si_name);
 
        error = mbrinit(dev, info, &(dp->d_slice));
        if (error)
@@ -314,6 +334,9 @@ disk_probe(struct disk *dp, int reprobe)
                        disk_probe_slice(dp, ndev, i, reprobe);
                }
        }
+       disk_debug(1,
+                   "disk_probe (end): %s\n",
+                       dp->d_cdev->si_name);
 }
 
 
@@ -336,10 +359,16 @@ disk_msg_core(void *arg)
                switch (msg->hdr.u.ms_result) {
                case DISK_DISK_PROBE:
                        dp = (struct disk *)msg->load;
+                       disk_debug(1,
+                                   "DISK_DISK_PROBE: %s\n",
+                                       dp->d_cdev->si_name);
                        disk_probe(dp, 0);
                        break;
                case DISK_DISK_DESTROY:
                        dp = (struct disk *)msg->load;
+                       disk_debug(1,
+                                   "DISK_DISK_DESTROY: %s\n",
+                                       dp->d_cdev->si_name);
                        devfs_destroy_subnames(dp->d_cdev->si_name);
                        devfs_destroy_dev(dp->d_cdev);
                        lwkt_gettoken(&ilock, &disklist_token);
@@ -352,6 +381,9 @@ disk_msg_core(void *arg)
                        break;
                case DISK_UNPROBE:
                        dp = (struct disk *)msg->load;
+                       disk_debug(1,
+                                   "DISK_DISK_UNPROBE: %s\n",
+                                       dp->d_cdev->si_name);
                        devfs_destroy_subnames(dp->d_cdev->si_name);
                        break;
                case DISK_SLICE_REPROBE:
@@ -359,7 +391,7 @@ disk_msg_core(void *arg)
                        sp = (struct diskslice *)msg->load2;
                        devfs_clr_subnames_flag(sp->ds_dev->si_name,
                                                SI_REPROBE_TEST);
-                       devfs_debug(DEVFS_DEBUG_DEBUG,
+                       disk_debug(1,
                                    "DISK_SLICE_REPROBE: %s\n",
                                    sp->ds_dev->si_name);
                        disk_probe_slice(dp, sp->ds_dev,
@@ -370,7 +402,7 @@ disk_msg_core(void *arg)
                case DISK_DISK_REPROBE:
                        dp = (struct disk *)msg->load;
                        devfs_clr_subnames_flag(dp->d_cdev->si_name, SI_REPROBE_TEST);
-                       devfs_debug(DEVFS_DEBUG_DEBUG,
+                       disk_debug(1,
                                    "DISK_DISK_REPROBE: %s\n",
                                    dp->d_cdev->si_name);
                        disk_probe(dp, 1);
@@ -378,6 +410,7 @@ disk_msg_core(void *arg)
                                        dp->d_cdev->si_name, SI_REPROBE_TEST);
                        break;
                case DISK_SYNC:
+                       disk_debug(1, "DISK_SYNC\n");
                        break;
                default:
                        devfs_debug(DEVFS_DEBUG_WARNING,
@@ -455,6 +488,10 @@ disk_create(int unit, struct disk *dp, struct dev_ops *raw_ops)
        lwkt_tokref ilock;
        cdev_t rawdev;
 
+       disk_debug(1,
+                   "disk_create (begin): %s%d\n",
+                       raw_ops->head.name, unit);
+
        rawdev = make_only_dev(raw_ops, dkmakewholedisk(unit),
                            UID_ROOT, GID_OPERATOR, 0640,
                            "%s%d", raw_ops->head.name, unit);
@@ -474,6 +511,11 @@ disk_create(int unit, struct disk *dp, struct dev_ops *raw_ops)
        lwkt_gettoken(&ilock, &disklist_token);
        LIST_INSERT_HEAD(&disklist, dp, d_list);
        lwkt_reltoken(&ilock);
+
+       disk_debug(1,
+                   "disk_create (end): %s%d\n",
+                       raw_ops->head.name, unit);
+
        return (dp->d_rawdev);
 }
 
@@ -487,6 +529,10 @@ _setdiskinfo(struct disk *disk, struct disk_info *info)
        bcopy(info, &disk->d_info, sizeof(disk->d_info));
        info = &disk->d_info;
 
+       disk_debug(1,
+                   "_setdiskinfo: %s\n",
+                       disk->d_cdev->si_name);
+
        /*
         * The serial number is duplicated so the caller can throw
         * their copy away.
@@ -540,6 +586,9 @@ disk_setdiskinfo(struct disk *disk, struct disk_info *info)
 {
        _setdiskinfo(disk, info);
        disk_msg_send(DISK_DISK_PROBE, disk, NULL);
+       disk_debug(1,
+                   "disk_setdiskinfo: sent probe for %s\n",
+                       disk->d_cdev->si_name);
 }
 
 void
@@ -547,6 +596,9 @@ disk_setdiskinfo_sync(struct disk *disk, struct disk_info *info)
 {
        _setdiskinfo(disk, info);
        disk_msg_send_sync(DISK_DISK_PROBE, disk, NULL);
+       disk_debug(1,
+                   "disk_setdiskinfo_sync: sent probe for %s\n",
+                       disk->d_cdev->si_name);
 }
 
 /*
@@ -1095,5 +1147,9 @@ disk_uninit(void)
        objcache_destroy(disk_msg_cache);
 }
 
+TUNABLE_INT("kern.disk_debug", &disk_debug_enable);
+SYSCTL_INT(_kern, OID_AUTO, disk_debug, CTLFLAG_RW, &disk_debug_enable,
+               0, "Enable subr_disk debugging");
+
 SYSINIT(disk_register, SI_SUB_PRE_DRIVERS, SI_ORDER_FIRST, disk_init, NULL);
 SYSUNINIT(disk_register, SI_SUB_PRE_DRIVERS, SI_ORDER_ANY, disk_uninit, NULL);
index f83138e..c6a39ac 100644 (file)
 extern uint32_t        acpi_reset_video;
 extern void    initializecpu(void);
 
-static struct region_descriptor        r_idt, r_gdt, *p_gdt;
-static uint16_t                r_ldt;
+static __attribute__((used)) struct region_descriptor  r_idt, r_gdt, *p_gdt;
+static __attribute__((used)) uint16_t  r_ldt;
 
-static uint32_t                r_eax, r_ebx, r_ecx, r_edx, r_ebp, r_esi, r_edi,
-                       r_efl, r_cr0, r_cr2, r_cr3, r_cr4, ret_addr;
+static __attribute__((used)) uint32_t  r_eax, r_ebx, r_ecx, r_edx, r_ebp,
+                                       r_esi, r_edi, r_efl, r_cr0, r_cr2,
+                                       r_cr3, r_cr4, ret_addr;
 
-static uint16_t                r_cs, r_ds, r_es, r_fs, r_gs, r_ss, r_tr;
-static uint32_t                r_esp;
+static __attribute__((used)) uint16_t  r_cs, r_ds, r_es, r_fs, r_gs, r_ss,
+                                       r_tr;
+static __attribute__((used)) uint32_t  r_esp;
 
 static void            acpi_printcpu(void);
 static void            acpi_realmodeinst(void *arg, bus_dma_segment_t *segs,
index 3e75242..67254ee 100644 (file)
 
 extern uint32_t        acpi_reset_video;
 
-static struct region_descriptor        r_idt, r_gdt, *p_gdt;
-static uint16_t                r_ldt;
+static __attribute__((used)) struct region_descriptor  r_idt, r_gdt, *p_gdt;
+static __attribute__((used)) uint16_t  r_ldt;
 
-static uint32_t                r_eax, r_ebx, r_ecx, r_edx, r_ebp, r_esi, r_edi,
-                       r_efl, r_cr0, r_cr2, r_cr3, r_cr4, ret_addr;
+static __attribute__((used)) uint32_t  r_eax, r_ebx, r_ecx, r_edx, r_ebp,
+                                       r_esi, r_edi, r_efl, r_cr0, r_cr2,
+                                       r_cr3, r_cr4, ret_addr;
 
-static uint16_t                r_cs, r_ds, r_es, r_fs, r_gs, r_ss, r_tr;
-static uint32_t                r_esp;
+static __attribute__((used)) uint16_t  r_cs, r_ds, r_es, r_fs, r_gs,
+                                       r_ss, r_tr;
+static __attribute__((used)) uint32_t  r_esp;
 
 static void            acpi_printcpu(void);
 static void            acpi_realmodeinst(void *arg, bus_dma_segment_t *segs,