Commit Graph

120 Commits

Author SHA1 Message Date
joerg
8c5de3a623 Introduce CFATTACH_DECL_NEW and CFATTACH_DECL2_NEW for drivers that
don't expect struct device as first field of softc. device_private uses
a new field of struct device to give the softc address and that field is
either set the struct device for old-style devices or a separate
allocation by config_devalloc. Both macros are intended as temporary
bandaid until all drivers are converted and will be removed later.
2007-09-24 18:47:56 +00:00
tsutsui
92501230f2 Defer callout_startup2() (which calls softintr_establish(9)) call
after cpu_configure(9) for now because softintr(9) is initialized
in cpu_configure(9) on some ports.

Ok'ed by ad@ on current-users, and fixes hangs on m68k ports
during scsi probe.
2007-07-20 22:15:47 +00:00
dyoung
1ee8f4a418 Extract common code from i386, xen, and sparc64, creating
config_handle_wedges() and read_disk_sectors().  On x86, handle_wedges()
is a thin wrapper for config_handle_wedges().  Share opendisk()
across architectures.

Add kernel code in support of specifying a root partition by wedge
name.  E.g., root specifications "wedge:wd0a", "wedge:David's Root
Volume" are possible.  (Patches for config(1) coming soon.)

In support of moving disks between architectures (esp. i386 <->
evbmips), I've written a routine convertdisklabel() that ensures
that the raw partition is at RAW_DISK by following these steps:

        0 If we have read a disklabel that has a RAW_PART with
          p_offset == 0 and p_size != 0, then use that raw partition.

        1 If we have read a disklabel that has both partitions 'c'
          and 'd', and RAW_PART has p_offset != 0 or p_size == 0,
          but the other partition is suitable for a raw partition
          (p_offset == 0, p_size != 0), then swap the two partitions
          and use the new raw partition.

        2 If the architecture's raw partition is 'd', and if there
          is no partition 'd', but there is a partition 'c' that
          is suitable for a raw partition, then copy partition 'c'
          to partition 'd'.

        3 Determine the drive's last sector, using either the
          d_secperunit the drive reported, or by guessing (0x1fffffff).
          If we cannot read the drive's last sector, then fail.

        4 If we have read a disklabel that has no partition slot
          RAW_PART, then create a partition RAW_PART.  Make it span
          the whole drive.

        5 If there are fewer than MAXPARTITIONS partitions,
          then "slide" the unsuitable raw partition RAW_PART, and
          subsequent partitions, into partition slots RAW_PART+1
          and subsequent slots.  Create a raw partition at RAW_PART.
          Make it span the whole drive.

The convertdisklabel() procedure can probably stand to be simplified,
but it ought to deal with all but an extraordinarily broken disklabel,
now.

i386: compiled and tested, sparc64: compiled, evbmips: compiled.
2007-06-24 01:43:34 +00:00
drochner
7767c569f2 Make the attach functions for real and pseudo devices share as much code
as possible. For that, split out a function which does the allocation
of a softc (without linking it into global structures) and a function
which inserts the device into the global alldevs lists and the per-driver
cd_devs.
There is a little semantic change involved: the pseudo-device code didn't
interpret FSTATE_STAR as such, for no good reason. This looks harmless;
I'll modify driver frontends as I find ways to test.
Get config_makeroom() out of the public namespace - that's clearly an
internal of autoconf which drivers can't be allowed to deal with.
2007-03-05 20:32:43 +00:00
thorpej
712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
chs
164df76537 remove details of the kernel malloc() implementation from header files:
- change MALLOC() and FREE() to just call their function equivalents.
 - remove references to other malloc()-related constants.
2006-10-02 02:59:38 +00:00
christos
99b7478875 Initialize an uninitialized variable gcc 4 found 2006-05-14 05:26:59 +00:00
thorpej
2977973ac1 Initialize dv_properties in config_attach_pseudo(). PR kern/33438 2006-05-08 01:04:09 +00:00
thorpej
fb44a8574b Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
2006-05-05 18:04:41 +00:00
thorpej
a48de83500 Fix typo. 2006-03-29 06:25:35 +00:00
thorpej
35947a37ad Add a device_private() to return the driver's private data (softc).
For now, this just returns the passed device_t (as a void *) because
device softcs currently contain a "struct device" as the first member.
2006-03-29 06:08:16 +00:00
thorpej
78ffd948be Replace device_locators() with device_locator(), and use it. 2006-03-29 06:00:46 +00:00
thorpej
bd81f8887a Add device_is_a(), which returns true if the device is an instance
of the driver specified by name.
2006-02-23 05:48:12 +00:00
thorpej
c37edf541c Add accessor functions for the device_t type. Make device_lookup() a
real function, rather than a macro.
2006-02-19 15:01:21 +00:00
martin
f128d05a8c #if __i386__ the include of opt_splash.h for now - it is only defined
on i386.
XXX - Jared, this needs to be done differently!
2006-02-18 19:40:42 +00:00
jmcneill
e94541db3a If options SPLASHSCREEN and SPLASHSCREEN_PROGRESS are enabled, update the
animation periodically during autoconf.
2006-02-18 19:09:53 +00:00
thorpej
680d9eea68 - Don't expose dev_propdb directly -- provide devprop_*() wrappers instead.
- Rework the ARMADILLO / epe device properties interaction so that it actually
  associates the MAC address property with the epe device instance.
2006-02-18 05:04:11 +00:00
perry
a2cd732268 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
thorpej
88ac5a26bf Use new typedefs. 2005-12-20 04:39:36 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
drochner
a45a6c9839 in mapply(), call config_match() instead duplicating its code 2005-08-29 19:13:48 +00:00
drochner
f557755d9f nuke locdesc_t from orbit 2005-08-26 14:20:40 +00:00
drochner
90c378642f now that we have information about default locator values
we can implement an universal submatch() function covering all
the standard cases:
if (<configured> != <wildcard> && <configured> != <real>)
	then fail
else
	ask device match function
2005-08-25 22:17:19 +00:00
drochner
fa3cb84d62 replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
2005-08-25 18:35:38 +00:00
drochner
6036af9fc4 Replace the "locnames", attached to cfdata, which was solely good for
userconf, by more complete information (including default values) about
interface attributes, attached to the drivers which provide them.
2005-08-25 15:06:28 +00:00
drochner
0ca89e9c3a clean up duplication which was to support the old (not locator passing)
API for bus "submatch" functions
2005-06-28 18:37:34 +00:00
christos
efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
perry
da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
thorpej
45bba4e135 Change config_attach_pseudo() to take a cfdata * that contains the
necessary information to create the pseudo-device instance.  Pseudo-device
device's will reference this cfdata, just as normal devices reference
their corresponding cfdata.

Welcome to 2.99.10.
2004-10-15 04:38:36 +00:00
drochner
e66ef34b75 split out the check whether a driver supports a given interface
attribure, and add a diagnostic assertion to config_search_loc()
which ensures that a supplied attribute name is correct
2004-08-30 09:48:05 +00:00
drochner
08538dce1b Add some extensions to the autoconf framework to better support
loadable drivers and user controlled attach/detach of devices.
An outline was given in
http://mail-index.NetBSD.org/tech-kern/2004/08/11/0000.html
To cite the relevant parts:
-Add a "child detached" and a "rescan" method (both optional)
 to the device driver. (This is added to the "cfattach" for now
 because this is under the driver writer's control. Logically
 it belongs more to the "cfdriver", but this is automatically
 generated now.)
 The "child detached" is called by the autoconf framework
 during config_detach(), after the child's ca_detach()
 function was called but before the device data structure
 is freed.
 The "rescan" is called explicitely, either after a driver LKM
 was loaded, or on user request (see the "control device" below).
-Add a field to the device instance where the "locators" (in
 terms of the autoconf framework), which describe the actual
 location of the device relatively to the parent bus, can be
 stored. This can be used by the "child detached" function
 for easier bookkeeping (no need to lookup by device instance
 pointer). (An idea for the future is to use this for generation
 of optimized kernel config files - like DEC's "doconfig".)
-Pass the locators tuple describing a device's location to
 various autoconf functions to support the previous. And since
 locators do only make sense in relation to an "interface
 attribute", pass this as well.
-Add helper functions to add/remove supplemental "cfdata"
 arrays. Needed for driver LKMs.

There is some code duplication which will hopefully resolved
when all "submatch"-style functions are changed to accept the
locator argument.
Some more cleanup can take place when config(8) issues more
information about locators, in particular the length and default
values. To be done later.
2004-08-17 22:13:18 +00:00
rtr
8845b1e975 split off the evcnt code (which is unrelated to autoconfiguration)
into a separate file

approved by simonb@
2004-02-17 05:03:15 +00:00
keihan
0714799990 www.netbsd.org -> www.NetBSD.org 2003-11-17 10:07:58 +00:00
agc
aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
thorpej
3ce3399c7b Add a dev_propdb to hold device properties. Properties are already being
used in an ad hoc way by a couple of eval board ports, so might as well
tidy it up a little and add some formality.  (And, yes, I need to use it
in another eval board port.)
2003-07-04 00:24:29 +00:00
thorpej
8e8114bf55 Fix a logic botch that would cause some unwanted messages in the
AB_SILENT case.
2003-04-29 00:56:52 +00:00
matt
e86e032c61 Make cfroots const. 2003-03-16 08:09:58 +00:00
jdolecek
573bb6afc9 const msgs[] some more 2003-02-09 09:14:58 +00:00
mrg
78ccb64bb2 move #include <sys/reboot.h> with the rest of the <sys/...> headers. 2003-01-02 00:12:16 +00:00
augustss
33c067f13e Make it compile without USERCONF. 2003-01-01 17:06:59 +00:00
thorpej
0d3b1b8a4f Add support for quiet and silent boots to the autoconfiguration
message machinery.

Quiet boots look like this (inspired by BSD/OS):
.
.
Found tlp0 at pci0
.
.
Found wd0 at wdc0
.
.

Silent boots look like this:
.
.
Detecting hardware...<twiddle>done.
.
.

NOTE: This requires cooperation on the part of all device drivers,
changes to which have not yet been checked in.
2002-12-31 23:59:11 +00:00
thorpej
3d64e26035 Add an EVCNT_ATTACH_STATIC() macro which gathers static evcnts
into a link set, which are added to the list of event counters
at boot time.
2002-11-24 17:33:43 +00:00
isaki
49e7158ab9 x68k needs config_cfdriver_lookup() to initialize its console.
XXX ad-hoc way?
2002-10-20 02:26:59 +00:00
thorpej
194d7347bc Implement config_attach_pseudo(), which creates an instance of
a pseudo-device which behaves like a normal device in the device
tree, including the capability to have children.
2002-10-09 02:59:55 +00:00
thorpej
d90d300b7b Overhaul the way cfattach structures are looked up. The cfdata entry
now carries the name of the attachment (e.g. "tlp_pci" or "audio"),
and cfattach structures are registered at boot time on a per-driver
basis.  The cfdriver and cfattach pointers are cached in the device
structure when attached.
2002-10-04 01:50:53 +00:00
thorpej
2b99f7cc34 Add a generic config finalization hook, to be called once all real
devices have been discovered.  All finalizer routines are iteratively
invoked until all of them report that they have done no work.

Use this hook to fix a latent bug in RAIDframe autoconfiguration of
RAID sets exposed by the rework of SCSI device discovery.
2002-10-01 18:11:57 +00:00
thorpej
1a6b241b1d Add a config_init() function to initialize the config data structures.
Normally this is called by configure(), but some ports (amiga, atari,
x68k) need to do this early because of how they find the console.
2002-09-30 17:36:31 +00:00
thorpej
bf97c13c6c Declare all cfattach structures const. 2002-09-27 20:41:46 +00:00
provos
0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
thorpej
6ffacdd722 Oops, missed one place to use the STREQ() macro. 2002-09-27 06:30:05 +00:00