summaryrefslogtreecommitdiff
path: root/linux
AgeCommit message (Collapse)Author
2014-01-05linux: fix bit testsJustus Winter
The pattern is !x&y. An expression of this form is almost always meaningless, because it combines a boolean operator with a bit operator. In particular, if the rightmost bit of y is 0, the result will always be 0. Fixed using coccinelle. // !x&y combines boolean negation with bitwise and // // Confidence: High // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2. // URL: http://www.emn.fr/x-info/coccinelle/rules/notand.html // Options: @@ expression E1,E2; @@ ( !E1 & !E2 | - !E1 & E2 + !(E1 & E2) ) * linux/src/drivers/scsi/FlashPoint.c: Fix bit tests.
2014-01-05linux: fix bit testsJustus Winter
The pattern is !x&y. An expression of this form is almost always meaningless, because it combines a boolean operator with a bit operator. In particular, if the rightmost bit of y is 0, the result will always be 0. Fixed using coccinelle. // !x&y combines boolean negation with bitwise and // // Confidence: High // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2. // URL: http://www.emn.fr/x-info/coccinelle/rules/notand.html // Options: @@ expression E; constant C; @@ ( !E & !C | - !E & C + !(E & C) ) * linux/src/drivers/net/tlan.c: Fix bit tests. * linux/src/drivers/scsi/AM53C974.c: Likewise. * linux/src/drivers/scsi/FlashPoint.c: Likewise. * linux/src/drivers/scsi/NCR5380.c: Likewise. * linux/src/drivers/scsi/t128.c: Likewise.
2013-09-28Add files missing in distrib tarballSamuel Thibault
* Makefrag.am (libkernel_a_SOURCES): Add ddb/db_write_cmd.h, ipc/ipc_print.h, vm/vm_print.h * linux/Makefrag.am (EXTRA_DIST): Add linux/src/drivers/scsi/FlashPoint.c, linux/src/drivers/scsi/eata_pio_proc.c, linux/src/drivers/scsi/scsiiom.c.
2013-06-24Add partitioning reload support to ahciSamuel Thibault
* linux/dev/drivers/block/ahci.c (port): Add `gd' field. (ahci_ioctl): New function. (ahci_fops): Fill `ioctl' field with `ahci_ioctl'. (ahci_probe_pci): Fill `gd' field with `gd'.
2013-06-24Fix printing ahci PCI dev and funSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_probe_dev): Compute `dev' and `fun' earlier so they can be printed.
2013-06-09Do not skip AHCI controller without HOST_CAP_ONLYSamuel Thibault
We rather rely on the announced PCI type to determine whether to use IDE or AHCI. * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Do not skip AHCI controller without HOST_CAP_ONLY.
2013-06-09Add timeout to ahci IDENTIFYSamuel Thibault
* linux/dev/drivers/block/ahci.c (identify_timeout): New function. (identify_timer): New variable. (ahci_probe_port): Add timer to abandon identify command.
2013-06-09Fix printf formatSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_do_request): Cast capacity into unsigned long and use %lu format. (ahci_probe_port): Cast size into unsigned and use %u format.
2013-06-09Fix formatSamuel Thibault
2013-05-30Add LBA48 support to AHCI driverSamuel Thibault
* linux/dev/drivers/block/ahci.c (port): Extend `capacity' field type to unsigned long long. Add `lba48' field. Make `identify' field unsigned. (ahci_do_port_request): When `lba48' is true, use WIN_READDMA_EXT and WIN_WRITEDMA_EXT commands. (ahci_probe_port): Test lba48 flag, read capacity and set `lba48' accordingly. Display size in GiB above 10GiB. * linux/src/include/linux/hdreg.h (WIN_READDMA_EXT, WIN_WRITEDMA_EXT): New macros (hd_driveid): Add `command_set_2' and lba_capacity_2' fields.
2013-05-11Add missing parameters to printfSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_probe_dev): Add missing parameters to printf.
2013-05-10Fix ahci.h pathSamuel Thibault
* linux/Makefrag.am (liblinux_a_SOURCES): Fix path to ahci.h
2013-05-10Add AHCI driverSamuel Thibault
* linux/dev/glue/kmem.c (vmtophys): New function. * linux/dev/include/linux/mm.h (vmtophys): New prototype. * linux/src/include/linux/pci.h (PCI_CLASS_STORAGE_SATA, PCI_CLASS_STORAGE_SATA_AHCI): New macros. * linux/dev/drivers/block/ahci.c: New file. * linux/dev/include/ahci.h: New file. * linux/Makefrag.am (liblinux_a_SOURCES): Add linux/dev/drivers/block/ahci.c and linux/dev/drivers/block/ahci.h. * linux/src/drivers/block/ide.c: Include <ahci.h>. (probe_for_hwifs): Call ahci_probe_pci.
2013-05-02Fix non-block-aligned-offset readsSamuel Thibault
This fixes grave issues when device_read is called with non-block-aligned offset, e.g. when using grub-probe with a non-block-aligned partition table. * linux/dev/glue/block.c (rdwr_full): Use current position instead of base buffer position to check for alignment.
2013-05-01Fix macro nameSamuel Thibault
* linux/dev/glue/block.c (device_get_status): Use DEV_GET_RECORDS_RECORD_SIZE for DEV_GET_RECORDS instead of DEV_GET_SIZE_RECORD_SIZE.
2012-12-27Fix slow boot in virtualboxSamuel Thibault
By disabling some of the most slow drivers by default, and giving progress feedback to the user. * linux/configfrag.ac (CONFIG_SCSI_NCR53C7xx, CONFIG_SCSI_AIC7XXX, CONFIG_SCSI_GDTH): Disable by default * linux/src/drivers/scsi/eata.c (__initfunc): Don't feed line in probe message. * linux/src/drivers/scsi/hosts.c (scsi_init): Print SCSI probe progress.
2012-12-27Fix spurious error on accessing fd1Samuel Thibault
Cherry picked from Linux kernel commit 76c25284e0d845bff4ee1031721556148af4db1c * linux/dev/drivers/block/floppy.c (config_types): Clear from `allowed_drive_mask' floppy drives whose cmos type is 0.
2012-12-21ide: Increase WAIT_DRQ to accomodate some CF cards and SSD drives.David S. Miller
Based upon a patch by Philippe De Muyter, and feedback from Mark Lord and Robert Hancock. As noted by Mark Lord, the outdated ATA1 spec specifies a 20msec timeout for setting DRQ but lots of common devices overshoot this. Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from Linux kernel commit 602da297e293eb2cbd28dcdbbe247593a46a853a) * linux/src/drivers/block/ide.h (WAIT_DRQ): Increase to 1 s.
2012-12-21IDE disk drives with unusual C/H/S.Thomas Schwinge
* linux/src/drivers/block/ide.c: Partially update to Linux 2.0.40 code.
2012-11-19Fix compilation error with older versions of GCCMatthew Leach
Some versions of GCC will error if you define a type twice (even if the definition is the same). The NCR53C8XX SCSI driver defines 'vm_offset_t', this is also defined in vm_types.h and will therefore cause a compilation error depending on the GCC version. * linux/src/drivers/scsi/ncr53c8xx.c [!MACH] (vm_offset_t, vm_size_t): Don't define types.
2012-09-23Fix panic on irq >= 16Gianluca Guida
* linux/src/drivers/net/pci-scan.c (pci_drv_register): Skip device if we are getting an invalid IRQ >= 16 and different from 255 (it happens in some motherboard).
2012-09-23Update DMA auto-enabling, make forcing DMA an optionSergio Lopez
* linux/configfrag.ac (--enable-ide-forcedma): Add option. * linux/src/drivers/block/ide.c (ide_probe_promise_20246): Do not call ide_init_promise. (probe_for_hwifs): Add SI, VIA, AL PCI probing. * linux/src/drivers/block/ide.h (hwif_chipset_t): Add hpt343, udma and ultra66 chipsets. * linux/src/drivers/block/triton.c: Update to upstream 1.14 version. * linux/src/include/linux/hdreg.h (HDIO_GET_IDENTITY): Rename to ... (HDIO_OBSOLETE_IDENTITY): ... new macro. (HDIO_GET_IDENTITY): New macro. (hd_driveid): Add fields for extended identification.
2012-09-23Fix CDROM door unlock on closure without device_closeAlexey Dejneka
* linux/dev/glue/block.c (device_open): Properly return devp on multiple opens. (device_close_forced): Renamed from device_close, when force parameter is 1, do not wait for open_count to become 0 before closing. (device_close): New function. (device_no_senders): New function. linux_block_emulation_ops: Use (device_no_senders).
2012-06-10Permit to select/deselect whole driver groupsSamuel Thibault
* linux/configfrag.ac (AC_OPTION_Linux_group): New function (AC_OPTION_Linux_ix86_at): Do not enable driver by default if the group was explicitly disabled. (scsi, net, pcmcia, wireless): Define groups.
2012-05-17Offset bios32 entrySamuel Thibault
* linux/src/arch/i386/kernel/bios32.c (check_pcibios, pcibios_init): Convert physical bios32 entry address to kernel virtual address.
2012-05-17Clear direction flag after bios32 callSamuel Thibault
Linux does this, there are probably wild BIOSes out there. * linux/src/arch/i386/kernel/bios32.c (bios32_service, check_pcibios, pci_bios_find_class, pci_bios_find_device, pci_bios_read_config_byte, pci_bios_read_config_word, pci_bios_read_config_dword, pci_bios_write_config_byte, pci_bios_write_config_word, pci_bios_write_config_dword): Clear direction flag after lcall to bios32.
2012-03-24Add missing phystokv/kvtophys callsSamuel Thibault
* i386/i386/vm_param.h [!MACH_XEN]: Do not include <xen/public/xen.h>. * i386/i386at/model_dep.c (init_alloc_aligned): Use phystokv to compare physical memory addresses with kernel start, end, and symbol table. * i386/intel/pmap.c (pmap_enter): Use kvtophys to convert ptp pointer to pte entry. * linux/dev/init/main.c (alloc_contig_mem, linux_init): Use phystokv to convert allocated pages to virtual pointer. * linux/src/include/asm-i386/io.h: Include <machine/vm_param.h>. (virt_to_phys): Call _kvtophys. (phys_to_virt): Call phystokv. * linux/src/include/linux/compatmac.h: Include <asm/io.h>. (ioremap): Use phys_to_virt to convert physical address to virtual pointer. (my_iounmap): Likewise. * linux/dev/include/asm-i386/page.h: Include <mach/vm_param.h>. (PAGE_SHIFT, PAGE_SIZE, PAGE_MASK): Remove macros. * linux/src/drivers/scsi/ncr53c8xx.c (vm_size_t): Remove type. * linux/dev/glue/net.c: Include <machine/vm_param.h> (device_write): Call phystokv to convert from physical page address to virtual pointer. * linux/dev/glue/block.c (alloc_buffer, free_buffer, rdwr_full): Likewise.
2012-03-24Fix issig crash at bootSamuel Thibault
* linux/dev/glue/misc.c (issig): Return 0 if current_thread() is NULL.
2012-03-20Use long typesSamuel Thibault
* ddb/db_examine.c (db_xcdump): Do not cast addr before passing to db_read_bytes. * ddb/db_macro.c (db_arg_variable): Return long. * ddb/db_macro.h (db_arg_variable): Likewise. * ddb/db_sym.c (db_maxoff): Set type to unsigned long. * ddb/db_task_thread.c (db_set_default_thread, db_get_task_thread): Return long. * ddb/db_variables.h (db_variable): Make fcn function field to return long. (FCN_NULL): Make function type return long. * i386/i386/db_interface.c (int_regs): Set field sizes to long. * i386/i386/db_machdep.h (db_expr_t): Set type to long. * i386/i386/db_trace.c (db_i386_reg_value): Return long. Use long types. (i386_frame, i386_kregs, interrupt_frame, db_nextframe): Set field sizes to long. (db_regs, i386_kregs): Use long * pointers. (db_lookup_i386_kreg): Return long *. (db_numargs, db_nextframe, db_stack_trace_cmd, db_i386_stack_trace): Use long types. * i386/i386/debug_i386.c (dump_ss): Fix format. * i386/i386/ktss.c (ktss_init): Use long type. * i386/i386/pcb.c (set_user_regs): Likewise. * i386/i386/thread.h (i386_saved_state, v86_segs, i386_kernel_state, i386_interrupt_state): Set field sizes to long. * i386/i386/trap.c (kernel_trap, user_trap): Fix formats. * kern/ast.h (ast_t): Set type to long. * kern/boot_script.c (create_task, resume_task, prompt_resume_task, boot_script_set_variable): Use long types. * kern/boot_script.h (boot_script_set_variable): Use long type. * kern/bootstrap.c (bootstrap_create): Pass long type. * kern/lock.c (simple_lock, simple_lock_try): Use long type. * linux/dev/kernel/softirq.c (linux_soft_intr): Fix format.
2012-03-20Change types holding cpu flags from int to longGuillem Jover
On amd64 the cpu flags is a 64-bit word, and long on 32-bit systems is 32-bit wide anyway. * linux/dev/glue/kmem.c (linux_kmalloc, linux_kfree, __get_free_pages, free_pages): Use unsigned long instead of unsigned. * linux/dev/include/asm-i386/system.h (__save_flags, __restore_flags): Likewise. * linux/dev/kernel/printk.c (printk): Likewise. * linux/src/drivers/scsi/advansys.c (DvcEnterCritical, DvcLeaveCritical, advansys_queuecommand, advansys_abort, advansys_reset, advansys_interrupt, interrupts_enabled, AdvISR): Likewise. * linux/src/drivers/scsi/aha152x.c (aha152x_intr): Likewise. * linux/src/drivers/scsi/aha1542.c (aha1542_intr_handle): Likewise. * linux/src/drivers/scsi/aic7xxx.c (aic7xxx_done_cmds_complete): Likewise. * linux/src/drivers/scsi/ultrastor.c (log_ultrastor_abort, ultrastor_queuecommand, ultrastor_abort): Likewise.
2012-03-15Fix build error introduced in 5f701793f63f16d111db3e3d2e91134fcc179c5b.Thomas Schwinge
* linux/src/include/linux/interrupt.h (intr_count): Declare as unsigned int.
2012-03-14Fix variable types according to assembly useSamuel Thibault
* linux/dev/arch/i386/kernel/irq.c (intr_count): Set to int type. * linux/dev/kernel/softirq.c (bh_active, bh_mask): Likewise. (linux_soft_intr: active, mask, left): Likewise * linux/src/include/linux/interrupt.h (bh_active, bh_mask): Likewise. * linux/src/kernel/softirq.c (intr_count, bh_active, bh_mask): Likewise. (do_bottom_half: active, mask, left): Likewise
2012-03-09Use unsigned long for addresses and sizesSamuel Thibault
TODO: remonter formats * i386/include/mach/i386/vm_types.h (vm_offset_t): Define to unsigned long. (signed32_t): Define to signed int. (unsigned32_t): Define to unsigned int. * i386/include/mach/sa/stdarg.h (__va_size): Use sizeof(unsigned long)-1 instead of 3. * include/mach/port.h (mach_port_t): Define to vm_offset_t instead of natural_t. * include/sys/types.h (size_t): Define to unsigned long instead of natural_t. * linux/src/include/asm-i386/posix_types.h (__kernel_size_t): Define to unsigned long. (__kernel_ssize_t): Define to long. * linux/src/include/linux/stddef.h (size_t): Define to unsigned long. * device/dev_pager.c (dev_pager_hash): Cast port to vm_offset_t insted of natural_t. (device_pager_data_request): Fix format. * device/ds_routines.c (ds_no_senders): Fix format. * i386/i386/io_map.c (io_map): Likewise. * i386/i386at/autoconf.c (take_dev_irq): Likewise. * i386/i386at/com.c (comattach): Likewise. * i386/i386at/lpr.c (lprattach): Likewise. * i386/i386at/model_dep.c (mem_size_init, mem_size_init, c_boot_entry): Likewise. * i386/intel/pmap.c (pmap_enter): Likewise. * ipc/ipc_notify.c (ipc_notify_port_deleted, ipc_notify_msg_accepted, ipc_notify_dead_name): Likewise. * ipc/mach_port.c (mach_port_destroy, mach_port_deallocate): Likewise. * kern/ipc_kobject.c (ipc_kobject_destroy): Likewise. * kern/slab.c (kalloc_init): Likewise. * vm/vm_fault.c (vm_fault_page): Likewise. * vm/vm_map.c (vm_map_pmap_enter): Likewise. * xen/block.c (device_read): Likewise. * device/net_io.c (bpf_match): Take unsigned long * instead of unsigned int *. (bpf_do_filter): Make mem unsigned long instead of long. * i386/i386/ktss.c (ktss_init): Cast pointer to unsigned long instead of unsigned. * i386/i386/pcb.c (stack_attach, switch_ktss): Cast pointers to long instead of int. * i386/i386/trap.c (dump_ss): Likewise. * ipc/ipc_hash.c (IH_LOCAL_HASH): Cast object to vm_offset_t. * ipc/mach_msg.c (mach_msg_receive, mach_msg_receive_continue): Cast kmsg to vm_offset_t instead of natural_t. * kern/pc_sample.c (take_pc_sample): Cast to vm_offset_t instead of natural_t. * kern/boot_script.c (sym, arg): Set type of `val' field to long instead of int. (create_task, builtin_symbols, boot_script_parse_line, boot_script_define_function): Cast to long instead of int. * kern/bootstrap.c (bootstrap_create): Likewise. * kern/sched_prim.c (decl_simple_lock_data): Likewise. * kern/printf.c (vsnprintf): Set size type to size_t. * kern/printf.h (vsnprintf): Likewise. * vm/vm_map.h (kentry_data_size): Fix type to vm_size_t. * vm/vm_object.c (vm_object_pmap_protect_by_page): Fix size parameter type to vm_size_t.
2012-02-19Fix format for string printSamuel Thibault
* linux/src/drivers/net/3c505.c (elp_sense): Use %s format for printing a mere string, not the string.
2012-02-19Fix format for string printSamuel Thibault
* linux/src/drivers/net/8390.c: Use %s format for printing a mere string, not the string.
2012-02-19Fix format for string printSamuel Thibault
* linux/src/drivers/net/3c503.c (el2_probe1): Use %s format for printing a mere string, not the string.
2012-02-19Fix format for string printSamuel Thibault
* linux/src/drivers/scsi/aha1542.c (aha1542_setup): Use %s format for printing a mere string, not the string.
2012-02-19Fix format for string printSamuel Thibault
* linux/src/drivers/scsi/advansys.c (asc_prt_line): Use %s format for printing a mere string, not the string.
2011-12-17Fix kern/kalloc.h includesRichard Braun
* device/dev_pager.c: Remove #include <kern/kalloc.h>. * i386/i386/io_perm.c: Add #include <kern/kalloc.h>. * kern/bootstrap.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/pc_sample.c: Likewise. * kern/processor.c: Likewise. * kern/server_loop.ch: Likewise. * kern/thread.c: Likewise. * linux/dev/glue/block.c: Likewise. * linux/dev/glue/net.c: Likewise. * vm/vm_map.c: Likewise. * xen/block.c: Likewise. * xen/net.c: Likewise. * xen/store.c: Likewise.
2011-10-10Raise block device interrupt level to SPL6Samuel Thibault
* linux/dev/drivers/block/genhd.c (device_setup): Set linux_intr_pri to SPL6. * linux/dev/glue/block.c (init_partition, device_open): Likewise.
2011-10-10Raise Linux kmem memory sizeSamuel Thibault
* linux/dev/glue/kmem.c (MEM_CHUNKS): Increase to 32.
2011-10-10Leave interrupts enabled in sym53c8xx driverSamuel Thibault
The driver can work with them, and request_irq works fine with them. * linux/src/drivers/scsi/sym53c8xx.c (ncr_attach): Do not pass SA_INTERRUPT to request_irq().
2011-10-09Define BITS_PER_LONG for Linux codeSamuel Thibault
* linux/src/include/asm-i386/types.h (BITS_PER_LONG): Define to 32.
2011-10-08Add sym53c8xx driver from linux 2.2Samuel Thibault
This driver supports qemu's SCSI host device. Unfortunately it seems to be breaking the network device, so test with care. * linux/Makefrag.am (liblinux_a_SOURCES): Add linux/src/drivers/scsi/sym53c8xx{.c,_comm.h,.h,_defs.h} * linux/configfrag.ac: Add AC_Linux_DRIVER([sym53c8xx] to enable CONFIG_SCSI_SYM53C8XX. * linux/dev/glue/kmem.c (MEM_CHUNKS): Increase to 16. * linux/src/drivers/scsi/hosts.c [CONFIG_SCSI_SYM53C8XX]: Include "sym53c8xx.h". (builtin_scsi_hosts): include SYM53C8XX.
2011-09-03Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumachSamuel Thibault
2011-09-02Do not remap errno codes from E* to LINUX_E*Guillem Jover
Mach no longer uses any of the old and clashing errno E* codes, so it's safe to use them now w/o namespacing. This also means one less modification needed to the Linux code. * linux/dev/include/asm-i386/errno.h: Remove file. * linux/dev/kernel/dma.c (notifier_chain_unregister) [MACH_INCLUDE]: Remove code. * linux/dev/include/linux/notifier.h: Likewise. * linux/dev/arch/i386/kernel/irq.c (setup_x86_irq): Rename LINUX_EBUSY to EBUSY. (request_irq): Rename LINUX_EINVAL to EINVAL. * linux/dev/glue/block.c (register_blkdev): Rename LINUX_EBUSY to EBUSY and LINUX_EINVAL to EINVAL. (unregister_blkdev): Rename LINUX_EINVAL to EINVAL. (rdwr_partial) Rename LINUX_ENOMEM to ENOMEM and LINUX_EIO to EIO. * linux/dev/glue/misc.c (linux_to_mach_error): Rename LINUX_EPERM to EPERM, LINUX_EIO to EIO, LINUX_ENXIO to ENXIO, LINUX_EACCES to EACCES, LINUX_EFAULT to EFAULT, LINUX_EBUSY to EBUSY, LINUX_EINVAL to EINVAL, LINUX_EROFS to EROFS, LINUX_EWOULDBLOCK to EWOULDBLOCK and LINUX_ENOMEM to ENOMEM. (verify_area): Rename LINUX_EFAULT to EFAULT. * linux/dev/kernel/resource.c (check_region): Rename LINUX_EBUSY to EBUSY. * linux/dev/kernel/sched.c (__do_down): Rename LINUX_EINTR to EINTR.
2011-09-02Change argument name to match function body usageGuillem Jover
Otherwise the function wrongly uses the global symbol. * linux/src/drivers/scsi/ppa.c (ppa_nibble_in): Rename `str_p' argument to `base'.
2011-09-02Disable set but unused variableGuillem Jover
* linux/src/drivers/scsi/gdth.c (gdth_detect): Conditionalize `b' on [LINUX_VERSION_CODE < 0x020000]. Do not preset it to 0, it's initialized later on when needed.
2011-09-02Remove set but unused variablesGuillem Jover
* linux/dev/drivers/block/floppy.c (setup_rw_floppy): Remove `dflags'. (floppy_eject): Remove `dummy'. * linux/src/drivers/net/8390.c (ethdev_init): Remove `ei_local'. * linux/src/drivers/scsi/ppa.c (ppa_detect): Remove `ppb'.
2011-09-02Cast addr argument to vm_offset_tGuillem Jover
* linux/dev/glue/kmem.c (vfree): Cast `addr' argument on kfree_mem function to vm_offset_t.