/*-
* Copyright (c) 1997, 1998, 1999 Nicolas Souchu
* All rights reserved.
*
* 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, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 AUTHOR OR CONTRIBUTORS 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.
*
* FreeBSD: src/sys/dev/ppbus/ppbconf.c,v 1.17.2.1 2000/05/24 00:20:57 n_hibma Exp
*
*/
/* Set up bus mode and ieee state */
ppbus->sc_mode = ppbus->ppbus_getmode(device_parent(self));
ppbus->sc_use_ieee = 1;
ppbus->sc_1284_state = PPBUS_FORWARD_IDLE;
ppbus->sc_1284_error = PPBUS_NO_ERROR;
/* Record device's successful attachment */
ppbus->sc_dev_ok = PPBUS_OK;
#ifndef DONTPROBE_1284
/* detect IEEE1284 compliant devices */
if (ppbus_scan_bus(self)) {
printf("%s: No IEEE1284 device found.\n", device_xname(self));
} else {
printf("%s: IEEE1284 device found.\n", device_xname(self));
/*
* Detect device ID (interrupts must be disabled because we
* cannot do a block to wait for it - no context)
*/
if (args.capabilities & PPBUS_HAS_INTR) {
int val = 0;
if(ppbus_write_ivar(self, PPBUS_IVAR_INTR, &val) != 0) {
printf(" <problem initializing interrupt "
"usage>");
}
}
ppbus_pnp_detect(self);
}
#endif /* !DONTPROBE_1284 */
if (!(flag & DETACH_QUIET))
printf("%s: detached.\n", device_xname(ppbus->sc_dev));
return 1;
}
/* Search for children device and add to list */
static int
ppbus_search_children(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
struct ppbus_softc *ppbus = device_private(parent);
struct ppbus_device_softc *child;
device_t dev;
int rval = 0;
if (config_probe(parent, cf, aux)) {
dev = config_attach(parent, cf, aux, NULL, CFARGS_NONE);
if (dev) {
child = device_private(dev);
SLIST_INSERT_HEAD(&(ppbus->sc_childlist_head),
child, entries);
rval = 1;
}
}