227843 |
22-Nov-2011 |
marius |
- There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
|
196037 |
02-Aug-2009 |
attilio |
Make the newbus subsystem Giant free by adding the new newbus sxlock. The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races.
Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped.
For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens.
Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing.
Bump __FreeBSD_version in order to reflect the newbus lock introduction.
Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith)
|
195534 |
10-Jul-2009 |
scottl |
Separate the parallel scsi knowledge out of the core of the XPT, and modularize it so that new transports can be created.
Add a transport for SATA
Add a periph+protocol layer for ATA
Add a driver for AHCI-compliant hardware.
Add a maxio field to CAM so that drivers can advertise their max I/O capability. Modify various drivers so that they are insulated from the value of MAXPHYS.
The new ATA/SATA code supports AHCI-compliant hardware, and will override the classic ATA driver if it is loaded as a module at boot time or compiled into the kernel. The stack now support NCQ (tagged queueing) for increased performance on modern SATA drives. It also supports port multipliers.
ATA drives are accessed via 'ada' device nodes. ATAPI drives are accessed via 'cd' device nodes. They can all be enumerated and manipulated via camcontrol, just like SCSI drives. SCSI commands are not translated to their ATA equivalents; ATA native commands are used throughout the entire stack, including camcontrol. See the camcontrol manpage for further details. Testing this code may require that you update your fstab, and possibly modify your BIOS to enable AHCI functionality, if available.
This code is very experimental at the moment. The userland ABI/API has changed, so applications will need to be recompiled. It may change further in the near future. The 'ada' device name may also change as more infrastructure is completed in this project. The goal is to eventually put all CAM busses and devices until newbus, allowing for interesting topology and management options.
Few functional changes will be seen with existing SCSI/SAS/FC drivers, though the userland ABI has still changed. In the future, transports specific modules for SAS and FC may appear in order to better support the topologies and capabilities of these technologies.
The modularization of CAM and the addition of the ATA/SATA modules is meant to break CAM out of the mold of being specific to SCSI, letting it grow to be a framework for arbitrary transports and protocols. It also allows drivers to be written to support discrete hardware without jeopardizing the stability of non-related hardware. While only an AHCI driver is provided now, a Silicon Image driver is also in the works. Drivers for ICH1-4, ICH5-6, PIIX, classic IDE, and any other hardware is possible and encouraged. Help with new transports is also encouraged.
Submitted by: scottl, mav Approved by: re
|
183397 |
27-Sep-2008 |
ed |
Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere.
This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware.
Reviewed by: kib
|
182965 |
12-Sep-2008 |
sepotvin |
Make mlxcontrol work with more than one system drive: - When searching for the next system drive, return the next one instead of always returning the first one. - Plug fd lead and make sure that the MLX_NEXT_CHILD ioctl is called on the controller fd, not the disk's one.
While there, fix a cut-n-pase error in a warning.
Reviewed by: jhb Approved by: kan (mentor) MFC after: 1 month
|
125975 |
18-Feb-2004 |
phk |
Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this gave us problems when the device disappared and the users of that device were not immediately disappearing.
Now the struct disk is allocate with a new call, disk_alloc() and owned by geom_disk and just abandonned by the device driver when disk_create() is called.
Unfortunately, this results in a ton of "s/\./->/" changes to device drivers.
Since I'm doing the sweep anyway, a couple of other API improvements have been carried out at the same time:
The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to DISKFLAG_NEEDSGIANT
A version number have been added to disk_create() so that we can detect, report and ignore binary drivers with old ABI in the future.
Manual page update to follow shortly.
|
117126 |
01-Jul-2003 |
scottl |
Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg. Lockfunc allows a driver to provide a function for managing its locking semantics while using busdma. At the moment, this is used for the asynchronous busdma_swi and callback mechanism. Two lockfunc implementations are provided: busdma_lock_mutex() performs standard mutex operations on the mutex that is specified from lockfuncarg. dftl_lock() is a panic implementation and is defaulted to when NULL, NULL are passed to bus_dma_tag_create(). The only time that NULL, NULL should ever be used is when the driver ensures that bus_dmamap_load() will not be deferred. Drivers that do not provide their own locking can pass busdma_lock_mutex,&Giant args in order to preserve the former behaviour.
sparc64 and powerpc do not provide real busdma_swi functions, so this is largely a noop on those platforms. The busdma_swi on is64 is not properly locked yet, so warnings will be emitted on this platform when busdma callback deferrals happen.
If anyone gets panics or warnings from dflt_lock() being called, please let me know right away.
Reviewed by: tmm, gibbs
|
103714 |
20-Sep-2002 |
phk |
(This commit touches about 15 disk device drivers in a very consistent and predictable way, and I apologize if I have gotten it wrong anywhere, getting prior review on a patch like this is not feasible, considering the number of people involved and hardware availability etc.)
If struct disklabel is the messenger: kill the messenger.
Inside struct disk we had a struct disklabel which disk drivers used to communicate certain metrics to the disklayer above (GEOM or the disk mini-layer). This commit changes this communication to use four explicit fields instead.
Amongst the benefits is that the fields do not get overwritten by wrong or bogus on-disk disklabels.
Once that is clear, <sys/disk.h> which is included in the drivers no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in, the few places that needs them, have gotten explicit #includes for them.
The disklabel inside struct disk is now only for internal use in the disk mini-layer, so instead of embedding it, we malloc it as we need it.
This concludes (modulus any mistakes) the series of disklabel related commits.
I belive it all amounts to a NOP for all the rest of you :-)
Sponsored by: DARPA & NAI Labs.
|
103675 |
20-Sep-2002 |
phk |
Make FreeBSD "struct disklabel" agnostic, step 311 of 723:
Rename diskerr() to disk_err() for naming consistency.
Drop the by now entirely useless struct disklabel argument.
Add a flag argument for new-line termination.
Fix a couple of printf-format-casts to %j instead of %l.
Correctly print the name of all bio commands.
Move the function from subr_disklabel.c to subr_disk.c, and from <sys/disklabel.h> to <sys/disk.h>.
Use the new disk_err() throughout, #include <sys/disk.h> as needed.
Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs.
Remove unused disklabel members of softc for aac, amr and mlx, which seem to originally have been intended for diskerr() use, but which only rotted and got Copy&Pasted at least two times to many.
Sponsored by: DARPA & NAI Labs.
|
92612 |
18-Mar-2002 |
bde |
Fixed printf format errors in previous commit. %llu is no more suitable than %u for printing signed 64-bit types. It fails on different machines, and has the wrong signdness.
Fixed old printf format error on the same line. %u is not suitable for printing 32-bit types on all machines.
"Fixed" format printf error in previous commit. This file is not formatted in KNF. Partially restore bug for bug compatibility: indent the printf args too much, but don't format them for 160-column terminals.
|
59447 |
20-Apr-2000 |
msmith |
One minor bugfix:
- Free resources in all the possible attachment failure cases.
One critical bugfix:
- Fix a race where it was possible to get out of synch with the log messages from the controller, if the controller hung up for any period of time (eg. while resetting a SCSI bus). This would result in an endless string of console errors, bringing the machine to a halt.
|
59136 |
11-Apr-2000 |
msmith |
Add features required for basic userland management utility:
- implement user-initiated background drive rebuild - implement user-initiated background consistency check - log controller-initiated background rebuild/check operations
Try to fix the elusive "invalid log operation" bug, and panic if we do hit this one in the hopes of getting better information.
Tidy up diagnostic messages.
Try to use disk_create/disk_destroy correctly. This isn't working properly yet, but it's not clear whose fault that is.
|
58345 |
20-Mar-2000 |
phk |
Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set.
B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes.
Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL.
Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading.
This change is a step in the direction towards a stackable BIO capability.
A lot of this patch were machine generated (Thanks to style(9) compliance!)
Vinum users: Greg has not had time to test this yet, be careful.
|
54979 |
22-Dec-1999 |
msmith |
Updates resulting from new documentation from Mylex and some cleaning:
- Don't keep private copies of some of the data fields from the ENQUIRY and ENQUIRY2 commands. Instead, standardise on the ENQUIRY2 command for initial adapter information, and keep a copy of the entire structure. Refer to it where appropriate.
- Move all of the controller description functionality into a new function. Print lots more controller data if bootverbose is set. Add knowledge of the DAC960 PR, PT, PTL0 and PRL controllers, rename the 960PTL -> PTL0 and 1100P -> 1100PVX.
- Correctly terminate an error message.
The controller interface procedures have been reviewed against the Mylex-supplied documentation; no changes appear necessary at this time.
|
54419 |
11-Dec-1999 |
msmith |
Major update to the Mylex DAC960 driver adding new hardware support and fixing some major bugs.
- Add support for the v5 firmware interface, used by the DAC1164P (tested) and AcceleRAID 352 (untested but should work). We now cover all of the Mylex family's protocols except for v2 (used by EISA and Alpha-compatible cards).
- Fix an accounting bug which resulted in endless 'poll still busy' messages. In situations of high controller load the count of poll commands could be incremented without actually successfully launching a command. This totally removes the accounting for status poll commnads; it was its own worst enemy.
- Add some simple reentry prevention locks to processing of the waiting and completed command queues to prevent races which could result in I/O being done or completed twice (both are fatal). This highlights a need for simple locking primitives in both the UP and SMP kernels.
- Streamline the handling of command completion to reduce the amount of redundant work being done. Remove the code which tests for commands that have gone missing in action; nobody has ever seen one of these and it wouldn't have worked properly anyhow.
- Handle disconnection of drives from the controller in the detach, not shutdown method. This avoids problems flushing the cache in a panic when a drive is mounted.
- Don't call bus_generic_detach when disconnecting drives; it doesn't actually do anything useful.
- Increment the log message index regardless of whether we actually retrieved one or not. If we run into a message that we can't fetch, we don't want to spin endlessly complaining about the fact.
- Don't assume that interrupts will work when we're flushing the controller. We may think they are enabled, but in eg. a panic situation the controller may not be able to deliver an interrupt.
|
54279 |
08-Dec-1999 |
ken |
Revamp the devstat priority system. All disks now have the same priority. The same goes for CD drivers and tape drivers. In systems with mixed IDE and SCSI, devices in the same priority class will be sorted in attach order.
Also, the 'CCD' priority is now the 'ARRAY' priority, and a number of drivers have been modified to use that priority.
This includes the necessary changes to all drivers, except the ATA drivers. Soren will modify those separately.
This does not include and does not require any change in the devstat version number, since no known userland applications use the priority enumerations.
Reviewed by: msmith, sos, phk, jlemon, mjacob, bde
|
54073 |
03-Dec-1999 |
mdodd |
Remove the 'ivars' arguement to device_add_child() and device_add_child_ordered(). 'ivars' may now be set using the device_set_ivars() function.
This makes it easier for us to change how arbitrary data structures are associated with a device_t. Eventually we won't be modifying device_t to add additional pointers for ivars, softc data etc.
Despite my best efforts I've probably forgotten something so let me know if this breaks anything. I've been running with this change for months and its been quite involved actually isolating all the changes from the rest of the local changes in my tree.
Reviewed by: peter, dfr
|
52225 |
14-Oct-1999 |
msmith |
Add support for the version 4 firmware interface and the DAC960 PG and PJ cards. This will probably also support the AcceleRAID and eXtremeRAID cards, but nobody has volunteered one for testing, so I haven't enabled their PCI device IDs.
Slightly clean up communication between the disk devices and the controller device as per new practice, and move some more register- related items int mlxreg.h from mlxvar.h.
Remove some unnecessary read-modify-write operations to the card control registers; they don't behave like that.
Increase the status polling interval to 10 seconds. It's still possible to load the card up to the point where a status poll will find the previous poll still running, but this will reduce the incidence of complaints.
|