1/*- 2 * Copyright (c) 2015 M. Warner Losh <imp@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/ow/ow.c 300050 2016-05-17 12:52:31Z eadler $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33 34#include <sys/bus.h> 35#include <sys/errno.h> 36#include <sys/libkern.h> --- 301 unchanged lines hidden (view full) --- 338again: 339 probed = 0; 340 last = -1; 341 342 /* 343 * See AN397 section 5.II.C.3 for the algorithm (though a bit 344 * poorly stated). The search command forces each device to 345 * send ROM ID bits one at a time (first the bit, then the |
346 * complement) the master (us) sends back a bit. If the |
347 * device's bit doesn't match what we send back, that device 348 * stops sending bits back. So each time through we remember 349 * where we made the last decision (always 0). If there's a 350 * conflict there this time (and there will be in the absence 351 * of a hardware failure) we go with 1. This way, we prune the 352 * devices on the bus and wind up with a unique ROM. We know 353 * we're done when we detect no new conflicts. The same 354 * algorithm is used for devices in alarm state as well. --- 287 unchanged lines hidden --- |