08d5844ce1
new driver code, there are diffs to several other existing files on the system and a man page. This version of matcd implements the rest of the key ioctls related to playing audio CDs and reading table of contents information from any type of disc. This update also corrects several problems detected since the original version 1(10) was released. These include: 1. Jordons report on the kernel -c string problem. 2. A problem with the driver being confused by other types of devices located at addresses it probes. 3. An old CD TOC wouldn't always be cleared after a disc change. 4. Cleaned up code so -Wall yields no warnings on 2.0 and later. 5. A problem with drive getting out of sync with the driver when changing between CD-Data and CD-DA. There have only been two reports from the field relating to problems so either the first release isn't really being used or doesn't have many problems. If there are any problems with this submission, please let me know. Submitted by: Frank Durda IV <uhclem%nemesis@fw.ast.com>
272 lines
9.9 KiB
C
272 lines
9.9 KiB
C
/*options.h--------------------------------------------------------------------
|
|
|
|
Matsushita(Panasonic) / Creative CD-ROM Driver (matcd)
|
|
Authored by Frank Durda IV
|
|
|
|
Copyright 1994, 1995 Frank Durda IV. All rights reserved.
|
|
"FDIV" is a trademark of Frank Durda IV.
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or
|
|
without modification, are permitted provided that the following
|
|
conditions are met:
|
|
1. Redistributions of source code must retain the above copyright
|
|
notice positioned at the very beginning of this file without
|
|
modification, all copyright strings, all related programming
|
|
codes that display the copyright strings, this list of
|
|
conditions and the following disclaimer.
|
|
2. Redistributions in binary form must contain all copyright strings
|
|
and related programming code that display the copyright strings.
|
|
3. Redistributions in binary form must reproduce the above copyright
|
|
notice, this list of conditions and the following disclaimer in
|
|
the documentation and/or other materials provided with the
|
|
distribution.
|
|
4. All advertising materials mentioning features or use of this
|
|
software must display the following acknowledgement:
|
|
"The Matsushita/Panasonic CD-ROM driver was developed
|
|
by Frank Durda IV for use with "FreeBSD" and similar
|
|
operating systems."
|
|
"Similar operating systems" includes mainly non-profit oriented
|
|
systems for research and education, including but not restricted
|
|
to "NetBSD", "386BSD", and "Mach" (by CMU). The wording of the
|
|
acknowledgement (in electronic form or printed text) may not be
|
|
changed without permission from the author.
|
|
5. Absolutely no warranty of function, fitness or purpose is made
|
|
by the author Frank Durda IV.
|
|
6. Neither the name of the author nor the name "FreeBSD" may
|
|
be used to endorse or promote products derived from this software
|
|
without specific prior written permission.
|
|
(The author can be reached at bsdmail@nemesis.lonestar.org)
|
|
7. The product containing this software must meet all of these
|
|
conditions even if it is unsupported, not a complete system
|
|
and/or does not contain compiled code.
|
|
8. These conditions will be in force for the full life of the
|
|
copyright.
|
|
9. If all the above conditions are met, modifications to other
|
|
parts of this file may be freely made, although any person
|
|
or persons making changes do not receive the right to add their
|
|
name or names to the copyright strings and notices in this
|
|
software. Persons making changes are encouraged to insert edit
|
|
history in matcd.c and to put your name and details of the
|
|
change there.
|
|
10. You must have prior written permission from the author to
|
|
deviate from these terms.
|
|
|
|
Vendors who produce product(s) containing this code are encouraged
|
|
(but not required) to provide copies of the finished product(s) to
|
|
the author and to correspond with the author about development
|
|
activity relating to this code. Donations of development hardware
|
|
and/or software are also welcome. (This is one of the faster ways
|
|
to get a driver developed for a device.)
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
|
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
-----No changes are allowed above this line------------------------------------
|
|
-----------------------------------------------------------------------------
|
|
Conditional compilation flags - change to suit your system
|
|
---------------------------------------------------------------------------*/
|
|
|
|
/* AUTOHUNT Adds extra code that allows the driver to search
|
|
for interface cards rather than having to hard-code
|
|
the locations in the kernel conf file.
|
|
Leaving AUTOHUNT enabled is the recommended setting.
|
|
*/
|
|
|
|
#define AUTOHUNT
|
|
|
|
|
|
/* FULLCONFIG Allows up to four host interface boards for a
|
|
total of 16 drives. If disabled, only a single
|
|
host interface (of any type) is allowed. The
|
|
additional driver size is insignificant.
|
|
Leaving FULLCONFIG enabled is the recommended setting.
|
|
*/
|
|
|
|
#define FULLCONFIG
|
|
|
|
|
|
/* FULLDRIVER If not set, the audio, non-data functions and
|
|
some error recovery functions are eliminated from
|
|
the compiled driver. The resulting driver will be
|
|
smaller and may help a kernel fit on a boot floppy.
|
|
Leaving FULLDRIVER enabled is the recommended setting.
|
|
*/
|
|
|
|
#define FULLDRIVER
|
|
|
|
|
|
/* RESETONBOOT causes the driver to reset the drive(s) to be
|
|
reset during probing. This causes any audio
|
|
playback to be aborted and the drives will close
|
|
their trays if they are open.
|
|
Leaving RESETONBOOT enabled is the recommended setting.
|
|
*/
|
|
|
|
#define RESETONBOOT
|
|
|
|
|
|
/*<15> LOCKDRIVE If enabled, when a drive is opened using a
|
|
<15> minor number greater than 127, the drive door is
|
|
<15> locked. The drive door remains locked until all
|
|
<15> partitions on the drive are closed. The EJECT
|
|
<15> ioctl is also refused when this locking mechanism
|
|
<15> is active.
|
|
<15> The additional code size is small so enabling
|
|
<15> LOCKDRIVE is the recommended setting.
|
|
*/
|
|
|
|
#define LOCKDRIVE
|
|
|
|
|
|
/*<5> FREE2 If enabled, the changes are inserted so this
|
|
<5> module will compile in the world of FreeBSD 2.x.
|
|
<5> Without this, it is known to work in
|
|
<14> FreeBSD 1.1.5.1. FREE2 should be set automatically
|
|
<14> by using the system version compile symbol below.
|
|
<5>*/
|
|
|
|
#if __FreeBSD__ >= 2
|
|
#define FREE2 /*<5>Correct setting for 2.x*/
|
|
#endif /*__FreeBSD__*/
|
|
|
|
|
|
/*<14> KRYTEN This enables a bug that someone might consider
|
|
<14> to be a feature. If KRYTEN is enabled and you are
|
|
<14> playing audio and you issue the resume-play ioctl,
|
|
<14> the audio will stutter, playing the same quarter
|
|
<14> of a second or so of audio several times before
|
|
<14> resuming normally. Resuming from a pause acts
|
|
<14> normally regardless of the setting of this flag.
|
|
<14> Leaving KRYTEN disabled is the recommended setting.
|
|
<14>*/
|
|
|
|
/*#define KRYTEN*/
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
This structure contains the hints for where we should look for the
|
|
host adapter. If you want to change where we search or reduce the
|
|
places we search to avoid confusing some other device, either
|
|
specify explicit addresses in the kernel config file (preferred)
|
|
or change this array.
|
|
|
|
If the kernel config file has multiple ? entries, the probe routines
|
|
will use this table multiple times and will eliminate each failed
|
|
entry that probe tries.
|
|
|
|
WARNING: The number of controller entries for this driver in config
|
|
must be less than or equal to the number of hints if hints are used.
|
|
|
|
If you add entries to the table, add them immediately before
|
|
the -1 end-of-table marker. The values already present are
|
|
the ones found on standard SoundBlaster 16 and standalone cards.
|
|
---------------------------------------------------------------------------*/
|
|
|
|
#ifdef AUTOHUNT
|
|
int port_hints[]={
|
|
0x230,0x240, /*Ports SB audio boards can use*/
|
|
0x250,0x260, /*Ports standalone CD/IF board can*/
|
|
-1}; /*use. Table MUST end with -1*/
|
|
#endif /*AUTOHUNT*/
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
Debugging flags - Turn these on only if you are looking at a
|
|
problem.
|
|
---------------------------------------------------------------------------*/
|
|
|
|
/* DEBUGOPEN If enabled, debug messages for open and close
|
|
operations.
|
|
*/
|
|
|
|
/*#define DEBUGOPEN*/
|
|
|
|
|
|
/* DEBUGIO If enabled, reports on calls to strategy, start
|
|
and other I/O related functions.
|
|
*/
|
|
|
|
/*#define DEBUGIO*/
|
|
|
|
|
|
/* DEBUGQUEUE If enabled, shows activity on disk request queues.
|
|
Warning - This debug is VERY VERY NOISY and will
|
|
loop endlessly if queues are not null terminated
|
|
as they should be.
|
|
*/
|
|
|
|
/*#define DEBUGQUEUE*/
|
|
|
|
|
|
/* DEBUGCMD If enabled, shows the actual commands being issued
|
|
to the CD-ROM drives.
|
|
*/
|
|
|
|
/*#define DEBUGCMD*/
|
|
|
|
|
|
/* DEBUGSLEEP If enabled, reports on timeouts, wakeups, dropped
|
|
threads, etc.
|
|
*/
|
|
|
|
/*#define DEBUGSLEEP*/
|
|
|
|
|
|
/* DEBUGIOCTL If enabled, reports on the various ioctl-related
|
|
calls and operations. You might have to enable
|
|
DEBUGCMD as well to get enough debugging information.
|
|
*/
|
|
|
|
/*#define DEBUGIOCTL*/
|
|
|
|
|
|
/* DEBUGPROBE If enabled, reports on the process of locating
|
|
adapters and drives. The debugging in matcdprobe()
|
|
and matcdattach() routines is enabled with this
|
|
flag.
|
|
*/
|
|
|
|
/*#define DEBUGPROBE*/
|
|
|
|
|
|
/* DIAGPORT If enabled, additional code is added to send
|
|
debugging state to a debug port. This should
|
|
not be enabled in production. The value
|
|
can be set to 0x80 or 0x302, depending on what
|
|
type of debugging board you own. The global variable
|
|
diagloop is used to make looping reports on these
|
|
devices.
|
|
|
|
Some other drivers (and possibly the kernel) fiddle
|
|
with the 0x80 debug port, so it may not be usable
|
|
for isolating failures that result in a kernel panic.
|
|
The 0x302 debug board is recommended in these cases.
|
|
It also displays a word of data, so you get more
|
|
detail.
|
|
|
|
<10> It was discovered the 0x302 board was getting set
|
|
<10> into a strange state by the probes for other
|
|
<10> devices. To resolve this, the display control port
|
|
<10> (0x300) is reset in our probe and open routines.
|
|
<10> DO NOT use DIAGPORT 0x302 if an adapter is present
|
|
<10> at that address. It could ruin the EEPROM settings
|
|
<10> on the device.
|
|
*/
|
|
|
|
/*#define DIAGPORT 0x80*/
|
|
/*#define DIAGPORT 0x302*/
|
|
|
|
/*End of options.h*/
|
|
|