Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b828925 authored by James Morris's avatar James Morris
Browse files

Merge branch 'master' into next



Conflicts:
	security/keys/internal.h
	security/keys/process_keys.c
	security/keys/request_key.c

Fixed conflicts above by using the non 'tsk' versions.

Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parents 3a3b7ce9 58e20d8d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -290,6 +290,8 @@ powerpc/
	- directory with info on using Linux with the PowerPC.
preempt-locking.txt
	- info on locking under a preemptive kernel.
printk-formats.txt
	- how to get printk format specifiers right
prio_tree.txt
	- info on radix-priority-search-tree use for indexing vmas.
ramdisk.txt
+88 −0
Original line number Diff line number Diff line
What:		/sys/class/c2port/
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/ directory will contain files and
		directories that will provide a unified interface to
		the C2 port interface.

What:		/sys/class/c2port/c2portX
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/ directory is related to X-th
		C2 port into the system. Each directory will contain files to
		manage and control its C2 port.

What:		/sys/class/c2port/c2portX/access
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/access file enable the access
		to the C2 port from the system. No commands can be sent
		till this entry is set to 0.

What:		/sys/class/c2port/c2portX/dev_id
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/dev_id file show the device ID
		of the connected micro.

What:		/sys/class/c2port/c2portX/flash_access
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/flash_access file enable the
		access to the on-board flash of the connected micro.
		No commands can be sent till this entry is set to 0.

What:		/sys/class/c2port/c2portX/flash_block_size
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/flash_block_size file show
		the on-board flash block size of the connected micro.

What:		/sys/class/c2port/c2portX/flash_blocks_num
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/flash_blocks_num file show
		the on-board flash blocks number of the connected micro.

What:		/sys/class/c2port/c2portX/flash_data
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/flash_data file export
		the content of the on-board flash of the connected micro.

What:		/sys/class/c2port/c2portX/flash_erase
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/flash_erase file execute
		the "erase" command on the on-board flash of the connected
		micro.

What:		/sys/class/c2port/c2portX/flash_erase
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/flash_erase file show the
		on-board flash size of the connected micro.

What:		/sys/class/c2port/c2portX/reset
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/reset file execute a "reset"
		command on the connected micro.

What:		/sys/class/c2port/c2portX/rev_id
Date:		October 2008
Contact:	Rodolfo Giometti <giometti@linux.it>
Description:
		The /sys/class/c2port/c2portX/rev_id file show the revision ID
		of the connected micro.
+8 −8
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ Description:

		error - an interrupt that can't be accounted for above.

		invalid: it's either a wakeup GPE or a GPE/Fixed Event that
		invalid: it's either a GPE or a Fixed Event that
			doesn't have an event handler.

		disable: the GPE/Fixed Event is valid but disabled.
@@ -117,30 +117,30 @@ Description:
		and other user space applications so that the machine won't shutdown
		when pressing the power button.
		# cat ff_pwr_btn
		0
		0	enabled
		# press the power button for 3 times;
		# cat ff_pwr_btn
		3
		3	enabled
		# echo disable > ff_pwr_btn
		# cat ff_pwr_btn
		disable
		3	disabled
		# press the power button for 3 times;
		# cat ff_pwr_btn
		disable
		3	disabled
		# echo enable > ff_pwr_btn
		# cat ff_pwr_btn
		4
		4	enabled
		/*
		 * this is because the status bit is set even if the enable bit is cleared,
		 * and it triggers an ACPI fixed event when the enable bit is set again
		 */
		# press the power button for 3 times;
		# cat ff_pwr_btn
		7
		7	enabled
		# echo disable > ff_pwr_btn
		# press the power button for 3 times;
		# echo clear > ff_pwr_btn	/* clear the status bit */
		# echo disable > ff_pwr_btn
		# cat ff_pwr_btn
		7
		7	enabled
+148 −0
Original line number Diff line number Diff line
			ACPI Debug Output


The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug
output.  This document describes how to use this facility.

Compile-time configuration
--------------------------

ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG.  If this config
option is turned off, the debug messages are not even built into the
kernel.

Boot- and run-time configuration
--------------------------------

When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages
you're interested in.  At boot-time, use the acpi.debug_layer and
acpi.debug_level kernel command line options.  After boot, you can use the
debug_layer and debug_level files in /sys/module/acpi/parameters/ to control
the debug messages.

debug_layer (component)
-----------------------

The "debug_layer" is a mask that selects components of interest, e.g., a
specific driver or part of the ACPI interpreter.  To build the debug_layer
bitmask, look for the "#define _COMPONENT" in an ACPI source file.

You can set the debug_layer mask at boot-time using the acpi.debug_layer
command line argument, and you can change it after boot by writing values
to /sys/module/acpi/parameters/debug_layer.

The possible components are defined in include/acpi/acoutput.h and
include/acpi/acpi_drivers.h.  Reading /sys/module/acpi/parameters/debug_layer
shows the supported mask values, currently these:

    ACPI_UTILITIES                  0x00000001
    ACPI_HARDWARE                   0x00000002
    ACPI_EVENTS                     0x00000004
    ACPI_TABLES                     0x00000008
    ACPI_NAMESPACE                  0x00000010
    ACPI_PARSER                     0x00000020
    ACPI_DISPATCHER                 0x00000040
    ACPI_EXECUTER                   0x00000080
    ACPI_RESOURCES                  0x00000100
    ACPI_CA_DEBUGGER                0x00000200
    ACPI_OS_SERVICES                0x00000400
    ACPI_CA_DISASSEMBLER            0x00000800
    ACPI_COMPILER                   0x00001000
    ACPI_TOOLS                      0x00002000
    ACPI_BUS_COMPONENT              0x00010000
    ACPI_AC_COMPONENT               0x00020000
    ACPI_BATTERY_COMPONENT          0x00040000
    ACPI_BUTTON_COMPONENT           0x00080000
    ACPI_SBS_COMPONENT              0x00100000
    ACPI_FAN_COMPONENT              0x00200000
    ACPI_PCI_COMPONENT              0x00400000
    ACPI_POWER_COMPONENT            0x00800000
    ACPI_CONTAINER_COMPONENT        0x01000000
    ACPI_SYSTEM_COMPONENT           0x02000000
    ACPI_THERMAL_COMPONENT          0x04000000
    ACPI_MEMORY_DEVICE_COMPONENT    0x08000000
    ACPI_VIDEO_COMPONENT            0x10000000
    ACPI_PROCESSOR_COMPONENT        0x20000000

debug_level
-----------

The "debug_level" is a mask that selects different types of messages, e.g.,
those related to initialization, method execution, informational messages, etc.
To build debug_level, look at the level specified in an ACPI_DEBUG_PRINT()
statement.

The ACPI interpreter uses several different levels, but the Linux
ACPI core and ACPI drivers generally only use ACPI_LV_INFO.

You can set the debug_level mask at boot-time using the acpi.debug_level
command line argument, and you can change it after boot by writing values
to /sys/module/acpi/parameters/debug_level.

The possible levels are defined in include/acpi/acoutput.h.  Reading
/sys/module/acpi/parameters/debug_level shows the supported mask values,
currently these:

    ACPI_LV_INIT                    0x00000001
    ACPI_LV_DEBUG_OBJECT            0x00000002
    ACPI_LV_INFO                    0x00000004
    ACPI_LV_INIT_NAMES              0x00000020
    ACPI_LV_PARSE                   0x00000040
    ACPI_LV_LOAD                    0x00000080
    ACPI_LV_DISPATCH                0x00000100
    ACPI_LV_EXEC                    0x00000200
    ACPI_LV_NAMES                   0x00000400
    ACPI_LV_OPREGION                0x00000800
    ACPI_LV_BFIELD                  0x00001000
    ACPI_LV_TABLES                  0x00002000
    ACPI_LV_VALUES                  0x00004000
    ACPI_LV_OBJECTS                 0x00008000
    ACPI_LV_RESOURCES               0x00010000
    ACPI_LV_USER_REQUESTS           0x00020000
    ACPI_LV_PACKAGE                 0x00040000
    ACPI_LV_ALLOCATIONS             0x00100000
    ACPI_LV_FUNCTIONS               0x00200000
    ACPI_LV_OPTIMIZATIONS           0x00400000
    ACPI_LV_MUTEX                   0x01000000
    ACPI_LV_THREADS                 0x02000000
    ACPI_LV_IO                      0x04000000
    ACPI_LV_INTERRUPTS              0x08000000
    ACPI_LV_AML_DISASSEMBLE         0x10000000
    ACPI_LV_VERBOSE_INFO            0x20000000
    ACPI_LV_FULL_TABLES             0x40000000
    ACPI_LV_EVENTS                  0x80000000

Examples
--------

For example, drivers/acpi/bus.c contains this:

    #define _COMPONENT              ACPI_BUS_COMPONENT
    ...
    ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));

To turn on this message, set the ACPI_BUS_COMPONENT bit in acpi.debug_layer
and the ACPI_LV_INFO bit in acpi.debug_level.  (The ACPI_DEBUG_PRINT
statement uses ACPI_DB_INFO, which is macro based on the ACPI_LV_INFO
definition.)

Enable all AML "Debug" output (stores to the Debug object while interpreting
AML) during boot:

    acpi.debug_layer=0xffffffff acpi.debug_level=0x2

Enable PCI and PCI interrupt routing debug messages:

    acpi.debug_layer=0x400000 acpi.debug_level=0x4

Enable all ACPI hardware-related messages:

    acpi.debug_layer=0x2 acpi.debug_level=0xffffffff

Enable all ACPI_DB_INFO messages after boot:

    # echo 0x4 > /sys/module/acpi/parameters/debug_level

Show all valid component values:

    # cat /sys/module/acpi/parameters/debug_layer
+90 −0
Original line number Diff line number Diff line
			C2 port support
			---------------

(C) Copyright 2007 Rodolfo Giometti <giometti@enneenne.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.



Overview
--------

This driver implements the support for Linux of Silicon Labs (Silabs)
C2 Interface used for in-system programming of micro controllers.

By using this driver you can reprogram the in-system flash without EC2
or EC3 debug adapter. This solution is also useful in those systems
where the micro controller is connected via special GPIOs pins.

References
----------

The C2 Interface main references are at (http://www.silabs.com)
Silicon Laboratories site], see:

- AN127: FLASH Programming via the C2 Interface at
http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/Small_Form_Factor/en/an127.pdf, and

- C2 Specification at
http://www.silabs.com/public/documents/tpub_doc/spec/Microcontrollers/en/C2spec.pdf,

however it implements a two wire serial communication protocol (bit
banging) designed to enable in-system programming, debugging, and
boundary-scan testing on low pin-count Silicon Labs devices. Currently
this code supports only flash programming but extensions are easy to
add.

Using the driver
----------------

Once the driver is loaded you can use sysfs support to get C2port's
info or read/write in-system flash.

# ls /sys/class/c2port/c2port0/
access            flash_block_size  flash_erase       rev_id
dev_id            flash_blocks_num  flash_size        subsystem/
flash_access      flash_data        reset             uevent

Initially the C2port access is disabled since you hardware may have
such lines multiplexed with other devices so, to get access to the
C2port, you need the command:

# echo 1 > /sys/class/c2port/c2port0/access

after that you should read the device ID and revision ID of the
connected micro controller:

# cat /sys/class/c2port/c2port0/dev_id
8
# cat /sys/class/c2port/c2port0/rev_id
1

However, for security reasons, the in-system flash access in not
enabled yet, to do so you need the command:

# echo 1 > /sys/class/c2port/c2port0/flash_access

After that you can read the whole flash:

# cat /sys/class/c2port/c2port0/flash_data > image

erase it:

# echo 1 > /sys/class/c2port/c2port0/flash_erase

and write it:

# cat image > /sys/class/c2port/c2port0/flash_data

after writing you have to reset the device to execute the new code:

# echo 1 > /sys/class/c2port/c2port0/reset
Loading