aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/usb
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-1410-1725/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* loader: F_READ/F_WRITE should be checked against masked flagToomas Soome2017-04-181-0/+1
| | | | | | | | | | | | | | | | | | The work to make it possible to avoid bcache via using F_NORA modifier did miss the fact that not all loader platforms are using the bcache, and so it is possible the modifier is not cleared, as bcache strategy function is not used. For fix, we make sure the checks are dont with masked flag. This patch does fix boot for platforms which do not use bcache. Reported by: emaste Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10422 Notes: svn path=/head/; revision=317097
* loader: remove open_disk cacheToomas Soome2017-03-161-2/+1
| | | | | | | | | | | | | | | | | | As we provide the disk size verification and correction via disk_ioctl and disk state provided by disk_open(), we can not share the partition state in disk_devdesc structure. Also the sharing does make a lot of sense with ufs, as only one partition is open at any given time, but zfs pools do keep the disk devices open. To make sure we do get the correct information about the open device, just remove the cache. Reviewed by: allanjude, smh Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D9757 Notes: svn path=/head/; revision=315408
* loader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE.Toomas Soome2017-02-061-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Need interface to extract information about disk abstraction, to read disk or partition size depending on the provided argument and adjust disk size based on information in partition table. The disk handle from disk_open() has d_offset field to point to partition start. So we can use this fact to return either whole disk size or partition size. For this we only need to record partition size we get from disk_open() anyhow. In addition, this will also make it possible to adjust the disk media size based on information from partition table. The problem with disk size is about some BIOS systems reporting bogus disk size for 2+TB disks, but since such disks are using GPT partitioning, and GPT does have information about disk size (alternate LBA + 1), we can use this fact to record disk size based on partition table. This patch does exactly this: implements DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctl, and DIOCGMEDIASIZE will report either disk media size or partition size. Adds ptable_getsize() call to read partition size in bytes from ptable pointer. Updates disk_open() to use ptable_getsize() to update mediasize value. Implements GPT detection function to update ptable size (used by ptable_getsize()) according to alternate lba (which is location of backup copy of GPT header table). Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8594 Notes: svn path=/head/; revision=313328
* loader: disk/part api needs to use uint64_t offsetsToomas Soome2017-02-011-4/+4
| | | | | | | | | | | | | | | | | | | | The disk_* and part_* api is using 64bit values for media size and offsets. However, the current api is using off_t type, which is signed 64-bit int. In this context the signed media size does not make any sense, and the offsets are used to mark absolute, not relative locations. Also, the data from GPT partition table and some other sources is already using uint64_t data type, so using signed off_t can cause sign issues. Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D8710 Notes: svn path=/head/; revision=313047
* dosfs support in libstand is broken since r298230Toomas Soome2016-12-301-4/+3
| | | | | | | | | | | | | | | | | | | | | | Apparently the libstand dosfs optimization is a bit too optimistic and did introduce possible memory corruption. This patch is backing out the bad part and since this results in dosfs reading full blocks now, we can also remove extra offset argument from dv_strategy callback. The analysis of the issue and the backout patch is provided by Mikhail Kupchik. PR: 214423 Submitted by: Mikhail Kupchik Reported by: Mikhail Kupchik Reviewed by: bapt, allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8644 Notes: svn path=/head/; revision=310850
* lsdev device name section headers should be printed by dv_print callback.Toomas Soome2016-11-191-0/+4
| | | | | | | | | | | | | | | | | | | lsdev command does walk over devsw list, prints list element name and will use dv_print() callback to print the device list. Unfortunately this approach will add unneeded noise when there are no particular devices detected. To remove "empty" device section headers, the dv_print() callback should print the header instead. In addition, fixed dv_print callback for md module. Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D8551 Notes: svn path=/head/; revision=308827
* Loader paged/pageable data is not always paged.Toomas Soome2016-11-081-4/+7
| | | | | | | | | | | | | | | | | | | This change does modify devsw dv_print() to return the int value, enabling walkers to interrupt the walk on non zero value from dv_print(). This will allow the pager_print actually to stop displaying data on user input, and additionally pager is used in various *dev_print callbacks, where it was missing. For test, lsdev [-v] command should display data by screenfuls and should stop when the key 'q' is pressed on pager prompt. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D5461 Notes: svn path=/head/; revision=308434
* Add function needed for linking USB test application.Hans Petter Selasky2016-04-261-0/+6
| | | | Notes: svn path=/head/; revision=298647
* A new implementation of the loader block cacheAllan Jude2016-04-181-3/+4
| | | | | | | | | | | | | | | | | | | | The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713 Notes: svn path=/head/; revision=298230
* Use MAN= to specify that no man page is providedEd Maste2016-01-221-1/+1
| | | | | | | | | NO_MAN is deprecated. Reviewed by: imp Notes: svn path=/head/; revision=294608
* Add support for exynos5_ehci in loaderZbigniew Bodek2015-11-271-1/+16
| | | | | | | | | | | | | Create new driver which initializes Arndale PHY and calls ehci_init Reviewed by: hselasky Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4192 Notes: svn path=/head/; revision=291405
* Increase malloc area in loader/usbZbigniew Bodek2015-11-271-1/+4
| | | | | | | | | | | | | Previous value was not enough on Arndale platform. Reviewed by: hselasky Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4145 Notes: svn path=/head/; revision=291404
* Implement simple ops for umass_diskZbigniew Bodek2015-11-271-1/+26
| | | | | | | | | | | | | | | The initial IOCTL implementation supports reading disk physical geometry. Two additional functions were added. They allow reading/writing raw data to the disk (default partition). Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4143 Notes: svn path=/head/; revision=291402
* Do not zero memory in umass_detachZbigniew Bodek2015-11-271-0/+3
| | | | | | | | | | | | | | The detach function is called very often, for example from get_capacity function. We don't want to loose any pointers here, so disable detaching for umass driver. Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4141 Notes: svn path=/head/; revision=291401
* Use properly aligned buffer in usb_allocZbigniew Bodek2015-11-271-1/+1
| | | | | | | | | | | | | | The PA adress must be gathered from an aligned VA, not the RAW pointer to the memory space. Reviewed by: hselasky Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4140 Notes: svn path=/head/; revision=291399
* Add missing file to build.Hans Petter Selasky2015-09-141-0/+1
| | | | Notes: svn path=/head/; revision=287773
* Add new USB template to the USB bootloader module.Hans Petter Selasky2015-01-131-0/+1
| | | | Notes: svn path=/head/; revision=277134
* Add new USB phone descriptor template for USB device side mode.Hans Petter Selasky2014-08-051-0/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=269567
* Merge from CheriBSD:Brooks Davis2014-08-048-2230/+173
| | | | | | | | | | | | | | Make the sysinit tool a build tool rather than building in with /usr/bin/cc and running it from OBJDIR. (It will be moved to usr.bin once a manpage is written and a few style cleanups are done.) Split the makefile bits for Hans' kernel shim layer into their own includable kshim.mk. Move USB support into a .mk file so loaders can include it. Notes: svn path=/head/; revision=269541
* Compilation fixes.Hans Petter Selasky2014-06-061-1/+3
| | | | Notes: svn path=/head/; revision=267183
* Use own memory pool of 128K until further, hence that works the best.Hans Petter Selasky2014-05-302-2/+3
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=266894
* Resolve issue with resolving malloc() and free() functions at linking time.Hans Petter Selasky2014-05-302-10/+13
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=266887
* Export structure(s) properly.Hans Petter Selasky2014-05-301-0/+4
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=266886
* USB boot library improvements:Hans Petter Selasky2014-05-304-29/+131
| | | | | | | | | | | | - Make the USB boot library more configurable. - Resolve compile issues when cross building. - Allow use of separate malloc. - Allow use of separate endian macros. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=266882
* Add support for USB mass storage to libusbboot.Hans Petter Selasky2014-05-303-0/+321
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=266881
* Fix build after recent DWC OTG changes.Hans Petter Selasky2014-05-182-6/+24
| | | | Notes: svn path=/head/; revision=266396
* For libstand and sys/boot, split off gcc-only flags into CFLAGS.gcc.Dimitry Andric2013-12-262-2/+2
| | | | | | | | MFC after: 3 days X-MFC-With: r259730 Notes: svn path=/head/; revision=259913
* - Move scratch data from the USB bus structure to the USB device structureHans Petter Selasky2013-02-101-1/+1
| | | | | | | | | | | | | so that simultaneous access cannot happen. Protect scratch area using the enumeration lock. Also reduce stack usage in usbd_transfer_setup() by moving some big stack members to the scratch area. This saves around 200 bytes of stack. - Fix a whitespace. MFC after: 1 week Notes: svn path=/head/; revision=246616
* Correctly list the usbloader dependencies.Hans Petter Selasky2013-02-081-2/+2
| | | | Notes: svn path=/head/; revision=246571
* Add defines to more easily allow a single threaded version of the FreeBSDHans Petter Selasky2013-02-053-44/+8
| | | | | | | USB stack. This is useful for non-kernel purposes, like the loader. Notes: svn path=/head/; revision=246363
* Fix depend target.Hans Petter Selasky2013-02-051-4/+4
| | | | Notes: svn path=/head/; revision=246359
* Initial version of libusbboot, a fully stand-alone, single threaded andHans Petter Selasky2013-01-3110-0/+3295
functional compilation of the FreeBSD USB stack for use with boot loaders and such. Discussed with: Hiroki Sato, hrs @ EuroBSDCon Notes: svn path=/head/; revision=246145