summaryrefslogtreecommitdiffstats
path: root/Documentation/networking/bonding.txt
AgeCommit message (Expand)Author
2018-07-16bonding: Fix a typo in bonding.txtMasanari Iida
2018-05-16Revert "bonding: allow carrier and link status to determine link state"Debabrata Banerjee
2018-05-16bonding: allow carrier and link status to determine link stateDebabrata Banerjee
2018-05-11net: doc: fix spelling mistake: "modrobe.d" -> "modprobe.d"Tonghao Zhang
2017-10-07doc: Fix typo "8023.ad" in bonding documentationAxel Beckert
2016-05-04bonding: update documentation section after dev->trans_start removalFlorian Westphal
2015-05-11bonding: Implement user key part of port_key in an AD system.Mahesh Bandewar
2015-05-11bonding: Allow userspace to set actors' macaddr in an AD-system.Mahesh Bandewar
2015-05-11bonding: Allow userspace to set actors' system_priority in AD systemMahesh Bandewar
2014-10-29tcp: allow for bigger reordering levelEric Dumazet
2014-07-17bonding: update bonding.txt for Layer2 hash factorsJianhua Xie
2014-04-24bonding: Add tlb_dynamic_lb parameter for tlb modeMahesh Bandewar
2014-04-24bonding: Added bond_tlb_xmit() for tlb mode.Mahesh Bandewar
2014-02-18bonding: document the new _arp options for arp_validateVeaceslav Falico
2014-02-18bonding: permit using arp_validate with non-ab modesVeaceslav Falico
2014-01-22bonding: update bonding.txt for primary descriptiondingtianhong
2013-12-31bonding: update Documentation/networking/bonding.txt for option lp_intervaldingtianhong
2013-11-07bonding: document the new packets_per_slave optionNikolay Aleksandrov
2013-10-03bonding: document the new xmit policy modes and update the changed onesNikolay Aleksandrov
2013-09-15bonding: Make alb learning packet interval configurableNeil Horman
2013-06-25bonding: add an option to fail when any of arp_ip_target is inaccessibleVeaceslav Falico
2013-06-25bonding: doc: some details on backup slave arp validationVeaceslav Falico
2013-05-27bonding: remove ifenslave.c from kernel sourceCong Wang
2012-08-22bonding: support for IPv6 transmit hashingJohn Eaglesham
2012-07-22net-next: minor cleanups for bonding documentationRick Jones
2012-03-30Documentation: replace install commands with softdepsLucas De Marchi
2012-03-30Documentation: remove references to /etc/modprobe.confLucas De Marchi
2011-12-26bonding: document undocumented active_slave sysfs entry.Nicolas de Pesloüan
2011-08-07bonding: document two undocumented options.Nicolas de Pesloüan
2011-08-01Documentation/bonding.txt: Update to 3.x version numbersJesper Juhl
2011-05-25bonding: documentation and code cleanup for resend_igmpFlavio Leitner
2011-04-29ipv4, ipv6, bonding: Restore control over number of peer notificationsBen Hutchings
2011-03-31Fix common misspellingsLucas De Marchi
2011-03-14bonding: documentation update: mailing lists.Nicolas de Pesloüan
2011-01-25bonding: update documentation - alternate configuration.Nicolas de Pesloüan
2010-10-05bonding: add retransmit membership reports tunableFlavio Leitner
2010-08-04Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jiko...Linus Torvalds
2010-08-04Documentation: update broken web addresses.Justin P. Mattock
2010-06-05bonding: allow user-controlled output slave selectionAndy Gospodarek
2009-10-07bonding: introduce primary_reselect optionJiri Pirko
2009-06-12trivial: Miscellaneous documentation typo fixesMatt LaPlante
2009-04-13Bonding: fix zero address hole bug in arp_ip_target listBrian Haley
2008-11-06bonding: alternate agg selection policies for 802.3adJay Vosburgh
2008-11-06bonding: send IPv6 neighbor advertisement on failoverBrian Haley
2008-11-02bonding: update docs to correctly reflect arp_ip_target behaviorAndy Gospodarek
2008-07-26Documentation cleanup: trivial misspelling, punctuation, and grammar correcti...Matt LaPlante
2008-06-18bonding: Allow setting max_bonds to zeroJay Vosburgh
2008-06-18bonding: Rework / fix multiple gratuitous ARP supportJay Vosburgh
2008-05-22bonding: Add "follow" option to fail_over_macJay Vosburgh
2008-01-28[BONDING]: Documentation updateJay Vosburgh
> 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
// SPDX-License-Identifier: GPL-2.0
/*
 * Device driver for the Apple Desktop Bus
 * and the /dev/adb device on macintoshes.
 *
 * Copyright (C) 1996 Paul Mackerras.
 *
 * Modified to declare controllers as structures, added
 * client notification of bus reset and handles PowerBook
 * sleep, by Benjamin Herrenschmidt.
 *
 * To do:
 *
 * - /sys/bus/adb to list the devices and infos
 * - more /dev/adb to allow userland to receive the
 *   flow of auto-polling datas from a given device.
 * - move bus probe to a kernel thread
 */

#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/sched/signal.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/pmu.h>
#include <linux/notifier.h>
#include <linux/wait.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/kthread.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>

#include <linux/uaccess.h>
#ifdef CONFIG_PPC
#include <asm/prom.h>
#include <asm/machdep.h>
#endif


EXPORT_SYMBOL(adb_client_list);

extern struct adb_driver via_macii_driver;
extern struct adb_driver via_cuda_driver;
extern struct adb_driver adb_iop_driver;
extern struct adb_driver via_pmu_driver;
extern struct adb_driver macio_adb_driver;

static DEFINE_MUTEX(adb_mutex);
static struct adb_driver *adb_driver_list[] = {
#ifdef CONFIG_ADB_MACII
	&via_macii_driver,
#endif
#ifdef CONFIG_ADB_CUDA
	&via_cuda_driver,
#endif
#ifdef CONFIG_ADB_IOP
	&adb_iop_driver,
#endif
#ifdef CONFIG_ADB_PMU
	&via_pmu_driver,
#endif
#ifdef CONFIG_ADB_MACIO
	&macio_adb_driver,
#endif
	NULL
};

static struct class *adb_dev_class;

static struct adb_driver *adb_controller;
BLOCKING_NOTIFIER_HEAD(adb_client_list);
static int adb_got_sleep;
static int adb_inited;
static DEFINE_SEMAPHORE(adb_probe_mutex);
static int sleepy_trackpad;
static int autopoll_devs;
int __adb_probe_sync;

static int adb_scan_bus(void);
static int do_adb_reset_bus(void);
static void adbdev_init(void);
static int try_handler_change(int, int);

static struct adb_handler {
	void (*handler)(unsigned char *, int, int);
	int original_address;
	int handler_id;
	int busy;
} adb_handler[16];

/*
 * The adb_handler_mutex mutex protects all accesses to the original_address
 * and handler_id fields of adb_handler[i] for all i, and changes to the
 * handler field.
 * Accesses to the handler field are protected by the adb_handler_lock
 * rwlock.  It is held across all calls to any handler, so that by the
 * time adb_unregister returns, we know that the old handler isn't being
 * called.
 */
static DEFINE_MUTEX(adb_handler_mutex);
static DEFINE_RWLOCK(adb_handler_lock);

#if 0
static void printADBreply(struct adb_request *req)
{
        int i;

        printk("adb reply (%d)", req->reply_len);
        for(i = 0; i < req->reply_len; i++)
                printk(" %x", req->reply[i]);
        printk("\n");

}
#endif

static int adb_scan_bus(void)
{
	int i, highFree=0, noMovement;
	int devmask = 0;
	struct adb_request req;
	
	/* assumes adb_handler[] is all zeroes at this point */
	for (i = 1; i < 16; i++) {
		/* see if there is anything at address i */
		adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
                            (i << 4) | 0xf);
		if (req.reply_len > 1)
			/* one or more devices at this address */
			adb_handler[i].original_address = i;
		else if (i > highFree)
			highFree = i;
	}

	/* Note we reset noMovement to 0 each time we move a device */
	for (noMovement = 1; noMovement < 2 && highFree > 0; noMovement++) {
		for (i = 1; i < 16; i++) {
			if (adb_handler[i].original_address == 0)
				continue;
			/*
			 * Send a "talk register 3" command to address i
			 * to provoke a collision if there is more than
			 * one device at this address.
			 */
			adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
				    (i << 4) | 0xf);
			/*
			 * Move the device(s) which didn't detect a
			 * collision to address `highFree'.  Hopefully
			 * this only moves one device.
			 */
			adb_request(&req, NULL, ADBREQ_SYNC, 3,
				    (i<< 4) | 0xb, (highFree | 0x60), 0xfe);
			/*
			 * See if anybody actually moved. This is suggested
			 * by HW TechNote 01:
			 *
			 * http://developer.apple.com/technotes/hw/hw_01.html
			 */
			adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
				    (highFree << 4) | 0xf);
			if (req.reply_len <= 1) continue;
			/*
			 * Test whether there are any device(s) left
			 * at address i.
			 */
			adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
				    (i << 4) | 0xf);
			if (req.reply_len > 1) {
				/*
				 * There are still one or more devices
				 * left at address i.  Register the one(s)
				 * we moved to `highFree', and find a new
				 * value for highFree.
				 */
				adb_handler[highFree].original_address =
					adb_handler[i].original_address;
				while (highFree > 0 &&
				       adb_handler[highFree].original_address)
					highFree--;
				if (highFree <= 0)
					break;

				noMovement = 0;
			} else {
				/*
				 * No devices left at address i; move the
				 * one(s) we moved to `highFree' back to i.
				 */
				adb_request(&req, NULL, ADBREQ_SYNC, 3,
					    (highFree << 4) | 0xb,
					    (i | 0x60), 0xfe);
			}
		}	
	}

	/* Now fill in the handler_id field of the adb_handler entries. */
	for (i =