summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mv78xx0
AgeCommit message (Expand)Author
2019-08-14ARM: orion/mvebu: unify debug-ll virtual addressesArnd Bergmann
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner
2019-05-15clk: Remove io.h from clk-provider.hStephen Boyd
2018-11-23PCI: consolidate PCI config entry in drivers/pciChristoph Hellwig
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
2017-06-28ARM/PCI: Convert PCI scan API to pci_scan_root_bus_bridge()Lorenzo Pieralisi
2017-01-27ARM: mv78xx0: fix possible PCI buffer overflowArnd Bergmann
2016-09-14ARM: mv78xx0: simplify ethernet device creationArnd Bergmann
2016-08-02treewide: replace obsolete _refok by __refFabian Frederick
2016-06-03ARM: do away with ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIBLinus Walleij
2016-04-27ARM: mv78xx0: Remove CLK_IS_ROOTStephen Boyd
2016-03-20Merge tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/a...Linus Torvalds
2016-02-25ARM: mv78xx0: avoid unused function warningArnd Bergmann
2016-02-08Merge tag 'mvebu-cleanup-4.6-1' of git://git.infradead.org/linux-mvebu into n...Olof Johansson
2016-02-08ARM: drop unused Makefile.boot of Multiplatform SoCsMasahiro Yamada
2016-01-25ARM: mv78xx0: use "depends on" instead of "if" after promptMasahiro Yamada
2015-12-07ARM: mv78xx0: multiplatform supportArnd Bergmann
2015-12-07ARM: mv78xx0: clean up mach/*.h headersArnd Bergmann
2015-12-07ARM: orion: use SPARSE_IRQ everywhereArnd Bergmann
2015-12-07ARM: orion: always use MULTI_IRQ_HANDLERArnd Bergmann
2015-03-19PCI: Cleanup control flowBjorn Helgaas
2014-04-05Merge tag 'drivers-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...Linus Torvalds
2014-04-05Merge tag 'soc-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm...Linus Torvalds
2014-02-22ARM: orion: Move cache-feroceon-l2.h out of plat-orionAndrew Lunn
2014-02-22watchdog: orion: Make RSTOUT register a separate resourceEzequiel Garcia
2014-02-18Merge tag 'dropmachtimexh-v2' of git://git.pengutronix.de/git/ukl/linux into ...Olof Johansson
2013-12-20ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, tooUwe Kleine-König
2013-12-03ARM: mv78xx0: delete local <mach/gpio.h> headerLinus Walleij
2013-09-06Merge tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ar...Linus Torvalds
2013-08-25ARM: debug: move 8250 debug include into arch/arm/include/debug/Russell King
2013-08-25ARM: debug: provide 8250 debug uart phys/virt address configuration optionsRussell King
2013-08-25ARM: debug: provide 8250 debug uart register shift configuration optionRussell King
2013-08-06ARM: mv78xx0: Move to ID based window creationThomas Petazzoni
2013-07-09reboot: arm: change reboot_mode to use enum reboot_modeRobin Holt
2013-04-15arm: mach-mv78xx0: convert to use the mvebu-mbus driverThomas Petazzoni
2013-02-05Merge tag 'cleanup-decompwdog-3.9' of git://git.linaro.org/people/shawnguo/li...Olof Johansson
2013-01-14Merge branch 'clocksource/cleanup' into next/cleanupOlof Johansson
2013-01-11ARM: remove unused arch_decomp_wdog()Shawn Guo
2013-01-03ARM: drivers: remove __dev* attributes.Greg Kroah-Hartman
2012-12-24ARM: delete struct sys_timerStephen Warren
2012-10-07Merge branch 'late/fixes' into fixesOlof Johansson
2012-10-07ARM: mv78xx0: correct addr_map_cfg __initdata annotationArnd Bergmann
2012-10-07ARM: mv78xx0: mark mv78xx0_timer_init as __init_refokArnd Bergmann
2012-09-22Merge branch 'kirkwood/addr_decode' of git://git.infradead.org/users/jcooper/...Olof Johansson
2012-09-22Merge branch 'multiplatform/platform-data' into next/multiplatformOlof Johansson
2012-09-21arm: plat-orion: use void __iomem pointers for addr-map functionsThomas Petazzoni
2012-09-21arm: plat-orion: use void __iomem pointers for time functionsThomas Petazzoni
2012-09-21arm: plat-orion: use void __iomem pointers for MPP functionsThomas Petazzoni
2012-09-21arm: plat-orion: use void __iomem pointers for UART registration functionsThomas Petazzoni
2012-09-21arm: mach-mv78xx0: use IOMEM() for base address definitionsThomas Petazzoni
/a> 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 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
/* $OpenBSD$ */

/*
 * Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <sys/types.h>

#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "tmux.h"

/* Command queue flags. */
#define CMDQ_FIRED 0x1
#define CMDQ_WAITING 0x2

/* Command queue item type. */
enum cmdq_type {
	CMDQ_COMMAND,
	CMDQ_CALLBACK,
};

/* Command queue item. */
struct cmdq_item {
	char			*name;
	struct cmdq_list	*queue;
	struct cmdq_item	*next;

	struct client		*client;
	struct client		*target_client;

	enum cmdq_type		 type;
	u_int			 group;

	u_int			 number;
	time_t			 time;

	int			 flags;

	struct cmdq_state	*state;
	struct cmd_find_state	 source;
	struct cmd_find_state	 target;

	struct cmd_list		*cmdlist;
	struct cmd		*cmd;

	cmdq_cb			 cb;
	void			*data;

	TAILQ_ENTRY(cmdq_item)	 entry;
};
TAILQ_HEAD(cmdq_item_list, cmdq_item);

/*
 * Command queue state. This is the context for commands on the command queue.
 * It holds information about how the commands were fired (the key and flags),
 * any additional formats for the commands, and the current default target.
 * Multiple commands can share the same state and a command may update the
 * default target.
 */
struct cmdq_state {
	int			 references;
	int			 flags;

	struct format_tree	*formats;

	struct key_event	 event;
	struct cmd_find_state	 current;
};

/* Command queue. */
struct cmdq_list {
	struct cmdq_item	*item;
	struct cmdq_item_list	 list;
};

/* Get command queue name. */
static const char *
cmdq_name(struct client *c)
{
	static char	s[256];

	if (c == NULL)
		return ("<global>");
	if (c->name != NULL)
		xsnprintf(s, sizeof s, "<%s>", c->name);
	else
		xsnprintf(s, sizeof s, "<%p>", c);
	return (s);
}

/* Get command queue from client. */
static struct cmdq_list *
cmdq_get(struct client *c)
{
	static struct cmdq_list *global_queue;

	if (c == NULL) {
		if (global_queue == NULL)
			global_queue = cmdq_new();
		return (global_queue);
	}
	return (c->queue);
}

/* Create a queue. */
struct cmdq_list *
cmdq_new(void)
{
	struct cmdq_list	*queue;

	queue = xcalloc (1, sizeof *queue);
	TAILQ_INIT (&queue->list);
	return (queue);
}

/* Free a queue. */
void
cmdq_free(struct cmdq_list *queue)
{
	if (!TAILQ_EMPTY(&queue->list))
		fatalx("queue not empty");
	free(queue);
}

/* Get item name. */
const char *
cmdq_get_name(struct cmdq_item *item)
{
	return (item->name);
}

/* Get item client. */
struct client *
cmdq_get_client(struct cmdq_item *item)
{
	return (item->client);
}

/* Get item target client. */
struct client *
cmdq_get_target_client(struct cmdq_item *item)
{
	return (item->target_client);
}

/* Get item state. */
struct cmdq_state *
cmdq_get_state(struct cmdq_item *item)
{
	return (item->state);
}

/* Get item target. */
struct cmd_find_state *
cmdq_get_target(struct cmdq_item *item)
{
	return (&item->target);
}

/* Get item source. */
struct cmd_find_state *
cmdq_get_source(struct cmdq_item *item)
{
	return (&item->source);
}

/* Get state event. */
struct key_event *
cmdq_get_event(struct cmdq_item *item)
{
	return (&item->state->event);
}

/* Get state current target. */
struct cmd_find_state *
cmdq_get_current(struct cmdq_item *item)
{
	return (&item->state->current);
}

/* Get state flags. */
int
cmdq_get_flags(struct cmdq_item *item)
{
	return (item->state->flags);
}

/* Create a new state. */
struct cmdq_state *
cmdq_new_state(struct cmd_find_state *current, struct key_event *event,
    int flags)
{
	struct cmdq_state	*state;

	state = xcalloc(1, sizeof *state);
	state->references = 1;
	state->flags = flags;

	if (event != NULL)
		memcpy(&state->event, event, sizeof state->event);
	else
		state->event.key = KEYC_NONE;
	if (current != NULL && cmd_find_valid_state(current))
		cmd_find_copy_state(&state->current, current);
	else
		cmd_find_clear_state(&state->current, 0);

	return (state);
}

/* Add a reference to a state. */
struct cmdq_state *
cmdq_link_state(struct cmdq_state *state)
{
	state->references++;
	return (state);
}

/* Make a copy of a state. */
struct cmdq_state *
cmdq_copy_state(struct cmdq_state *state)
{
	return (cmdq_new_state(&state->current, &state->event, state->flags));
}

/* Free a state. */
void
cmdq_free_state(struct cmdq_state *state)