summaryrefslogtreecommitdiff
path: root/sys/dev/ppc
AgeCommit message (Collapse)Author
2025-12-09bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHODJohn Baldwin
The wrapper functions such as bus_alloc_resource_any() still support passing the rid by value or pointer, but the underlying implementation now passes by value. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53402
2025-10-16style(9): white space after ; and around binary operatorsDavid E. O'Brien
in for() loops. Also, use 'while', where only the conditional test of 'for' was used. Reviewed by: sjg
2025-01-02Use bus_generic_detach instead of device_delete_children in detachJohn Baldwin
While here, check for errors from bus_generic_detach and move it to the start of detach if necessary. Differential Revision: https://reviews.freebsd.org/D47969
2024-07-24newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-03-13new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCEJohn Baldwin
The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2022-05-06ppbus/ppc: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin
2022-04-06ppc: Fix set but not used warnings on !i386.John Baldwin
Move fetch of SYS_RES_IOPORT resource and associated variables under existing #ifdef __i386__.
2022-04-04ppc_detect_fifo: eliminate write only variable ccWarner Losh
Sponsored by: Netflix
2020-09-01ppc: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365175
2018-04-13i386 4/4G split.Konstantin Belousov
The change makes the user and kernel address spaces on i386 independent, giving each almost the full 4G of usable virtual addresses except for one PDE at top used for trampoline and per-CPU trampoline stacks, and system structures that must be always mapped, namely IDT, GDT, common TSS and LDT, and process-private TSS and LDT if allocated. By using 1:1 mapping for the kernel text and data, it appeared possible to eliminate assembler part of the locore.S which bootstraps initial page table and KPTmap. The code is rewritten in C and moved into the pmap_cold(). The comment in vmparam.h explains the KVA layout. There is no PCID mechanism available in protected mode, so each kernel/user switch forth and back completely flushes the TLB, except for the trampoline PTD region. The TLB invalidations for userspace becomes trivial, because IPI handlers switch page tables. On the other hand, context switches no longer need to reload %cr3. copyout(9) was rewritten to use vm_fault_quick_hold(). An issue for new copyout(9) is compatibility with wiring user buffers around sysctl handlers. This explains two kind of locks for copyout ptes and accounting of the vslock() calls. The vm_fault_quick_hold() AKA slow path, is only tried after the 'fast path' failed, which temporary changes mapping to the userspace and copies the data to/from small per-cpu buffer in the trampoline. If a page fault occurs during the copy, it is short-circuit by exception.s to not even reach C code. The change was motivated by the need to implement the Meltdown mitigation, but instead of KPTI the full split is done. The i386 architecture already shows the sizing problems, in particular, it is impossible to link clang and lld with debugging. I expect that the issues due to the virtual address space limits would only exaggerate and the split gives more liveness to the platform. Tested by: pho Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D14633 Notes: svn path=/head/; revision=332489
2017-12-23Create a new ISA_PNP_INFO macro. Use this macro every where we haveWarner Losh
ISA PNP card support (replace by hand version in if_ed). Move module declarations to the end of some files. Fix PCCARD_PNP_INFO to use nitems(). Remove some stale comments about pc98, turns out the comment was simply wrong. Notes: svn path=/head/; revision=327102
2017-11-27sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
2017-09-18Hide a normal probe warning message under bootverbose, similar to atkbdcScott Long
Sponsored by: Netflix Notes: svn path=/head/; revision=323712
2017-08-27Add PCI Id for MosChip MCS9900.Konstantin Belousov
Submitted by: Robert Clausecker <fuz@fuz.su> PR: 214670 MFC after: 1 week Notes: svn path=/head/; revision=322947
2017-05-17Remove register keyword from sys/ and ANSIfy prototypesEd Maste
A long long time ago the register keyword told the compiler to store the corresponding variable in a CPU register, but it is not relevant for any compiler used in the FreeBSD world today. ANSIfy related prototypes while here. Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10193 Notes: svn path=/head/; revision=318389
2017-02-20sys/dev: Replace zero with NULL for pointers.Pedro F. Giffuni
Makes things easier to read, plus architectures may set NULL to something different than zero. Found with: devel/coccinelle MFC after: 3 weeks Notes: svn path=/head/; revision=313982
2017-01-28Remove pc98 support completely.Yoshihiro Takahashi
I thank all developers and contributors for pc98. Relnotes: yes Notes: svn path=/head/; revision=312910
2016-03-18Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.Justin Hibbits
On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544 Notes: svn path=/head/; revision=297000
2016-02-27Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().Justin Hibbits
Most calls to bus_alloc_resource() use "anywhere" as the range, with a given count. Migrate these to use the new bus_alloc_resource_anywhere() API. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370 Notes: svn path=/head/; revision=296137
2016-01-27Convert rman to use rman_res_t instead of u_longJustin Hibbits
Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075 Notes: svn path=/head/; revision=294883
2013-11-09Add support for SIIG x1 pci-e single parallel port card (JJ-E01211-S1)Eitan Adler
PR: kern/182217 Submitted by: Craig Leres <leres@ee.lbl.gov> MFC After: 1 week Notes: svn path=/head/; revision=257883
2013-02-21Fix build.Gleb Smirnoff
Notes: svn path=/head/; revision=247094
2013-02-21Replace splhigh() with critical_enter()/leave() to ensure we write theWarner Losh
config mode unlock sequence quickly enough. This likely isn't too critical, since splhigh() has been a noop for a decade... Notes: svn path=/head/; revision=247066
2013-02-21No longer need splhigh() since locking was done, delete it andWarner Losh
comments about it. Notes: svn path=/head/; revision=247065
2011-11-22Rename device_delete_all_children() into device_delete_children().Hans Petter Selasky
Suggested by: jhb @ and marius @ MFC after: 1 week Notes: svn path=/head/; revision=227849
2011-11-19Move the device_delete_all_children() function from usb_util.cHans Petter Selasky
to kern/subr_bus.c. Simplify this function so that it no longer depends on malloc() to execute. Identify a few other places where it makes sense to use device_delete_all_children(). MFC after: 1 week Notes: svn path=/head/; revision=227701
2011-02-19- Add support for MosChip 9865 Single 1284 Printer portMartin Wilke
PR: kern/152663 Submitted by: Jonathan Chen <jonc@chen.org.nz> Approved by: rwatson (mentor) Notes: svn path=/head/; revision=218861
2010-03-23Add PCI ID for MCS9901's parallel port.Xin LI
PR: kern/144713 Submitted by: gcooper MFC after: 2 weeks Notes: svn path=/head/; revision=205534
2009-02-11Added entries for Lava SP-PCI (1 serial + 1 parallel) PCI card. TheKai Wang
card is a multifunction PCI and report itself as two logical devices. Notes: svn path=/head/; revision=188472
2009-02-05reset_epp and ecp_sync both return int.Warner Losh
Notes: svn path=/head/; revision=188173
2009-01-21Add locking to ppc and ppbus and mark the whole lot MPSAFE:John Baldwin
- To avoid having a bunch of locks that end up always getting acquired as a group, give each ppc(4) device a mutex which it shares with all the child devices including ppbus(4), lpt(4), plip(4), etc. This mutex is then used for all the locking. - Rework the interrupt handling stuff yet again. Now ppbus drivers setup their interrupt handler during attach and tear it down during detach like most other drivers. ppbus(4) only invokes the interrupt handler of the device that currently owns the bus (if any) when an interrupt occurs, however. Also, interrupt handlers in general now accept their softc pointers as their argument rather than the device_t. Another feature of the ppbus interrupt handlers is that they are called with the parent ppc device's lock already held. This minimizes the number of lock operations during an interrupt. - Mark plip(4), lpt(4), pcfclock(4), ppi(4), vpo(4) MPSAFE. - lpbb(4) uses the ppc lock instead of Giant. - Other plip(4) changes: - Add a mutex to protect the global tables in plip(4) and free them on module unload. - Add a detach routine. - Split out the init/stop code from the ioctl routine into separate functions. - Other lpt(4) changes: - Use device_printf(). - Use a dedicated callout for the lptout timer. - Allocate the I/O buffers at attach and detach rather than during open and close as this simplifies the locking at the cost of 1024+32 bytes when the driver is attached. - Other ppi(4) changes: - Use an sx lock to serialize open and close. - Remove unused HADBUS flag. - Add a detach routine. - Use a malloc'd buffer for each read and write to avoid races with concurrent read/write. - Other pps(4) changes: - Use a callout rather than a callout handle with timeout(). - Conform to the new ppbus requirements (regular mutex, non-filter interrupt handler). pps(4) is probably going to have to become a standalone driver that doesn't use ppbus(4) to satisfy it's requirements for low latency as a result. - Use an sx lock to serialize open and close. - Other vpo(4) changes: - Use the parent ppc device's lock to create the CAM sim instead of Giant. - Other ppc(4) changes: - Fix ppc_isa's detach method to detach instead of calling attach. Tested by: no one :-( Notes: svn path=/head/; revision=187576
2008-11-16Various whitespace and style fixes.John Baldwin
Notes: svn path=/head/; revision=185003
2008-10-22Fix build with PPC_PROBE_CHIPSET enabled.John Baldwin
Notes: svn path=/head/; revision=184176
2008-10-21Several cleanups to remove the need for explicit unit numbers and a fewJohn Baldwin
other fixes: - Add pointers back to device_t objects in softc structures instead of storing the unit and using devclass_get_device(). - Add 'lpbb', 'pcf', 'pps', and 'vpo' child devices to every 'ppbus' device instead of just the first one. - Store softc pointers in si_drv1 of character devices instead of pulling the unit number from the minor number and using devclass_get_softc() and devclass_get_device(). - Store the LP_BYPASS flag in si_drv2 instead of encoding it in the minor number. - Destroy character devices for lpt(4) when detaching the device. - Use bus_print_child_footer() instead of duplicating it in ppbus_print_child() and fix ppbus_print_child()'s return value. - Remove unused AVM ivar from ppbus. - Don't store the 'mode' ivar in the ppbus ivars since we always fetch it from the parent anyway. - Try to detach all the child devices before deleting them in ppbus_detach(). - Use pause() instead of a tsleep() on a dummy address when polling the ppbus. - Use if_printf() and device_printf() instead of explicit names with unit numbers. Silence on: current@ Notes: svn path=/head/; revision=184130
2008-09-15Rework the handling of interrupt handlers for children of ppc and ppbus:John Baldwin
- Retire IVARs for passing IRQs around. Instead, ppbus and ppc now allow child devices to access the interrupt by via a rid 0 IRQ resource using bus_alloc_resource_any(). - ppc creates its own interrupt event to manage the interrupt handlers of child devices. ppc does not allow child devices to use filters. It could allow this if needed, but none of the current drivers use them and it adds a good bit of complication. It uses intr_event_execute_handlers() to fire the child device interrupt handlers from its threaded interrupt handler. - Remove the ppbus_dummy_intr() hack. Now the ppc device always has an interrupt handler registered and we no longer bounce all the way up to nexus to manage adding/removing ppbus child interrupt handlers. Instead, the child handlers are added and removed to the private interrupt event in the ppc device. Notes: svn path=/head/; revision=183053
2008-08-29Remove unneeded include.Yoshihiro Takahashi
Notes: svn path=/head/; revision=182441
2008-08-22Use bus_foo() rather than bus_space_foo() and remove bus handle and tagJohn Baldwin
from softc. Notes: svn path=/head/; revision=182016
2008-08-22Use ppc_detach() for device_detach instead of ppc_attach().John Baldwin
MFC after: 1 week Notes: svn path=/head/; revision=182015
2007-03-21Don't call bus_deactivate_resource() explicitly before callingYoshihiro Takahashi
bus_release_resource(). This is needed for pc98 by upcoming nexus related change. Notes: svn path=/head/; revision=167753
2007-03-06o Wrap ppc_setup_intr() at 80.Paolo Pisati
o Fix a bit the indentation. Notes: svn path=/head/; revision=167264
2007-02-23Whitespace fix.John Baldwin
Notes: svn path=/head/; revision=166933
2007-02-23Use 'pause' in several places rather than trying to tsleep() on NULL (whichJohn Baldwin
triggers a KASSERT) or local variables. In the case of kern_ndis, the tsleep() actually used a common sleep address (curproc) making it susceptible to a premature wakeup. Notes: svn path=/head/; revision=166909
2007-02-23o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati
bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@ Notes: svn path=/head/; revision=166901
2006-05-12Remove various bits of conditional Alpha code and fixup a few comments.John Baldwin
Notes: svn path=/head/; revision=158471
2006-04-28Rewrite of puc(4). Significant changes are:Marcel Moolenaar
o Properly use rman(9) to manage resources. This eliminates the need to puc-specific hacks to rman. It also allows devinfo(8) to be used to find out the specific assignment of resources to serial/parallel ports. o Compress the PCI device "database" by optimizing for the common case and to use a procedural interface to handle the exceptions. The procedural interface also generalizes the need to setup the hardware (program chipsets, program clock frequencies). o Eliminate the need for PUC_FASTINTR. Serdev devices are fast by default and non-serdev devices are handled by the bus. o Use the serdev I/F to collect interrupt status and to handle interrupts across ports in priority order. o Sync the PCI device configuration to include devices found in NetBSD and not yet merged to FreeBSD. o Add support for Quatech 2, 4 and 8 port UARTs. o Add support for a couple dozen Timedia serial cards as found in Linux. Notes: svn path=/head/; revision=158124
2006-04-26o Use __FBSDIDMarcel Moolenaar
o Whitespace fixes o Non-K&R functions Notes: svn path=/head/; revision=158057