aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ofw
Commit message (Collapse)AuthorAgeFilesLines
* Fix the OFW interrupt map parser to use its own idea of the number of interruptNathan Whitehorn2009-01-033-18/+24
| | | | | | | | | | | | cells in the map, instead of using a value passed to it and then panicing if it disagrees. This fixes interrupt map parsing for PCI bridges on some Apple Uninorth PCI controllers. Reported by: marcel Tested on: G4 iBook, Sun Ultra 5 Notes: svn path=/head/; revision=186728
* Modularize the Open Firmware client interface to allow run-time switchingNathan Whitehorn2008-12-207-584/+1374
| | | | | | | | | | | | | | | of OFW access semantics, in order to allow future support for real-mode OF access and flattened device frees. OF client interface modules are implemented using KOBJ, in a similar way to the PPC PMAP modules. Because we need Open Firmware to be available before mutexes can be used on sparc64, changes are also included to allow KOBJ to be used very early in the boot process by only using the mutex once we know it has been initialized. Reviewed by: marius, grehan Notes: svn path=/head/; revision=186347
* Unbreak ofwdump build by moving the pcell_t definition to after the kernelNathan Whitehorn2008-12-151-6/+6
| | | | | | | | | types headers, and inside the _KERNEL ifdef. Pointy hat to: me Notes: svn path=/head/; revision=186133
* Adapt parts of the sparc64 Open Firmware bus enumeration code (in particular,Nathan Whitehorn2008-12-153-0/+178
| | | | | | | | | | | | | | | | | | the code for parsing interrupt maps) to PowerPC and reflect their new MI status by moving them to the shared dev/ofw directory. This commit also modifies the OFW PCI enumeration procedure on PowerPC to allow the bus to find non-firmware-enumerated devices that Apple likes to add, and adds some useful Open Firmware properties (compat and name) to the pnpinfo string of children on OFW SBus, EBus, PCI, and MacIO links. Because of the change to PCI enumeration on PowerPC, X has started working again on PPC machines with Grackle hostbridges. Reviewed by: marius Obtained from: sparc64 Notes: svn path=/head/; revision=186128
* Remove unused consdev structure fields.Ed Schouten2008-10-271-3/+1
| | | | | | | | | The cn_unit and cn_tp fields don't seem to be used anywhere. Some drivers set them, while others don't. Just remove them, in an attempt to make our consdev code a little easier to understand. Notes: svn path=/head/; revision=184329
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-08-201-110/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan Notes: svn path=/head/; revision=181905
* Expand kdb_alt_break a little, most commonly used with the optionPeter Wemm2008-05-041-2/+17
| | | | | | | | | | | | | | | | | | | | | | ALT_BREAK_TO_DEBUGGER. In addition to "Enter ~ ctrl-B" (to enter the debugger), there is now "Enter ~ ctrl-P" (force panic) and "Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons). We've used variations of this at work. The force panic sequence is best used with KDB_UNATTENDED for when you just want it to dump and get on with it. The reboot request is a safer way of getting into single user than a power cycle. eg: you've hosed the ability to log in (pam, rtld, etc). It gives init the reboot signal, which causes an orderly reboot. I've taken my best guess at what the !x86 and non-sio code changes should be. This also makes sio release its spinlock before calling KDB/DDB. Notes: svn path=/head/; revision=178766
* In keeping with style(9)'s recommendations on macros, use a ';'Robert Watson2008-03-161-1/+1
| | | | | | | | | | | | after each SYSINIT() macro invocation. This makes a number of lightweight C parsers much happier with the FreeBSD kernel source, including cflow's prcc and lxr. MFC after: 1 month Discussed with: imp, rink Notes: svn path=/head/; revision=177253
* Add a new 'why' argument to kdb_enter(), and a set of constants to useRobert Watson2007-12-251-1/+1
| | | | | | | | | | | | for that argument. This will allow DDB to detect the broad category of reason why the debugger has been entered, which it can use for the purposes of deciding which DDB script to run. Assign approximate why values to all current consumers of the kdb_enter() interface. Notes: svn path=/head/; revision=174898
* In openprom_ioctl() ensure appropriate permissions and that data isn'tMarius Strobl2007-12-201-1/+9
| | | | | | | | | | | NULL and doesn't point to a NULL pointer before dereferencing it. This fixes a panic triggered by Xorg 7.3. Reported and tested by: Bill Green MFC after: 3 days Notes: svn path=/head/; revision=174802
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-10-201-1/+1
| | | | | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls. Notes: svn path=/head/; revision=172836
* Fix warnings.Peter Wemm2007-07-061-1/+1
| | | | | | | | | | | | nxge: cast page size fragments down to (int). If the vm's demand paging PAGE_SIZE is ever too big for that, we've got far bigger problems. ofw: move va_start() a little earlier. gcc-4.2 doesn't like us modifying the last arg before the va_start(). Approved by: re (rwatson) Notes: svn path=/head/; revision=171265
* In OF_init() check the return value of OF_getprop().Marius Strobl2007-06-161-1/+2
| | | | | | | | Found with: Coverity Prevent(tm) CID: 679 Notes: svn path=/head/; revision=170842
* - Restore the machine independency of sys/dev/ofw/openfirm.{c,h} byMarius Strobl2007-06-162-62/+0
| | | | | | | | | | moving OF_set_mmfsa_traptable() (SUNW,set-trap-table with the two arguments used here is specific to sun4v) to MD code. - In sys/dev/ofw/openfirm.h remove prototypes for unimplemented functions and unused Solaris compatibility macros. Notes: svn path=/head/; revision=170841
* Sync the styles of sys/boot/ofw/libofw/openfirm.c andMarius Strobl2007-06-161-272/+263
| | | | | | | | sys/dev/ofw/openfirm.c with themselves, with each-other and with style(9). Notes: svn path=/head/; revision=170838
* Add missing includes of priv.h.Robert Watson2006-11-061-0/+1
| | | | Notes: svn path=/head/; revision=164049
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-1/+2
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Using the ptr defines broke the powerpc build - convert set_mmfsa to the sameKip Macy2006-10-111-2/+2
| | | | | | | convention as the rest of openfirm.c Notes: svn path=/head/; revision=163221
* kernel clean up to make the sun4v kernel buildKip Macy2006-10-092-0/+59
| | | | | | | | Reviewed by: jmg Approved by: rwatson (mentor) Notes: svn path=/head/; revision=163146
* Fix spelling and wording in a comment.Marius Strobl2006-09-011-2/+2
| | | | Notes: svn path=/head/; revision=161836
* Fix various typos and brainos in last commit.Poul-Henning Kamp2006-05-301-5/+4
| | | | | | | Submmited by: Andrew Turner <andrew@fubar.geek.nz> Notes: svn path=/head/; revision=159065
* Update to new console api.Poul-Henning Kamp2006-05-261-28/+11
| | | | Notes: svn path=/head/; revision=158964
* - Add a new method ofw_bus_default_get_devinfo() that allows to retrieveMarius Strobl2005-11-223-2/+213
| | | | | | | | | | | | | | | | | | | a newly introduced struct ofw_bus_devinfo which can hold the OFW info of a device recallable via the ofw_bus KOBJ interface. Introduce a set of functions ofw_bus_gen_get_*() which use ofw_bus_default_get_devinfo() to provide generic subroutines for implementing the rest of the ofw_bus KOBJ interface in a bus driver. This is inspired by bus_get_resource_list() and bus_generic_rl_*_resource() and allows to reduce code duplication in bus drivers as they only have to provide an ofw_bus_default_get_devinfo() implementation in order to provide the ofw_bus KOBJ interface via ofw_bus_gen_get_*(). - While here add a comment to ofw_bus_if.m describing the intention of the ofw_bus KOBJ interface. Reviewed by: marcel Notes: svn path=/head/; revision=152683
* Remove unused function and variables.Marius Strobl2005-11-221-19/+0
| | | | Notes: svn path=/head/; revision=152682
* The mediasize shouldn't be multipled by the sector size when it wasPeter Grehan2005-10-311-1/+2
| | | | | | | | | | | | in bytes to start off with. This caused the GPT geom sniffer to attempt a seek just back from the end of the 'disk', which resulted in a > 4G seek, causing gdb psim to exit since it only supports 32-bit seeks. The size of the disk should really be specified in the psim device tree, but for now do the minimal amount of work to get psim to run again. Notes: svn path=/head/; revision=151894
* Make ttyconsolemode() call ttsetwater() so that drivers don't have to.Poul-Henning Kamp2005-10-161-1/+0
| | | | Notes: svn path=/head/; revision=151388
* Sync with openfirm(4) and check the return value of malloc() althoughMarius Strobl2005-05-191-2/+15
| | | | | | | this isn't exactly necessary with M_WAITOK. Notes: svn path=/head/; revision=146401
* Update the names of some member variables in comments to refect reality.Marius Strobl2005-05-191-2/+2
| | | | | | | | Apparently this was forgotten when this code was derived from the BSD openprom(4). Notes: svn path=/head/; revision=146400
* Merge revision 1.5 from NetBSD: Fix a typo in a comment.Marius Strobl2005-02-121-2/+2
| | | | | | | | NetBSD rev. 1.4 (addition of the OFW_PCI_PHYS_HI_BUS macro) had already been merged prior to adding this file to FreeBSD (with the 1.3 tag though). Notes: svn path=/head/; revision=141752
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-067-7/+8
| | | | Notes: svn path=/head/; revision=139749
* Don't probe for a disk unless explicitly enabled by a tunable.Peter Grehan2004-12-281-0/+6
| | | | | | | | | | | | This allows boot to proceed on a real system until the issue of calling back into certain OpenFirmware calls (e.g. finddevice) in thread context is understood. (this commit only affects psim users, of which I think I am the only one...) Notes: svn path=/head/; revision=139372
* GEOMify the OFW disk driver. Code taken unashamedly fromPeter Grehan2004-12-211-143/+122
| | | | | | | the preload case in dev/md/md.c. Notes: svn path=/head/; revision=139100
* Add new function ttyinitmode() which sets our systemwide defaultPoul-Henning Kamp2004-10-181-6/+1
| | | | | | | | | | | | | | | | | modes on a tty structure. Both the ".init" and the current settings are initialized allowing the function to be used both at attach and open time. The function takes an argument to decide if echoing should be enabled. Echoing should not be enabled for regular physical serial ports unless they are consoles, in which case they should be configured by ttyconsolemode() instead. Use the new function throughout. Notes: svn path=/head/; revision=136680
* Add a couple of XXX comments and fix a couple of fine points.Poul-Henning Kamp2004-10-121-2/+14
| | | | | | | I have not tried to make this a "canonical tty driver". Notes: svn path=/head/; revision=136454
* Instead of "OpenFirmware", "openfirmware", etc. use the official spellingMarius Strobl2004-08-165-12/+12
| | | | | | | | | "Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended). Ok'ed by: tmm Notes: svn path=/head/; revision=133862
* - Introduce an ofw_bus kobj-interface for retrieving the OFW node and aMarius Strobl2004-08-122-0/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subset ("compatible", "device_type", "model" and "name") of the standard properties in drivers for devices on Open Firmware supported busses. The standard properties "reg", "interrupts" und "address" are not covered by this interface because they are only of interest in the respective bridge code. There's a remaining standard property "status" which is unclear how to support properly but which also isn't used in FreeBSD at present. This ofw_bus kobj-interface allows to replace the various (ebus_get_node(), ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type() vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one. This in turn allows to simplify and remove code-duplication in drivers for devices that can hang off of more than one OFW supported bus. - Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the drivers for their children to use the ofw_bus kobj-interface. The IVAR- interfaces of the Central, EBus and FHC are entirely replaced by this. The PCI bus driver used its own kobj-interface and now also uses the ofw_bus one. The IVARs special to the SBus, e.g. for retrieving the burst size, remain. Beware: this causes an ABI-breakage for modules of drivers which used the IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be recompiled. The style-inconsistencies introduced in some of the bus drivers will be fixed by tmm@ in a generic clean-up of the respective drivers later (he requested to add the changes in the "new" style). - Convert the powerpc MacIO bus driver and the drivers for its children to use the ofw_bus kobj-interface. This invloves removing the IVARs related to the "reg" property which were unused and a leftover from the NetBSD origini of the code. There's no ABI-breakage caused by this because none of these driver are currently built as modules. There are other powerpc bus drivers which can be converted to the ofw_bus kobj-interface, e.g. the PCI bus driver, which should be done together with converting powerpc to use the OFW PCI code from sparc64. - Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take advantage of the ofw_bus kobj-interface and simplify them a bit. Reviewed by: grehan, tmm Approved by: re (scottl) Discussed with: tmm Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386 Notes: svn path=/head/; revision=133589
* Fix problems with the OFW console which happen when the system goesGarance A Drosehn2004-08-041-1/+1
| | | | | | | | | | | into single-user mode (as seen on sparc64 and PPC). Problems were due to a minor oversight in the changes committed in revision 1.25. Submitted by: grehan Tested by: gad & yongari Notes: svn path=/head/; revision=133096
* Preparation commit for the tty cleanups that will follow in the nearPoul-Henning Kamp2004-07-151-1/+1
| | | | | | | | | | | | future: rename ttyopen() -> tty_open() and ttyclose() -> tty_close(). We need the ttyopen() and ttyclose() for the new generic cdevsw functions for tty devices in order to have consistent naming. Notes: svn path=/head/; revision=132226
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPPoul-Henning Kamp2004-07-151-1/+1
| | | | | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything". Notes: svn path=/head/; revision=132199
* Update for the KDB framework:Marcel Moolenaar2004-07-101-8/+8
| | | | | | | | | o Make debugging code conditional upon KDB instead of DDB. o Call kdb_alt_break() instead of db_alt_break(). o Call kdb_enter() instead of breakpoint(). Notes: svn path=/head/; revision=131916
* - set resid correctly so that a failed seek (e.g. end of file) returnsPeter Grehan2004-06-251-1/+3
| | | | | | | | correctly - included required <sys/module.h> Notes: svn path=/head/; revision=131103
* Better OFW console support on Sun Ultra2 machines.David E. O'Brien2004-06-241-9/+17
| | | | | | | | | | | | Ultra2 users may want to set OFWCONS_POLL_HZ to a value of '20'. I have left default value at '4' as higher values can consume a more than is acceptable amount of CPU, and we don't have a consensus yet what is an optimal value. Submitted by: Pyun YongHyeon <yongari@kt-is.co.kr> Notes: svn path=/head/; revision=131016
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-163-9/+9
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Remove second <sys/cdefs.h> and __FBSDID.Marius Strobl2004-06-101-3/+0
| | | | Notes: svn path=/head/; revision=130323
* Machine generated patch which changes linedisc calls from accessingPoul-Henning Kamp2004-06-041-3/+3
| | | | | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit. Notes: svn path=/head/; revision=130077
* Gainfully employ the new ttyioctl in the trivial cases.Poul-Henning Kamp2004-06-011-28/+0
| | | | Notes: svn path=/head/; revision=129944
* - Rearrange a comment to fit in 80 chars per line, like the rest of thisMarius Strobl2004-05-221-4/+4
| | | | | | | | file. - Remove a superfluous ';'. Notes: svn path=/head/; revision=129588
* - Move OFW_NAME_MAX, used as a limit for OFW property names and deviceMarius Strobl2004-05-222-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | identifiers, to openfirmio.h as OFIOCMAXNAME, so programs can use it for buffer sizes etc. Note: Although this is only a rough upper limit to make the code more robust and to prevent the allocation of ridiculous amounts of memory, the current limit of one page (8191 + '\0' in openfirm_getstr()) still appears a bit high. The maximum length of OFW property names is 31. I didn't find a maximum length for the device identifiers in the OFW documentation but it certainly is much smaller than 8191, too. - Enable the OFIOCSET ioctl, i.e. move it out from under #if 0. - Don't use openfirm_getstr() for the property value in OFIOCSET, there are also properties whose values aren't strings and it makes sense to use a different maximum length for property values than OFW_NAME_MAX/ OFIOCMAXNAME. The maximum accepted property value is defined in openfirmio.h as OFIOCMAXVALUE (currently the maximum size of the value of the nvramrc property). - Make OFIOCSET not return EINVAL when OF_setprop() returns a different length for the written value than it was told to write, this is normal for the text string values of the properties in the OFW /options node. Instead, only return EINVAL if OF_setprop() returned -1 (value could not be written or property could not be created). Add a comment about the specialty of the OFW /options node. - Make OFIOCSET return the length of the written value returned by OF_setprop(), just like OF_getprop() does. Quite useful, at least for debugging. Reviewed by: tmm Notes: svn path=/head/; revision=129587
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-072-13/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=128019
* Device megapatch 4/6:Poul-Henning Kamp2004-02-213-2/+6
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080