summaryrefslogtreecommitdiff
path: root/sys/dev/firewire/fwdev.c
Commit message (Collapse)AuthorAgeFilesLines
* This commit was manufactured by cvs2svn to create tagrelease/6.1.0_cvscvs2svn2006-05-061-1/+1
| | | | | | 'RELENG_6_1_0_RELEASE'. This commit was manufactured to restore the state of the 6.1-RELEASE image.
* Merge two sets of changes relating to devfs device node cloning fromRobert Watson2005-08-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HEAD to RELENG_6: changes to introduce a credentialed version of the clone event handler, and then changes to merge the regular and credentialed versions into a single interface (along with updates to existing consumers). With this merge, 6.x and 7.x are in sync. First batch merges devfs_devs.c:1.37, devfs_vnops.c:1.115, kern_conf.c:1.187, tty_pty.c:1.138, mac_vfs.c:1.109, mac_biba.c:1.36, mac_lomac.c:1.36, mac_mls.c:1.73, mac_stub.c:1.53, mac_test.c:1.61, conf.h:1.223, mac.h:1.68, mac_policy.h:1.67 from HEAD to RELENG_6: When devfs cloning takes place, provide access to the credential of the process that caused the clone event to take place for the device driver creating the device. This allows cloned device drivers to adapt the device node based on security aspects of the process, such as the uid, gid, and MAC label. - Add a cred reference to struct cdev, so that when a device node is instantiated as a vnode, the cloning credential can be exposed to MAC. - Add make_dev_cred(), a version of make_dev() that additionally accepts the credential to stick in the struct cdev. Implement it and make_dev() in terms of a back-end make_dev_credv(). - Add a new event handler, dev_clone_cred, which can be registered to receive the credential instead of dev_clone, if desired. - Modify the MAC entry point mac_create_devfs_device() to accept an optional credential pointer (may be NULL), so that MAC policies can inspect and act on the label or other elements of the credential when initializing the skeleton device protections. - Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(), so that the pty clone credential is exposed to the MAC Framework. While currently primarily focussed on MAC policies, this change is also a prerequisite for changes to allow ptys to be instantiated with the UID of the process looking up the pty. This requires further changes to the pty driver -- in particular, to immediately recycle pty nodes on last close so that the credential-related state can be recreated on next lookup. Submitted by: Andrew Reisse <andrew.reisse@sparta.com> Obtained from: TrustedBSD Project Sponsored by: SPAWAR, SPARTA Second batch merges scsi_target.c:1.68, coda_fbsd.c:1.43, firewirereg.h:1.38, fwdev.c:1.47, nmdm.c:1.36, snp.c:1.100, dsp.c:1.82, mixer.c:1.45, vkbd.c:1.9, devfs_vnops.c:1.117, tty_pty.c:1.139, tty_tty.c:1.57, bpf.c:1.156, if_tap.c:1.56, if_tun.c:1.153, smb_dev.c:1.28, conf.h:1.224 from HEAD to RELENG_6: Merge the dev_clone and dev_clone_cred event handlers into a single event handler, dev_clone, which accepts a credential argument. Implementors of the event can ignore it if they're not interested, and most do. This avoids having multiple event handler types and fall-back/precedence logic in devfs. This changes the kernel API for /dev cloning, and may affect third party packages containg cloning kernel modules. Requested by: phk These changes modifies the kernel device driver API for device cloning, and might require minor modifications to third party device drivers that make use of devfs cloning. It will not be merged to RELENG_5. Approved by: re (scottl) Notes: svn path=/stable/6/; revision=149038
* Explicitly hold a reference to the cdev we have just cloned. ThisPoul-Henning Kamp2005-03-311-0/+1
| | | | | | | | closes the race where the cdev was reclaimed before it ever made it back to devfs lookup. Notes: svn path=/head/; revision=144389
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Second half of the dev_t cleanup.Poul-Henning Kamp2004-06-171-1/+1
| | | | | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc. Notes: svn path=/head/; revision=130640
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-11/+11
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Don't try to copy out the result payload if there isn't one. This ioctlDoug Rabson2004-05-231-6/+14
| | | | | | | | interface really needs changing to split out the various async request types. Notes: svn path=/head/; revision=129628
* Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's toDoug Rabson2004-05-221-4/+4
| | | | | | | uint32_t where appropriate. Notes: svn path=/head/; revision=129585
* MFp4: FireWireHidetoshi Shimokawa2004-03-261-12/+26
| | | | | | | | | | | | | | | | | | | | | | * all - s/__FUNCTION__/__func__/. Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at> - Compatibility for RELENG_4 and DragonFly. * firewire - Timestamp just before queuing. - Retry bus probe if it fails. - Use device_printf() for debug message. - Invalidiate CROM while update. - Don't process minimum/invalid CROM. * sbp - Add ORB_SHORTAGE flag. - Add sbp.tags tunable. - Revive doorbell support. It's not enabled by default. Notes: svn path=/head/; revision=127468
* Fix a bug introduced in rev 1.33(mega API change).Hidetoshi Shimokawa2004-03-241-1/+1
| | | | | | | | | | Because xfer->send.payload is a pointer to the buffer, '&' shouldn't be there. Submitted by: John Weisgerber <weisgerberj@gsilumonics.com> PR: misc/64623 Notes: svn path=/head/; revision=127347
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-3/+3
| | | | | | | | | | | 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
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. Notes: svn path=/head/; revision=126076
* Add missing free() in exception handlers.Hidetoshi Shimokawa2004-01-221-2/+2
| | | | | | | Reported by: Stanford Metacompilation research group Notes: svn path=/head/; revision=124836
* Respect a return code of fwmem_open().Hidetoshi Shimokawa2003-11-071-3/+3
| | | | Notes: svn path=/head/; revision=122227
* Fix for FW_ASYREQ.Hidetoshi Shimokawa2003-10-241-39/+36
| | | | | | | | | - set send.pay_len correctly. - copy response only if needed. - remove unnecessary 'err = 0'. Notes: svn path=/head/; revision=121466
* MFp4: Change struct fw_xfer to reduce memory copy in fwmem_*() functions.Hidetoshi Shimokawa2003-10-021-21/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And many changes. * all - Major change of struct fw_xfer. o {send,recv}.buf is splitted into hdr and payload. o Remove unnecessary fields. o spd is moved under send and recv. - Remove unnecessary 'volatile' keyword. - Add definition of rtcode and extcode. * firewire.c - Ignore FWDEVINVAL devices in fw_noderesolve_nodeid(). - Check the existance of the bind before call STAILQ_REMOVE(). - Fix bug in the fw_bindadd(). - Change element of struct fw_bind for simplicity. - Check rtcode of response packet. - Reduce split transaction timeout to 200 msec. (100msec is the default value in the spec.) - Set watchdog timer cycle to 10 Hz. - Set xfer->tv just before calling fw_get_tlabel(). * fwohci.c - Simplifies fwohci_get_plen(). * sbp.c - Fix byte order of multibyte scsi_status informations. - Split sbp.c and sbp.h. - Unit number is not necessary for FIFO¤ address. - Reduce LOGIN_DELAY and SCAN_DELAY to 1 sec. - Add some constants defineded in SBP-2 spec. * fwmem.c - Introduce fwmem_strategy() and reduce memory copy. Notes: svn path=/head/; revision=120660
* Fix a bug in fwdev_clone().Hidetoshi Shimokawa2003-10-011-1/+1
| | | | | | | Spotted by: grog Notes: svn path=/head/; revision=120624
* Change device name notation.Hidetoshi Shimokawa2003-08-051-8/+95
| | | | | | | | | - /dev/fw{,mem}X.Y represents the Y'th unit on the X'th bus. - /dev/fw{,mem}X is an alias of fw{,mem}X.0 for compatibility. - Clone devices. Notes: svn path=/head/; revision=118455
* Clean up fwdev.Hidetoshi Shimokawa2003-08-011-208/+224
| | | | | | | | Allocate iso DMA channel dynamically. This allows us to have more /dev/fw* than number of DMA channels for asyn. transactions and etc. Notes: svn path=/head/; revision=118293
* Allow retrieval of local Configuration ROM.Hidetoshi Shimokawa2003-07-121-7/+22
| | | | Notes: svn path=/head/; revision=117473
* Set the local bus address in xfer->dst.Hidetoshi Shimokawa2003-04-221-2/+2
| | | | | | | Submitted by: Buzz Slye <buzz@gaia.arc.nasa.gov> Notes: svn path=/head/; revision=113832
* Remove unused code.Hidetoshi Shimokawa2003-04-211-70/+32
| | | | Notes: svn path=/head/; revision=113802
* MFp4(simokawa_firewire):Hidetoshi Shimokawa2003-04-171-294/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many internal structure changes for the FireWire driver. - Compute CRC in CROM parsing. - Add support for configuration ROM build. - Simplify dummy buffer handling. - busdma conversion - Use swi_taskqueue_giant for -current. Mark the interrupt routine as MPSAFE. - AR buffer handling. Don't reallocate AR buffer but just recycle it. Don't malloc and copy per packet in fwohci_arcv(). Pass packet to fw_rcv() using iovec. Application must prepare receiving buffer in advance. - Change fw_bind API so that application should pre-allocate xfer structure. - Add fw_xfer_unload() for recycling struct fw_xfer. - Add post_busreset hook - Remove unused 'sub' and 'act_type' in struct fw_xfer. - Remove npacket from struct fw_bulkxfer. - Don't call back handlers in fwochi_arcv() if the packet has not drained in AT queue - Make firewire works on big endian platform. - Use native endian for packet header and remove unnecessary ntohX/htonX. - Remove FWXFERQ_PACKET mode. We don't use it anymore. - Remove unnecessary restriction of FWSTMAXCHUNK. - Don't set root node for phy config packet if the root node is not cycle master capable but set myself for root node. We should be the root node after next bus reset. Spotted by: Yoshihiro Tabira <tabira@scd.mei.co.jp> - Improve self id handling Tested on: i386, sparc64 and i386 with forced bounce buffer Notes: svn path=/head/; revision=113584
* MFp4(simokawa_sbp)Hidetoshi Shimokawa2003-03-061-6/+7
| | | | | | | | | | | | | Improve if_fwe performance. - Simplify mbuf handling by using bulkxfer. Now, it uses mbuf clusters for RX buffer as usual ethernet drivers. - Recycle struct xfer buffer and don't call malloc at runtime. - Count input and output errors. - Handle a mbuf chain longer than 6 correctly. - Increase queue length. Notes: svn path=/head/; revision=111942
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-13/+10
| | | | | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) Notes: svn path=/head/; revision=111815
* Use canonical format for cdevsw initialization.Poul-Henning Kamp2003-03-021-2/+13
| | | | Notes: svn path=/head/; revision=111753
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).Dag-Erling Smørgrav2003-03-021-5/+5
| | | | Notes: svn path=/head/; revision=111748
* MFp4(simokawa_sbp branch)Hidetoshi Shimokawa2003-02-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | Improve SBP device probeing: - Wait 2 sec before issuing LOGIN ORB expecting the reconnection hold timer expires. - Serialize management ORB and scanning LUN by CAM on each target. This should fix the problem for devices which have multiple LUNs. Test device is donated by: Jaye Mathisen <mrcpu@internetcds.com> - Freeze SIM queue for 2 sec after BUS RESET. - Retry with LOGIN rather than RECONNECT after LOGIN is not completed for BUS RESET. - Use appropriate CAM status for BUS RESET and DEVICE RESET. - Let CAM to scan targets after BUS REST. - Implement CAM scan target function. - Keep our own devq freeze count. - Let CAM to know that SBP does tagged queuing. These should be merged to RELENG_4 before 4.8-RELEASE. Notes: svn path=/head/; revision=111615
* Cleanup of the d_mmap_t interface.Maxime Henrion2003-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Get rid of the useless atop() / pmap_phys_address() detour. The device mmap handlers must now give back the physical address without atop()'ing it. - Don't borrow the physical address of the mapping in the returned int. Now we properly pass a vm_offset_t * and expect it to be filled by the mmap handler when the mapping was successful. The mmap handler must now return 0 when successful, any other value is considered as an error. Previously, returning -1 was the only way to fail. This change thus accidentally fixes some devices which were bogusly returning errno constants which would have been considered as addresses by the device pager. - Garbage collect the poorly named pmap_phys_address() now that it's no longer used. - Convert all the d_mmap_t consumers to the new API. I'm still not sure wheter we need a __FreeBSD_version bump for this, since and we didn't guarantee API/ABI stability until 5.1-RELEASE. Discussed with: alc, phk, jake Reviewed by: peter Compile-tested on: LINT (i386), GENERIC (alpha and sparc64) Runtime-tested on: i386 Notes: svn path=/head/; revision=111462
* Add new ioctl to specify target EUI64 for fwmem.Hidetoshi Shimokawa2003-02-091-1/+1
| | | | Notes: svn path=/head/; revision=110582
* Remove unnecessary M_NOWAIT.Hidetoshi Shimokawa2003-02-031-4/+4
| | | | Notes: svn path=/head/; revision=110273
* - Take malloc type as an argument in fw_xfer_alloc().Hidetoshi Shimokawa2003-02-031-3/+3
| | | | | | | | | | | | - Fix overwrite problem of freed buffers. It was rare but could happen when fwohci_arcv() is called before fwohci_txd() is called for the transcation. - Drain AT queues and pend AR queues on SID receive rather than BUS reset to make sure DMA actually stops. - Do agent reset in sbp_timeout(). Notes: svn path=/head/; revision=110269
* Define new malloc type M_FW and use it.Hidetoshi Shimokawa2003-02-011-27/+27
| | | | Notes: svn path=/head/; revision=110195
* - replace timeout with callout_*.Hidetoshi Shimokawa2003-02-011-7/+3
| | | | | | | | - replace TAILQ with STAILQ for device list. - some clean up. Notes: svn path=/head/; revision=110193
* Restart cycle master after bus manager election.Hidetoshi Shimokawa2003-01-301-1/+2
| | | | | | | | | | This should fix the IR(and maybe IT) problem when the host becames the bus manager. - rename fw_noderesolve() to fw_noderesolve_eui64() and add fw_noderesolve_nodeid(). Notes: svn path=/head/; revision=110072
* - Allow multiple packets read/write for IR/IT to reduce system call.Hidetoshi Shimokawa2003-01-281-33/+43
| | | | | | | - Remove unused variables. Notes: svn path=/head/; revision=109988
* - Improve IT/IR DMA queue management.Hidetoshi Shimokawa2003-01-261-29/+12
| | | | | | | | - Improve debug message for mbuf handling. - Wait 1 sec for DMA stop in fwohci_i{t,r}x_disable() before freeing buffers. Notes: svn path=/head/; revision=109890
* Change API of FW_GDEVLST ioctl.Hidetoshi Shimokawa2003-01-251-12/+18
| | | | | | | | | - include information about itself. - define struct fw_devinfo and use it in struct fw_devlstreq. - unify EUI64 representation using struct fw_eui64. Notes: svn path=/head/; revision=109814
* Remove FW_SSTDV ioctl. It is not used anymore.Hidetoshi Shimokawa2003-01-241-2/+14
| | | | Notes: svn path=/head/; revision=109802
* Replace M_DONTWAIT with M_NOWAIT for malloc().Hidetoshi Shimokawa2003-01-171-7/+7
| | | | | | | Pointed out by: nate@root.org Notes: svn path=/head/; revision=109424
* Detect underrun of IT queue for debugging.Hidetoshi Shimokawa2003-01-171-0/+4
| | | | | | | Add some comments. Notes: svn path=/head/; revision=109403
* Improve memory allocation.Hidetoshi Shimokawa2003-01-161-2/+2
| | | | | | | | | - Don't use contigmalloc() and allocate page by page to avoid allocation failure. - allocate buffer by PAGE_SIZE. Notes: svn path=/head/; revision=109379
* Add DV_PAL for PAL users.Hidetoshi Shimokawa2003-01-151-2/+7
| | | | Notes: svn path=/head/; revision=109282
* Minimal fix for DV part.Hidetoshi Shimokawa2003-01-131-1/+8
| | | | | | | | | | | | - Don't panic on contigmalloc failure. - Calculate timestamp by feedforward rather than feedback which depends on unreliable interrupt timing. - Overwrite timestamp in CIP header correctly. - Add debug code for timestamp synchronization. - Add comments. Notes: svn path=/head/; revision=109179
* Use device_printf() and s/fc->dev/fc->bdev/.Hidetoshi Shimokawa2003-01-061-2/+2
| | | | Notes: svn path=/head/; revision=108782
* - Remove speed_map API because speed_map is obsoleted by 1394a.Hidetoshi Shimokawa2003-01-041-5/+0
| | | | | | | - Add definition of OHCI_HCC_BIBIV in fwohcireg.h. Notes: svn path=/head/; revision=108662
* fix wording.Hidetoshi Shimokawa2002-11-121-1/+1
| | | | Notes: svn path=/head/; revision=106814
* Split userland services to fwdev.c.Hidetoshi Shimokawa2002-11-121-0/+916
Notes: svn path=/head/; revision=106813