aboutsummaryrefslogtreecommitdiff
path: root/linux
Commit message (Collapse)AuthorAgeFilesLines
* linux: Fix building with C23Sergey Bugaev2024-12-101-1/+4
| | | | | | | | | | | 'true' and 'false' are keywords in C23. This will equally be an issue on older standards if something pulls in stdbool.h, which make these into macros. In either of these two cases, just typedef 'boolean' from 'bool' (avoiding the enum), and rely on 'true' and 'false' being valid values of the type. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-ID: <20241210115705.710555-2-bugaevc@gmail.com>
* warn about incompatibility between linux disk driver and PAESamuel Thibault2024-12-041-0/+2
|
* Add missing caddr_t typeSamuel Thibault2024-10-171-2/+0
| | | | Now that gnumach does not define it any more.
* Disable specific warnings that are now errors in GCC 14Flavio Cruz2024-06-241-1/+7
| | | | Message-ID: <376mwj4qtzxqgg2p4teqefxep7qz2kxll25synb3sulgof24j5@wxhqtaf7ei32>
* linux: Do not enable in SMP, it is not MP-safeSamuel Thibault2024-04-051-0/+5
|
* remove machine/machspl.h as it duplicates machine/spl.hLD2024-03-092-2/+2
| | | | Message-ID: <20240309140244.347835-2-luca@orpolo.org>
* linux: Add missing includeSamuel Thibault2024-03-041-0/+2
| | | | Otherwise the types in linux/dev/include/linux/skbuff.h are unknown.
* linux: Add noide and noahci kernel optionsSamuel Thibault2024-01-232-2/+8
| | | | | They were meant to be temporary, but that got longer, and people seem to expect them to be there now.
* linux: DMA32 is now correctly handledSamuel Thibault2023-08-301-1/+0
|
* Use host_get_time64 in glue codeFlavio Cruz2023-03-131-1/+4
| | | | Message-Id: <ZA64CbpYEz+BgiEw@jupiter.tail36e24.ts.net>
* linux: Fix non-SMP buildSamuel Thibault2023-02-142-1/+2
|
* Make curr_ipl[] per cpuDamien Zammit2023-02-142-4/+5
|
* linux: Keep existing timer interrupt handler for APICDamien Zammit2023-02-031-1/+3
| | | | Message-Id: <20230203100133.835589-2-damien@zamaudio.com>
* linux: Skip probing IDE when 255 phys heads detectedDamien Zammit2023-02-011-1/+1
| | | | | This allows qemu -M q35 to boot without 30 second timeout failing on hd0, when disk is actually attached via ahci.
* linux: Skip updating jiffies on AP timerDamien Zammit2023-01-311-0/+3
| | | | Message-Id: <20230131093428.756906-7-damien@zamaudio.com>
* Enable -Wmissing-prototypes.Flavio Cruz2023-01-291-0/+4
| | | | | | | | | | * Makefile.am: enable -Wmissing-prototypes * ddb/db_inout.h: Prototype kdb_kintr for entering into DDB. * ddb/db_mp.c Include ddb/db_input.h to get kdb_kintr. * i386/i386at/kd.h: Include ddb/input.h to get kdb_kintr. * linux/Makefrag.am: Disable some of the new warnings for linux drivers, otherwise we will get more and more noise. Message-Id: <Y9YNfNaYSsZJFST5@mercury.tail36e24.ts.net>
* Fix several warnings for -Wmissing-prototypesFlavio Cruz2023-01-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * device/ds_routines.c: use static qualifier. * device/subrs.c: delete unused functions. * i386/i386/ast_check.c: include prototypes in kern/ast.h * i386/i386/db_disasm.c: Include prototypes in ddb/db_examine.h * i386/i386/db_interface.h: Define prototype for kdb_kentry. Expose debug methods feep and kd_debug_put. * i386/i386/db_trace.c: delete left over cthreads support, functions are not used. * i386/i386/model_dep.h: Define prototype for c_boot_entry. * i386/i386at/acpi_parse_apic.c: Static qualifiers. * i386/i386at/autoconf.c: Include header file for prototypes and remove dead code. * i386/i386at/autoconf.h: Fix prototype. * i386/i386at/com.c: Add static qualifiers, delete dead code. * i386/i386at/com.c: ditto. * i386/i386at/com.h: Define prototypes for debug functions. * i386/i386at/int_init.c: Include header. * i386/i386at/kd.c: Include header for debug interface. Remove dead kd_cmdreg_read and make xga_getpos static. * i386/i386at/kd_mouse.c: Static qualifiers. * i386/i386at/lpr.c: Dead lprpr. * i386/i386at/model_dep.c: Remove exit function. * kern/mach_clock.c: Include mig prototypes. * kern/mach_clock.h: Remove duplicates of mig prototypes. * kern/machine.c: Use static. * kern/startup.c: slave_main is unused. * kern/thread.h: Define thread_stats that is useful for debugging. * kern/timer.c: Keep db_thread_times since it can be used for debugging. * kern/timer.h: ditto. * linux/dev/glue/misc.c: Use mig header for host_get_time. Message-Id: <Y8oyiecaflCaYhaW@mercury.tail36e24.ts.net>
* Drop spurious changesSamuel Thibault2022-12-222-8/+2
|
* Warn only once about not being able to recycle pagesSamuel Thibault2022-12-222-2/+8
|
* linux drivers: Don't depend on curr_pic_mask for APICDamien Zammit2022-10-261-2/+2
| | | | Message-Id: <20221025105502.222708-7-damien@zamaudio.com>
* bios32: Use phystokv() on low bios addressesDamien Zammit2022-10-251-5/+5
| | | | Message-Id: <20221025105502.222708-4-damien@zamaudio.com>
* ahci: Do not even try AHCI identify when device is ATAPIAndrea Monaco2021-09-121-3/+4
| | | | | * linux/dev/drivers/block/ahci.c (ahci_probe_port): Avoid trying AHCI identify when PxCMD.ATAPI is set.
* ahci: Fix warning contentAndrea Monaco2021-09-121-1/+1
| | | | | * linux/dev/drivers/block/ahci.c (ahci_identify): Fix warning for the identify timeout.
* linux block: allow loading data up to 4GiB limitSamuel Thibault2021-08-281-1/+8
| | | | | | | | | | | | | | Linux drivers are only limited by the DMA32 constraint, not by the directmap constraint. But our segment order is currently set to DMA < DMA32 < DIRECTMAP < HIGHMEM (since that is what we will have in 64bit mode). In PAE mode this makes DMA32 limited to 800MiB. Ideally we'd have DMA < DIRECTMAP < DMA32 < HIGHMEM but that'd make the memory code more complex, and we are to remove the Linux drivers anyway. In the meanwhile, In non-PAE mode we can just use HIGHMEM which is already limited to 4GiB, that will do the work. * linux/dev/glue/block.c (VM_PAGE_LINUX): New macro. (device_read): Use VM_PAGE_LINUX instead of VM_PAGE_DMA32.
* linux: Use kvtophys instead of _kvtophysSamuel Thibault2021-08-281-1/+2
| | | | | | | | _kvtophys only works with direct-mappable memory, which is scarse, better use kvtophys that can work with any kind of memory. * linux/src/include/asm-i386/io.h: Include <intel/pmap.h> (virt_to_phys): Use kvtophys instead of _kvtophys.
* linux block: Fix checking block sector.Samuel Thibault2021-08-271-0/+2
| | | | * linux/dev/glue/block.c (check_rw_block): Return 0 on no error.
* vm_page_grab: allow allocating in high memorySamuel Thibault2021-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | vm_page_grab was systematically using the VM_PAGE_SEL_DIRECTMAP selector to play safe with existing code. This adds a flags parameter to let callers of vm_page_grab specify their constraints. Linux drivers need 32bit dmas, Xen drivers use kvtophys to clear some data. Callers of kmem_pagealloc_physmem and vm_page_grab_phys_addr also use kvtophys. Otherwise allocations can go to highmem. This fixes the allocation jam in the directmap segment. * vm/vm_page.h (VM_PAGE_DMA, VM_PAGE_DMA32, VM_PAGE_DIRECTMAP, VM_PAGE_HIGHMEM): New macros. (vm_page_grab): Add flags parameter. * vm/vm_resident.c (vm_page_grab): Choose allocation selector according to flags parameter. (vm_page_convert, vm_page_alloc): Pass VM_PAGE_HIGHMEM to vm_page_grab. (vm_page_grab_phys_addr): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * vm/vm_fault.c (vm_fault_page): Pass VM_PAGE_HIGHMEM to vm_page_grab. * vm/vm_map.c (vm_map_copy_steal_pages): Pass VM_PAGE_HIGHMEM to vm_page_grab. * kern/slab.c (kmem_pagealloc_physmem): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * i386/intel/pmap.c (pmap_page_table_page_alloc): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * xen/block.c (device_read): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * linux/dev/glue/block.c (alloc_buffer): Pass VM_PAGE_DMA32 to vm_page_grab.
* block: Look out for disk sector number overflowSamuel Thibault2021-08-173-9/+72
| | | | | | | | | | * linux/dev/drivers/block/ahci.c (ahci_do_port_request): Reject sectors beyond LBA48 or LBA28. * linux/dev/glue/block.c (check_rw_block): New function. (rdwr_partial, rdwr_full): Use check_rw_block to reject block number overflows. * linux/src/drivers/block/ide.c (do_rw_disk): Reject sectors beyond LBA28 or CHS.
* Add ioapic support disabled by defaultDamien Zammit2021-04-041-1/+3
| | | | | | | Use --enable-ncpus=x --enable-apic where x > 1 for SMP+APIC support. Use neither for no SMP and old PIC support. Message-Id: <20210404050812.145483-1-damien@zamaudio.com>
* linux: Add option to disable Linux groupsSamuel Thibault2021-03-311-1/+5
| | | | | * linux/configfrag.ac (--disable-linux-groups): New option. (AC_OPTION_Linux_group): Default to $enable_linux_groups.
* linux irq: Avoid hardcoding the number of interrupts.Damien Zammit2021-03-281-14/+8
| | | | | | | | | * linux/dev/arch/i386/kernel/irq.c: Include <i386/irq.h> instead of <i386/pic.h>. (irq_action): Use NINTR instead of 16, do not bother expliciting the initialization. (install_user_intr_handler, request_irq, free_irq, probe_irq_on, probe_irq_off, reserve_mach_irqs): Use NINTR instead of 16.
* configure: Add block groupDamien Zammit2021-03-281-4/+16
| | | | | | | | | | This is the last group needed to easily disable the Linux glue. * linux/configfrag.ac (block): New group. (floppy): Set group to block. (ide): Set group to block. Message-Id: <20210328060320.36194-2-damien@zamaudio.com>
* fix EISA check in init_IRQDamien Zammit2021-03-271-1/+1
| | | | Message-Id: <20210326094850.2606-5-damien@zamaudio.com>
* ahci: Fix variable nameAndrea G. Monaco2021-02-211-4/+4
| | | | * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Rename spd to det.
* x86: Add XSAVE supportSamuel Thibault2020-11-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * i386/i386/fpu.h (CPU_XCR0_X87, CPU_XCR0_SSE, CPU_XCR0_AVX, CPU_XCR0_MPX, CPU_XCR0_AVX512): New macros. (xsave): Pass fp_xsave_support to xsave. (fpu_save_context): When fp_kind is FP_387X, use xsave. (fp_xsave_support): New variable declaration. * i386/i386/proc_reg.h (cpuid): New macro. * linux/src/include/asm-i386/processor.h (cpuid): Disable macro. * i386/include/mach/i386/fp_reg.h: Include <stdint.h> (i386_xfp_xstate_header): New structure. (i386_xfp_save): Add xsave fields. * i386/i386/fpu.c (fp_xsave_support): New variable. (init_fpu): Look for XSAVE feature; if available, get the supported parts and set fp_kind to FP_387X. (fpu_module_init): Set ifps_cache alignment to alignof(struct i386_fpsave_state). (fpu_set_state): Make sure to clear all the ifps structure. Reuse the FP_387FX for the FP_387X case. (fpu_get_state, fpexterrflt, fpastintr, fp_state_alloc): Reuse the FP_387FX for the FP_387X case. (fp_save): When fp_kind is FP_387X, use xsave. (fp_load): When fp_kind is FP_387X, use xrstor. Reuse the FP_387FX for the FP_387X case.
* genhd: Fix building without IDE driversSamuel Thibault2020-11-151-2/+5
| | | | | * linux/dev/drivers/block/genhd.c [!CONFIG_BLK_DEV_IDE] (device_setup): Do not call ide_setup.
* smp: Add --enable-ncpus option and fix buildSamuel Thibault2020-09-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | * configfrag.ac (--enable-ncpus): Add option to set $mach_ncpus. * i386/i386/cpu_number.h (CPU_NUMBER, cpu_number): New macros, set to 0 for now. * i386/i386/db_interface.c (cpu_interrupt_to_db): New function. * i386/i386/db_interface.h (cpu_interrupt_to_db): New declaration. * i386/i386/mp_desc.c (int_stack_base): New array. (intel_startCPU): New function. * i386/i386at/model_dep.c: Include <i386/smp.h> (int_stack_top, int_stack_base): Turn into arrays (i386at_init): Update accesses accordingly. * i386/i386at/model_dep.h (int_stack_top, int_stack_base, ON_INT_STACK): Likewise. * i386/intel/pmap.c (cpus_active, cpus_idle, cpu_update_needed): Add variables. * i386/intel/pmap.h (cpus_active, cpus_idle, cpu_update_needed): Mark extern. * kern/cpu_number.h: Include <machine/cpu_number.h> * linux/dev/arch/i386/kernel/irq.c (local_bh_count, local_irq_count): Hardcode to the address of intr_count. We will not use the Linux code in SMP mode anyway.
* Add hardware interrupt notification mechanismSamuel Thibault2020-07-102-81/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows privileged userland drivers to get notifications of hardware interrupts. Initial work by Zheng Da, reworked by Damien Zammit and myself. * Makefrag.am (libkernel_a_SOURCES): Add device/intr.c and device/intr.h. (include_device_HEADERS): Add include/device/notify.defs and include/device/notify.h. * device/dev_hdr.h (name_equal): Add declaration. * device/ds_routines.c: Include <device/intr.h> (ds_device_intr_register, ds_device_intr_ack): New functions. * device/intr.c, device/intr.h: New files. * doc/mach.texi (Device Interrupt): New section. * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/irq.c and i386/i386/irq.h. * i386/i386/irq.c, i386/i386/irq.h: New files. * i386/i386at/conf.c: Include <device/intr.h>. (irqname): New macro. (dev_name_list): Add irq device. * include/device/device.defs (device_intr_register, device_intr_ack): New RPCs. * include/device/notify.defs, include/device/notify.h: New files. * kern/startup.c: Include <device/intr.h> (start_kernel_threads): Start intr_thread thread. * linux/dev/arch/i386/kernel/irq.c: Include <device/intr.h> (linux_action): Add user_intr field. (linux_intr): Call user_intr action if any. (mask_irq, unmask_irq): Move functions to i386/i386/pic.c (__disable_irq, __enable_irq): Move functions to i386/i386/irq.c. (install_user_intr_handler): New function. (request_irq): Initialize user_intr field. * linux/src/include/asm-i386/irq.h (__disable_irq, __enable_irq): Remove prototypes. * i386/i386/pic.c (mask_irq, unmask_irq): New functions. * i386/i386/pic.h (mask_irq, unmask_irq): New prototypes.
* Support GPT disklabels and build them by defaultнаб2020-06-012-0/+318
| | | | Based on UEFI 2.8A spec
* Add kmem_vallocSamuel Thibault2020-05-011-1/+3
| | | | | | | | | | | Functions like vremap need to allocate some virtual addressing space before making their own mapping. kmem_alloc_wired can be used for that but that wastes memory. * vm/vm_kern.c (kmem_valloc): New function. * vm/vm_kern.h (kmem_valloc): New prototype. * linux/dev/glue/kmem.c (vremap): Call kmem_valloc instead of kmem_alloc_wired. Also check that `offset' is aligned on a page.
* Fix build with -fno-commonSamuel Thibault2020-03-312-2/+2
| | | | | | | | | | | | | | | | which will be the default in gcc-10. * device/io_req.h (io_inband_cache): Add extern qualifier. * device/tty.h (tthiwat, ttlowat): Likewise. * i386/i386/db_machdep.h (ddb_regs): Likewise. * kern/cpu_number.h (master_cpu): Likewise. * kern/time_stamp.h (ts_tick_count): Likewise. * linux/src/drivers/scsi/in2000.h (proc_scsi_in2000): Likewise. * device/ds_routines.c (io_inband_cache): New variable. * i386/i386/db_interface.c (ddb_regs): Likewise. * kern/processor.c (master_cpu): Likewise. * kern/time_stamp.c (ts_tick_count): Likewise. * linux/pcmcia-cs/modules/pci_fixup.c (pci_root): Remove variable.
* irq: Add disabling counterSamuel Thibault2019-11-122-4/+53
| | | | | | | | | | | * linux/dev/arch/i386/kernel/irq.c (ndisabled_irq): New array. (__disable_irq, __enable_irq): New functions, count with ndisabled_irq before really calling mask_irq/unmask_irq. (linux_pic_mask): New variable. (disable_irq, enable_irq): Manage linux_pic_mask and call __disable_irq/__enable_irq instead of calling mask_irq/unmask_irq. * linux/src/include/asm-i386/irq.h (__disable_irq, __enable_irq): New prototypes.
* spl: Remove intpri arraySamuel Thibault2019-11-105-59/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And simplify prtnull vs intnull vs linux_bad_intr. * i386/i386/ipl.h (intpri): Remove declaration * i386/i386/pic.c (prtnull_count): Remove variable. (prtnull): Remove function. * i386/i386/pic.h (prtnull): Remove declaration. * i386/i386at/autoconf.c (take_dev_irq, take_ctlr_irq): Use ivect instead of intpri to determine irq availability. Do not set intpri. * i386/i386at/pic_isa.c (ivect): Replace prtnull with intnull. (intpri): Remove array. * linux/dev/arch/i386/kernel/irq.c (linux_intr_pri): Remove variable. (linux_bad_intr): Remove function. (setup_x86_irq): Do not check intpri coherency. Do not set intpri. Set default ivect to intnull instead of linux_bad_intr. (probe_irq_on): Check ivect against intnull instead of linux_bad_intr. Do not set intpri. (probe_irq_off): Likewise. (reserve_mach_irqs): Do not check against prtnull. (old_clock_pri): Remove variable. (init_IRQ): Do not set intpri. Do not set ivect to linux_bad_intr. (restore_IRQ): Do not set ivect. * i386/i386/pit.c (clkstart): Do not set intpri. * i386/i386at/kd_mouse.c (kd_mouse_open, kd_mouse_close): Likewise. * linux/dev/drivers/block/genhd.c (device_setup): Do not set linux_intr_pri. * linux/dev/glue/block.c (init_partition, device_open): Likewise. * linux/dev/glue/net.c (device_open): Likewise. * linux/dev/glue/glue.h (linux_intr_pri, linux_bad_intr): Remove declarations.
* Make default boot less scarySamuel Thibault2019-11-102-10/+19
| | | | | | | | * linux/configfrag.ac (AM53C974, aha1542, eata, eata_pio, ppa, wd7000, 3c515, de600, de620): Disable by default drivers for elder hardware, which have scary boot messages. * linux/pcmcia-cs/modules/ds.c (init_pcmcia_ds): Make message about socket not being found less scary.
* simplify interrupt handlingDamien Zammit2019-11-106-23/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have removed spl levels, now remove the machinery to manage different PIC masks according to levels. Only keep machinery to disable interrupts whatever the level. * i386/i386/pic.c (pic_mask): Remove array. (picinit): Do not form PIC mask. Set initial PIC mask to 0. (form_pic_mask): Remove function. * i386/i386/pic.h (form_pic_mask, pic_mask): Remove declarations. * i386/i386/spl.S (SETMASK): Remove macro. (XEN_SETMASK): Add macro, containing the Xen version of SETMASK. (spl0, splx_cli, spl) [MACH_XEN]: Call XEN_SETMASK instead of SETMASK. * i386/i386/pit.c (clkstart): Do not call form_pic_mask. * i386/i386at/autoconf.c (take_dev_irq, take_ctlr_irq): Likewise. * i386/i386at/kd_mouse.c (kd_mouse_open, kd_mouse_close): Likewise. * linux/dev/arch/i386/kernel/irq.c (mask_irq, unmask_irq): Directly update curr_pic_mask without using pic_mask array. (init_IRQ, restore_IRQ): do not call form_pic_mask. * linux/dev/include/asm-i386/system.h: Include <i386/ipl.h>. (__save_flags, __restore_flags): Use curr_ipl and splx instead of hardware flags. * linux/dev/init/main.c (linux_init): Do not call cli. * linux/dev/kernel/sched.c (linux_timer_intr): Do not use pic_mask. * linux/src/drivers/block/ide.c (try_to_identify): Disable irq probing. * linux/src/drivers/scsi/NCR53c406a.c (NCR53c406a_detect): Disable irq probing.
* ide: Use default IRQ by defaultSamuel Thibault2019-11-101-0/+1
| | | | | | | | To avoid even trying to probe IRQs. Nowadays' hardware use the default IRQ anyway. * linux/src/drivers/block/ide.c (init_hwif_data): Set hwif->irq to default_irqs[index].
* compiler-gcc*.h: Keep on the gcc 5 version for nowSamuel Thibault2019-09-065-268/+4
| | | | | | | | | | We can introduce other versions if we ever need to (which is unlikely since we plan to get rid of the Linux drivers). * compiler-gcc.h: Include compiler-gcc5.h for all compiler versions starting from gcc 5. * compiler-gcc6.h, compiler-gcc7.h, compiler-gcc8.h, compiler-gcc9.h: Remove.
* Add gcc-9 compatibilitySamuel Thibault2019-08-311-0/+67
| | | | * linux/src/include/linux/compiler-gcc9.h: New file.
* Fix printk formatSamuel Thibault2019-08-111-5/+5
| | | | | * linux/dev/drivers/block/ahci.c (ahci_identify, ahci_probe_port): Fix format.
* ahci: Ignore multifunction bit in PCI header typeSamuel Thibault2019-04-271-0/+2
| | | | | * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Clear bit 7 of hdrtype.