2020-01-23 17:12:32 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2013-05-23 18:13:23 +02:00
|
|
|
|
|
|
|
/* ======== General PnP configuration functions ======= */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Controlled by the following preprocessor defines:
|
|
|
|
* PNP_ENTER_MAGIC_1ST If defined, specifies the first magic byte
|
|
|
|
* used to enter config mode.
|
|
|
|
* PNP_ENTER_MAGIC_2ND If defined, specifies the second magic byte
|
|
|
|
* used to enter config mode.
|
|
|
|
* PNP_ENTER_MAGIC_3RD If defined, specifies the third magic byte
|
|
|
|
* used to enter config mode.
|
2016-09-30 11:51:04 +02:00
|
|
|
* PNP_ENTER_MAGIC_4TH If defined, specifies the fourth magic byte
|
|
|
|
* used to enter config mode.
|
2013-05-23 18:13:23 +02:00
|
|
|
* PNP_EXIT_MAGIC_1ST If defined, specifies the first magic byte
|
|
|
|
* used to exit config mode.
|
2016-09-30 11:51:04 +02:00
|
|
|
* PNP_EXIT_SPECIAL_REG If defined, specifies a special register plus
|
|
|
|
* PNP_EXIT_SPECIAL_VAL a value to be written there to exit config mode.
|
2013-05-23 18:13:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mutex for accesses to the configuration ports (prolog and
|
|
|
|
* epilog commands are used, so synchronization is useful)
|
|
|
|
*/
|
2019-01-23 11:36:44 +01:00
|
|
|
Mutex(CONF_MODE_MUTEX, 1)
|
2013-05-23 18:13:23 +02:00
|
|
|
|
|
|
|
/*
|
2021-10-01 22:53:22 +02:00
|
|
|
* Enter configuration mode (and acquire mutex)
|
2021-02-09 14:18:19 +01:00
|
|
|
* Method must be run before accessing the configuration region.
|
2013-05-23 18:13:23 +02:00
|
|
|
* Parameter is the LDN which should be accessed. Values >= 0xFF mean
|
|
|
|
* no LDN switch should be done.
|
|
|
|
*/
|
|
|
|
Method (ENTER_CONFIG_MODE, 1)
|
|
|
|
{
|
2019-01-23 11:36:44 +01:00
|
|
|
Acquire (CONF_MODE_MUTEX, 0xFFFF)
|
2013-05-23 18:13:23 +02:00
|
|
|
#ifdef PNP_ENTER_MAGIC_1ST
|
|
|
|
Store (PNP_ENTER_MAGIC_1ST, PNP_ADDR_REG)
|
|
|
|
#ifdef PNP_ENTER_MAGIC_2ND
|
|
|
|
Store (PNP_ENTER_MAGIC_2ND, PNP_ADDR_REG)
|
|
|
|
#ifdef PNP_ENTER_MAGIC_3RD
|
|
|
|
Store (PNP_ENTER_MAGIC_3RD, PNP_ADDR_REG)
|
2016-09-30 11:51:04 +02:00
|
|
|
#ifdef PNP_ENTER_MAGIC_4TH
|
|
|
|
Store (PNP_ENTER_MAGIC_4TH, PNP_ADDR_REG)
|
|
|
|
#endif
|
2013-05-23 18:13:23 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
If (LLess(Arg0, PNP_NO_LDN_CHANGE)) {
|
|
|
|
Store(Arg0, PNP_LOGICAL_DEVICE)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Exit configuration mode (i.e. release mutex)
|
|
|
|
* Method must be run after accessing the configuration region.
|
|
|
|
*/
|
|
|
|
Method (EXIT_CONFIG_MODE)
|
|
|
|
{
|
|
|
|
#ifdef PNP_EXIT_MAGIC_1ST
|
|
|
|
Store (PNP_EXIT_MAGIC_1ST, PNP_ADDR_REG)
|
2016-09-30 11:51:04 +02:00
|
|
|
#endif
|
|
|
|
#if defined(PNP_EXIT_SPECIAL_REG) && defined(PNP_EXIT_SPECIAL_VAL)
|
|
|
|
Store (PNP_EXIT_SPECIAL_VAL, PNP_EXIT_SPECIAL_REG)
|
2013-05-23 18:13:23 +02:00
|
|
|
#endif
|
2019-01-23 11:36:44 +01:00
|
|
|
Release (CONF_MODE_MUTEX)
|
2013-05-23 18:13:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Just change the LDN. Make sure that you are in config mode (or
|
2019-01-23 11:36:44 +01:00
|
|
|
* have otherwise acquired CONF_MODE_MUTEX), when calling.
|
2013-05-23 18:13:23 +02:00
|
|
|
*/
|
|
|
|
Method (SWITCH_LDN, 1)
|
|
|
|
{
|
|
|
|
Store(Arg0, PNP_LOGICAL_DEVICE)
|
|
|
|
}
|