Skip to contentSkip to conversation

acpi_memhotplug driver is not working for me. Any ideas?

RFC PATCH New keith 3 participants 15 messages Nov 7, 2005 – Nov 18, 2005 4 messages not in the archive ACPI

lore
Share & tools
lore

keith

author
#0 lore raw

Hello,
I have recently acquired an IBM x460 to work with. The hardware is
completing it's hot add memory event just fine but the acpi code is retuning errors. (I implemented some stub functions the acpi code expects the arch to have)

My kernel is 2.6.14-get7 using x86_64...

With acpi debugging off saw the

" driver data not found"

with acpi debugging on I see

"acpi_bus-0072 [03] bus_get_device : No context for object
[ffff810037e82df0]"

(in acpi_memhotplug.c)
I run acpi_memory_get_device and fail the acpi_bus_get_device call.

The last of the acpi function call trace output is

Nov  7 13:24:57 elm3a153 kernel:  utalloc-0526 [09] ut_free_and_track     : ----Entry ffff81027a41d030
Nov  7 13:24:57 elm3a153 kernel:  utalloc-0686 [10] ut_remove_allocation  : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0794 [11] os_wait_semaphore     : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0863 [11] os_wait_semaphore     : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:      osl-0875 [11] os_signal_semaphore   : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0888 [11] os_signal_semaphore   : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:  utalloc-0723 [10] ut_remove_allocation  : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:  utalloc-0553 [09] ut_free_and_track     : ----Exit-
Nov  7 13:24:57 elm3a153 kernel: dswstate-0869 [08] ds_delete_walk_state  : ----Exit-
Nov  7 13:24:57 elm3a153 kernel:  utstate-0329 [08] ut_delete_generic_stat: ----Entry
Nov  7 13:24:57 elm3a153 kernel:  utstate-0332 [08] ut_delete_generic_stat: ----Exit-
Nov  7 13:24:57 elm3a153 kernel:  psparse-0643 [07] ps_parse_aml          : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:   pswalk-0067 [07] ps_delete_parse_tree  : ----Entry ffff810279a754e0
Nov  7 13:24:57 elm3a153 kernel:   pswalk-0096 [07] ps_delete_parse_tree  : ----Exit-
Nov  7 13:24:57 elm3a153 kernel:  psxface-0246 [06] ps_execute_pass       : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:  psxface-0155 [05] ps_execute_method     : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:  exutils-0126 [05] ex_exit_interpreter   : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0875 [06] os_signal_semaphore   : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0888 [06] os_signal_semaphore   : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:  exutils-0133 [05] ex_exit_interpreter   : ----Exit-
Nov  7 13:24:57 elm3a153 kernel:   nseval-0414 [04] ns_execute_control_met: ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:   nseval-0338 [03] ns_evaluate_by_handle : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:    evgpe-0568 [02] ev_asynch_execute_gpe_: ----Exit-
Nov  7 13:24:57 elm3a153 kernel:      osl-0633 [01] os_execute_deferred   : ----Exit-
Nov  7 13:24:57 elm3a153 kernel:      osl-0621 [01] os_execute_deferred   : ----Entry
Nov  7 13:24:57 elm3a153 kernel: acpi_bus-0461 [02] bus_notify            : ----Entry
Nov  7 13:24:57 elm3a153 kernel: acpi_bus-0062 [03] bus_get_device        : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0794 [04] os_wait_semaphore     : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0863 [04] os_wait_semaphore     : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel:      osl-0875 [04] os_signal_semaphore   : ----Entry
Nov  7 13:24:57 elm3a153 kernel:      osl-0888 [04] os_signal_semaphore   : ----Exit- AE_OK
Nov  7 13:24:57 elm3a153 kernel: acpi_bus-0072 [03] bus_get_device        : No context for object [ffff810037e82df0]
Nov  7 13:24:57 elm3a153 kernel: acpi_bus-0073 [03] bus_get_device        : ----Exit- FFFFFFFFFFFFFFED
Nov  7 13:24:57 elm3a153 kernel: acpi_bus-0464 [02] bus_notify            : ----Exit-
Nov  7 13:24:57 elm3a153 kernel:  utstate-0329 [02] ut_delete_generic_stat: ----Entry
Nov  7 13:24:57 elm3a153 kernel:  utstate-0332 [02] ut_delete_generic_stat: ----Exit-
Nov  7 13:24:57 elm3a153 kernel:      osl-0633 [01] os_execute_deferred   : ----Exit-

This is known to work in other OS's....

I am not sure where to start looking.

Signature · 9 lines
keith <kmannth-r/[email protected]>



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
author
#1 lore raw
Quoted 6 lines · keith

Hello,
I have recently acquired an IBM x460 to work with. The hardware is
completing it's hot add memory event just fine but the acpi code is retuning errors. (I implemented some stub functions the acpi code expects the arch to have)

Ok I have found out more.

The current driver is pretty complex perhaps too complex for my acpi hardware event. The current event handler calls acpi_memory_get_device which presently fails.

My event resource contains the ACPI_MEMORY_RANGE with the value of the memory range that is hot-added. It seem like I have enough information to call add_memory.

acpi_bus_get_device
acpi_get_parent
acpi_bus_get_device

are generic acpi functions that fail for my event. Can someone please explain what these are all about. (Really I don't understand the acpi API this handler was coded too.) I assume it is trying align itself to a bus and parent but there really isn't a bus in this case and I don't have any idea what the parent would be. My SSDT doesn't really layout any such relationships so I don't think the memory driver should require them.
I am working on a minimalisic event driver that works for my hardware and will hopefully post code tomorrow sometime.

Thanks,
Keith Mannthey
LTC xSeries

Signature · 9 lines
keith <kmannth-r/[email protected]>



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
author
#2 lore raw

RFC PATCH 1/1 patch to fix acpi_memhotplug.c for my hardware

Hello All,
I have troubles with the current acpi hotplug memory handler.
acpi_memory_get_device fails for me (acpi_bus_get_device fails) and the whole things falls apart. I think this may be related to the comment /* TBD: Support fixed-feature devices */ in acpi_get_bus but it is unclear to me.

My event comes a notifiy with a acpi memory range attached. It is a
single event. My hardware does not work with the current driver.

The attached patch is a simple workaround for my hardware from 2.6.14-
git7. This patch works for me. It creates the mem_device for the data attached from the present event. It is provided to start the conversation of how it is best to fix this issue.

Signed-off-by Keith Mannthey
Signature · 1 line
keith <kmannth-r/[email protected]>
drivers/acpi/acpi_memhotplug.c +20 -4
@@ -110,6 +110,21 @@
 	return_VALUE(0);
 }
 
+static struct acpi_memory_device* 
+get_mem_resource_fixup(acpi_handle handle){
+	struct acpi_memory_device *mem_tmp = NULL;
+	
+	printk ("called keiths fixup handler\n");
+	
+	mem_tmp= kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
+
+	memset(mem_tmp,0, sizeof(struct acpi_memory_device));
+	mem_tmp->handle = handle;
+	acpi_memory_get_device_resources(mem_tmp);
+	return mem_tmp;
+}
+
+
 static int
 acpi_memory_get_device(acpi_handle handle,
 		       struct acpi_memory_device **mem_device)
@@ -147,14 +159,15 @@
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
 		return_VALUE(-EINVAL);
 	}
-
       end:
 	*mem_device = acpi_driver_data(device);
+
 	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
+		/* ok this is where I end up..... 	
+		 * I am making my own memory_device
+		 */
+		*mem_device = get_mem_resource_fixup(handle);	
 	}
-
 	return_VALUE(0);
 }
 
author
#3 lore raw

PATCH 1/1 patch to fix acpi_memhotplug.c

Hello,

I am submitting this patch for inclusion in the acpi development tree.
I have not received any feedback of my beta patch or emails over the past week. I cleaned my previous patch up and made the error handling match the rest of the driver. I need this patch to support my hardware (IBM x460/x366/x445) acpi hot-add memory events.

In general acpi_bus_get_device fails for my event.
acpi_bus-0072 [04] bus_get_device : No context for object [ffff81007ff397f0]
The current driver relies on acpi_bus_get_device to create the acpi
memory_device but these call fails for my hardware.

My event is a single notify with a memory range passed along as data.
The current driver is expecting some other event or series of events (As I have posted before I am a little confused on how the current driver works at all). My code provides a way for the data that is passed along during the event to be converted directly to the memory_device without reliance on acpi_bus_get_device. My code in no way breaks the current implementation and seems a reasonable addition for increased flexibility.

This patch is against 2.6.15-rc1.

drivers/acpi/acpi_memhotplug.c +32 -4
@@ -110,6 +110,30 @@
 	return_VALUE(0);
 }
 
+static int 
+acpi_memory_get_current_resource(acpi_handle handle, struct acpi_memory_device **return_device) {
+	
+	int result;
+	struct acpi_memory_device *mem_device;
+	
+	mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
+	if (!mem_device)
+		return_VALUE(-ENOMEM);
+	memset(mem_device,0, sizeof(struct acpi_memory_device));
+
+	mem_device->handle = handle;
+	result = acpi_memory_get_device_resources(mem_device);
+	if (result) {
+		kfree(mem_device);
+		return_VALUE(result);
+	}
+	mem_device->state = MEMORY_POWER_ON_STATE;
+	*return_device = mem_device;
+	
+	return_VALUE(result);
+}
+
+
 static int
 acpi_memory_get_device(acpi_handle handle,
 		       struct acpi_memory_device **mem_device)
@@ -118,6 +142,7 @@
 	acpi_handle phandle;
 	struct acpi_device *device = NULL;
 	struct acpi_device *pdevice = NULL;
+	int result;
 
 	ACPI_FUNCTION_TRACE("acpi_memory_get_device");
 
@@ -147,14 +172,17 @@
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
 		return_VALUE(-EINVAL);
 	}
-
       end:
 	*mem_device = acpi_driver_data(device);
+
 	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
+		/* Try and get the memory_device from the current handle */
+		result = acpi_memory_get_current_resource(handle,mem_device);
+		if (result) {
+			printk(KERN_ERR "\nThere is no data for this memory device\n");
+			return_VALUE(-EINVAL);
+		}
 	}
-
 	return_VALUE(0);
 }
 
#4 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 8 lines · keith

Hello,

I am submitting this patch for inclusion in the acpi development tree.
I have not received any feedback of my beta patch or emails over the past week. I cleaned my previous patch up and made the error handling match the rest of the driver. I need this patch to support my hardware (IBM x460/x366/x445) acpi hot-add memory events.

Sorry, I missed your previous e-mail.

Quoted 5 lines

In general acpi_bus_get_device fails for my event.
acpi_bus-0072 [04] bus_get_device : No context for object [ffff81007ff397f0]
The current driver relies on acpi_bus_get_device to create the acpi
memory_device but these call fails for my hardware.

I think the case in which a device is not onlined at boot time and not -scaned- is not correctly managed. Could you try attached patch ?

-- Kame <[email protected]>

==
Fix acpi_memory_get_device().
A case of "memory object is not onlined at boot time but hot-added" is managed.

drivers/acpi/acpi_memhotplug.c +40 -21
Index: linux-2.6.14-mm1/drivers/acpi/acpi_memhotplug.c
===================================================================
@@ -77,6 +77,24 @@ struct acpi_memory_device {
 	u64 end_addr;		/* Memory Range end physical addr */
 };
 
+/* Maybe the same function in acpi_contaiener.c should be exported ..*/
+#define ACPI_STA_PRESENT                (0x00000001)
+static int is_memory_device_present(acpi_handle handle)
+{
+	acpi_status status;
+	unsigned long sta;
+	acpi_handle temp;
+	ACPI_FUNCTION_TRACE("is_memory_device_present");
+	status = acpi_get_handle(handle, "_STA", &temp);
+	if (ACPI_FAILURE(status))
+		return_VALUE(1);	/* _STA not found, assume present */
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status))
+		return_VALUE(0);
+	return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
+}
+
+
 static int
 acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
 {
@@ -112,18 +130,14 @@ acpi_memory_get_device_resources(struct
 
 static int
 acpi_memory_get_device(acpi_handle handle,
-		       struct acpi_memory_device **mem_device)
+		       struct acpi_device **device)
 {
 	acpi_status status;
 	acpi_handle phandle;
-	struct acpi_device *device = NULL;
 	struct acpi_device *pdevice = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_memory_get_device");
 
-	if (!acpi_bus_get_device(handle, &device) && device)
-		goto end;
-
 	status = acpi_get_parent(handle, &phandle);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
@@ -138,23 +152,12 @@ acpi_memory_get_device(acpi_handle handl
 		return_VALUE(-EINVAL);
 	}
 
-	/*
-	 * Now add the notified device.  This creates the acpi_device
-	 * and invokes .add function
-	 */
-	status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
+	status = acpi_bus_add(device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
 		return_VALUE(-EINVAL);
 	}
 
-      end:
-	*mem_device = acpi_driver_data(device);
-	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
-	}
-
 	return_VALUE(0);
 }
 
@@ -282,9 +285,11 @@ static void acpi_memory_device_notify(ac
 {
 	struct acpi_memory_device *mem_device;
 	struct acpi_device *device;
+	acpi_status status;
+	int present;
 
 	ACPI_FUNCTION_TRACE("acpi_memory_device_notify");
-
+	present = is_memory_device_present(handle);
 	switch (event) {
 	case ACPI_NOTIFY_BUS_CHECK:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -294,12 +299,26 @@ static void acpi_memory_device_notify(ac
 		if (event == ACPI_NOTIFY_DEVICE_CHECK)
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 					  "\nReceived DEVICE CHECK notification for device\n"));
-		if (acpi_memory_get_device(handle, &mem_device)) {
-			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+		status = acpi_bus_get_device(handle, &device);
+		if (ACPI_FAILURE(status) || !device) {
+			if (present) {
+				status = acpi_memory_get_device(handle, &device);
+				if (ACPI_FAILURE(status) || !device) {
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 					  "Error in finding driver data\n"));
+					return_VOID;
+				}
+			} else {
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					"notified handle seems not present"));
+				return_VOID;
+			}
+		}
+		mem_device = acpi_driver_data(device);
+		if (!mem_device) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "error acpi_memhotplug: device has no mem_device"));
 			return_VOID;
 		}
-
 		if (!acpi_memory_check_device(mem_device)) {
 			if (acpi_memory_enable_device(mem_device))
 				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,

Fix acpi_memory_get_device().
A case of "memory object is not onlined at boot time but hot-added" is managed.

drivers/acpi/acpi_memhotplug.c +40 -21

108 lines not on this page · raw message

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 4 lines · KAMEZAWA Hiroyuki

keith wrote:
I think the case in which a device is not onlined at boot time and not -scaned- is not correctly managed. Could you try attached patch ?

sorry ignore *attached* file (;_;
copied-in-mail patch is newer.

-- Kame

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

author
#7 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

In reply to a message not in the archive
Quoted 18 lines · KAMEZAWA Hiroyuki
Quoted 8 lines · keith

Hello,

I am submitting this patch for inclusion in the acpi development tree.
I have not received any feedback of my beta patch or emails over the past week. I cleaned my previous patch up and made the error handling match the rest of the driver. I need this patch to support my hardware (IBM x460/x366/x445) acpi hot-add memory events.

Sorry, I missed your previous e-mail.

Quoted 5 lines

In general acpi_bus_get_device fails for my event.
acpi_bus-0072 [04] bus_get_device : No context for object [ffff81007ff397f0]
The current driver relies on acpi_bus_get_device to create the acpi
memory_device but these call fails for my hardware.

Quoted 4 lines

I think the case in which a device is not onlined at boot time and not -scaned- is not correctly managed. Could you try attached patch ?

-- Kame <[email protected]>

Kame this patch will not apply to 2.6.14-mm1 or 2.6.15-rc1. Is this patch ment to be used with other patches?

My device is present at boot time (It appears in my ACPI namespace). I don't know what you mean by correctly managed.

I am not sure this patch will work for me.
Even thought you don't call acpi_bus_get_device you don't created the acpi_device. There is no path to kmalloc to create the device. In your acpi_memory_get_device how is it intended to create the acpi_device or mem_device.

See comments below...

Quoted 58 lines

==
Fix acpi_memory_get_device().
A case of "memory object is not onlined at boot time but hot-added" is managed.

Index: linux-2.6.14-mm1/drivers/acpi/acpi_memhotplug.c
===================================================================

drivers/acpi/acpi_memhotplug.c +19 -5
@@ -77,6 +77,24 @@ struct acpi_memory_device {
  	u64 end_addr;		/* Memory Range end physical addr */
  };
 
+/* Maybe the same function in acpi_contaiener.c should be exported ..*/
+#define ACPI_STA_PRESENT                (0x00000001)
+static int is_memory_device_present(acpi_handle handle)
+{
+	acpi_status status;
+	unsigned long sta;
+	acpi_handle temp;
+	ACPI_FUNCTION_TRACE("is_memory_device_present");
+	status = acpi_get_handle(handle, "_STA", &temp);
+	if (ACPI_FAILURE(status))
+		return_VALUE(1);	/* _STA not found, assume present */
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status))
+		return_VALUE(0);
+	return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
+}
+
+
  static int
  acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
  {
@@ -112,18 +130,14 @@ acpi_memory_get_device_resources(struct
 
  static int
  acpi_memory_get_device(acpi_handle handle,
-		       struct acpi_memory_device **mem_device)
+		       struct acpi_device **device)
  {
  	acpi_status status;
  	acpi_handle phandle;
-	struct acpi_device *device = NULL;
  	struct acpi_device *pdevice = NULL;
 
  	ACPI_FUNCTION_TRACE("acpi_memory_get_device");
 
-	if (!acpi_bus_get_device(handle, &device) && device)
-		goto end;
-
  	status = acpi_get_parent(handle, &phandle);
  	if (ACPI_FAILURE(status)) {
  		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));

drivers/acpi/acpi_memhotplug.c acpi_memory_get_device(acpi_handle handl · line 155

Quoted 9 lines
drivers/acpi/acpi_memhotplug.c +1 -5
@@ -138,23 +152,12 @@ acpi_memory_get_device(acpi_handle handl
  		return_VALUE(-EINVAL);
  	}
 
-	/*
-	 * Now add the notified device.  This creates the acpi_device
-	 * and invokes .add function
-	 */
-	status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
+	status = acpi_bus_add(device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);

At this point the device is a null pointer? Where is the device created you pass to acpi_bus_add?

Quoted 4 lines
drivers/acpi/acpi_memhotplug.c +0 -0
  	if (ACPI_FAILURE(status)) {
  		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
  		return_VALUE(-EINVAL);
  	}

drivers/acpi/acpi_memhotplug.c acpi_memory_get_device(acpi_handle handl · line 162

Quoted 10 lines
drivers/acpi/acpi_memhotplug.c +0 -7
 
-      end:
-	*mem_device = acpi_driver_data(device);
-	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
-	}
-
  	return_VALUE(0);
  }

Where does acpi_memory_get_device return the device via the device pointer? I don't see anywhere it is assigned....

Quoted 26 lines
drivers/acpi/acpi_memhotplug.c +9 -3
@@ -282,9 +285,11 @@ static void acpi_memory_device_notify(ac
  {
  	struct acpi_memory_device *mem_device;
  	struct acpi_device *device;
+	acpi_status status;
+	int present;
 
  	ACPI_FUNCTION_TRACE("acpi_memory_device_notify");
-
+	present = is_memory_device_present(handle);
  	switch (event) {
  	case ACPI_NOTIFY_BUS_CHECK:
  		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -294,12 +299,26 @@ static void acpi_memory_device_notify(ac
  		if (event == ACPI_NOTIFY_DEVICE_CHECK)
  			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  					  "\nReceived DEVICE CHECK notification for device\n"));
-		if (acpi_memory_get_device(handle, &mem_device)) {
-			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+		status = acpi_bus_get_device(handle, &device);
+		if (ACPI_FAILURE(status) || !device) {
+			if (present) {
+				status = acpi_memory_get_device(handle, &device);
+				if (ACPI_FAILURE(status) || !device) {
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,

drivers/acpi/acpi_memhotplug.c static void acpi_memory_device_notify(ac · line 317

Quoted 10 lines
drivers/acpi/acpi_memhotplug.c +9 -0
  					  "Error in finding driver data\n"));
+					return_VOID;
+				}
+			} else {
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					"notified handle seems not present"));
+				return_VOID;
+			}
+		}
+		mem_device = acpi_driver_data(device);

What part of the code is creating the mem_device attached to the generic acpi_device? acpi_driver_data is a simple beast that return the data field in the device. Who attaches the memory_device to the generic acpi_device?

I am not having _STA confusion. acpi_memory_get_device just dosen't return a device. I would still fall into "Error in finding driver" path.

Quoted 9 lines
drivers/acpi/acpi_memhotplug.c +2 -1
+		if (!mem_device) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "error acpi_memhotplug: device has no mem_device"));
  			return_VOID;
  		}
-
  		if (!acpi_memory_check_device(mem_device)) {
  			if (acpi_memory_enable_device(mem_device))
 

ACPI_DEBUG_PRINT((ACPI_DB_ERROR,

I don't see who this patch will create of find the correct memory_device in my situation but if you patch that applies I would me happy to try out your changes.

Thanks,
keith <kmannth-r/[email protected]>

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

#8 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 3 lines · keith

Kame this patch will not apply to 2.6.14-mm1 or 2.6.15-rc1. Is this patch ment to be used with other patches?

Hmm, I created this on 2.6.14-mm1 .. but I'll re-check my tree. sorry.

Quoted 9 lines

drivers/acpi/acpi_memhotplug.c acpi_memory_get_device_resources(struct · line 133

Quoted 9 lines

static int
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) {

drivers/acpi/acpi_memhotplug.c +1 -1
@@ -112,18 +130,14 @@ acpi_memory_get_device_resources(struct
 
 static int
 acpi_memory_get_device(acpi_handle handle,
-		       struct acpi_memory_device **mem_device)
+		       struct acpi_device **device)

here. **device. *device is filled by this func.

Quoted 10 lines

drivers/acpi/acpi_memhotplug.c acpi_memory_get_device(acpi_handle handl · line 155

Quoted 6 lines
drivers/acpi/acpi_memhotplug.c +1 -5
-	/*
-	 * Now add the notified device.  This creates the acpi_device
-	 * and invokes .add function
-	 */
-	status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
+	status = acpi_bus_add(device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);

At this point the device is a null pointer? Where is the device created you pass to acpi_bus_add?

*device is null at this point.

See:
acpi_bus_add()

    -> acpi_bus_scan()(ops.acpi_op_add = 1;)
	-> acpi_add_single_object()
	   (*)device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL);
	    -> acpi_bus_find_driver()
		-> acpi_bus_driver_init()
		   here driver->ops.add = acpi_memory_device_add,
		    -> acpi_memory_device_add()
		       (*) mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);

All necessary kmalloc is done under acpi_bus_add().
And pointer to device is returned in the first argment(struct acpi_device **). This is the same manner as acpi_processor/acpi_container.

Quoted 7 lines
Quoted 7 lines
drivers/acpi/acpi_memhotplug.c +0 -0
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
 		return_VALUE(-EINVAL);
 	}
 
Quoted 14 lines

drivers/acpi/acpi_memhotplug.c acpi_memory_get_device(acpi_handle handl · line 162

Quoted 9 lines
drivers/acpi/acpi_memhotplug.c +0 -7
-      end:
-	*mem_device = acpi_driver_data(device);
-	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
-	}
-
 	return_VALUE(0);
 }

Where does acpi_memory_get_device return the device via the device pointer? I don't see anywhere it is assigned....

1 status = acpi_bus_get_device(handle, &device);
2 if (ACPI_FAILURE(status) || !device) {
3 if (present) {
4 status = acpi_memory_get_device(handle, &device);
5 if (ACPI_FAILURE(status) || !device) {
6 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
7 "Error in finding driver data\n"));
8 return_VOID;
9 }
10 } else {
11 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
12 "notified handle seems not present"));
13 return_VOID;
14 }
15 }

in line 4 above.

Quoted 4 lines

I am not having _STA confusion. acpi_memory_get_device just dosen't return a device. I would still fall into "Error in finding driver" path.

Hmm, I'll look into more.
BTW, could you confirm following ?
(1) CONFIG_ACPI_HOTPLUG_MEMORY=y
(2) Does your memory device has type PNP0C80 ?

Thanks,
-- Kame

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

#9 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

In reply to keith

Hello, Keith-san.

Quoted 11 lines

I am submitting this patch for inclusion in the acpi development tree.
I have not received any feedback of my beta patch or emails over the past week. I cleaned my previous patch up and made the error handling match the rest of the driver. I need this patch to support my hardware (IBM x460/x366/x445) acpi hot-add memory events.

In general acpi_bus_get_device fails for my event.
acpi_bus-0072 [04] bus_get_device : No context for object [ffff81007ff397f0]
The current driver relies on acpi_bus_get_device to create the acpi
memory_device but these call fails for my hardware.

Quoted 8 lines

My event is a single notify with a memory range passed along as data.
The current driver is expecting some other event or series of events (As I have posted before I am a little confused on how the current driver works at all). My code provides a way for the data that is passed along during the event to be converted directly to the memory_device without reliance on acpi_bus_get_device. My code in no way breaks the current implementation and seems a reasonable addition for increased flexibility.

Hmm.
I have a bit similar (but contrastive) problem on our making box. In my case, physical hotplug unit is a node. So, notification of event will reach "container driver". And container driver just call struct acpi_driver ops.add via acpi_bus_scan(). And it will also call ops.start if start method is exist.

Howerver, there is no ops.start method in acpi_memhotplug.c. So, when bus is scaned by container driver add event, add_memory is not called.
Following patch is to add start method for it.

BTW, I recommend that you should add ACPI_FUNCTION_TRACE() at acpi_memory_get_current_resource() for debugging like other acpi functions.

Thanks.

--

drivers/acpi/acpi_memhotplug.c +22 -0
Index: test_acpi/drivers/acpi/acpi_memhotplug.c
===================================================================
@@ -57,6 +57,7 @@ MODULE_LICENSE("GPL");
 
 static int acpi_memory_device_add(struct acpi_device *device);
 static int acpi_memory_device_remove(struct acpi_device *device, int type);
+static int acpi_memory_device_start (struct acpi_device *device);
 
 static struct acpi_driver acpi_memory_device_driver = {
 	.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
@@ -65,6 +66,7 @@ static struct acpi_driver acpi_memory_de
 	.ops = {
 		.add = acpi_memory_device_add,
 		.remove = acpi_memory_device_remove,
+		.start = acpi_memory_device_start,
 		},
 };
 
@@ -422,6 +424,26 @@ static int acpi_memory_device_remove(str
 	return_VALUE(0);
 }
 
+static int
+acpi_memory_device_start (struct acpi_device *device)
+{
+	struct acpi_memory_device *mem_device = NULL;
+	int result = 0;
+
+	ACPI_FUNCTION_TRACE("acpi_memory_device_start");
+
+	mem_device = (struct acpi_memory_device *) acpi_driver_data(device);
+
+	if (!acpi_memory_check_device(mem_device)){
+		/* call add_memory func */
+		result = acpi_memory_enable_device(mem_device);
+		if (result)
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			"Error in acpi_memory_enable_device\n"));
+	}
+	return_VALUE(result);
+}
+
 /*
  * Helper function to check for memory device
  */
Signature · 10 lines
Yasunori Goto 




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

A message that is not in the archive (sent off-list or not yet received): 20051115171221.7E99.Y-GOTO-+CUm20s59erQFUHtdCDX3A@public.gmane.org

author
#11 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 29 lines · Yasunori Goto

Hello, Keith-san.

Quoted 11 lines

I am submitting this patch for inclusion in the acpi development tree.
I have not received any feedback of my beta patch or emails over the past week. I cleaned my previous patch up and made the error handling match the rest of the driver. I need this patch to support my hardware (IBM x460/x366/x445) acpi hot-add memory events.

In general acpi_bus_get_device fails for my event.
acpi_bus-0072 [04] bus_get_device : No context for object [ffff81007ff397f0]
The current driver relies on acpi_bus_get_device to create the acpi
memory_device but these call fails for my hardware.

Quoted 8 lines

My event is a single notify with a memory range passed along as data.
The current driver is expecting some other event or series of events (As I have posted before I am a little confused on how the current driver works at all). My code provides a way for the data that is passed along during the event to be converted directly to the memory_device without reliance on acpi_bus_get_device. My code in no way breaks the current implementation and seems a reasonable addition for increased flexibility.

Hmm.
I have a bit similar (but contrastive) problem on our making box. In my case, physical hotplug unit is a node. So, notification of event will reach "container driver". And container driver just call struct acpi_driver ops.add via acpi_bus_scan(). And it will also call ops.start if start method is exist.

Quoted 4 lines

Howerver, there is no ops.start method in acpi_memhotplug.c. So, when bus is scaned by container driver add event, add_memory is not called.
Following patch is to add start method for it.

My add event is called with my patch. The notify event is triggering and falling into the right path.

I tried your patch but my device is not making and add event. I really looks to just be a notify with the memory range attached. I really think my patch is the right way to go for my hardware.

Quoted 4 lines

BTW, I recommend that you should add at acpi_memory_get_current_resource() for debugging like other acpi functions.

Thanks. I missed that. See the updated patch.

Thanks,
Keith Mannthey
LTC xSeries

drivers/acpi/acpi_memhotplug.c +34 -4
@@ -110,6 +110,32 @@
 	return_VALUE(0);
 }
 
+static int 
+acpi_memory_get_current_resource(acpi_handle handle, struct acpi_memory_device **return_device) {
+	
+	int result;
+	struct acpi_memory_device *mem_device;
+
+	ACPI_FUNCTION_TRACE("acpi_memory_get_current_resource");
+	
+	mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
+	if (!mem_device)
+		return_VALUE(-ENOMEM);
+	memset(mem_device,0, sizeof(struct acpi_memory_device));
+
+	mem_device->handle = handle;
+	result = acpi_memory_get_device_resources(mem_device);
+	if (result) {
+		kfree(mem_device);
+		return_VALUE(result);
+	}
+	mem_device->state = MEMORY_POWER_ON_STATE;
+	*return_device = mem_device;
+	
+	return_VALUE(result);
+}
+
+
 static int
 acpi_memory_get_device(acpi_handle handle,
 		       struct acpi_memory_device **mem_device)
@@ -118,6 +144,7 @@
 	acpi_handle phandle;
 	struct acpi_device *device = NULL;
 	struct acpi_device *pdevice = NULL;
+	int result;
 
 	ACPI_FUNCTION_TRACE("acpi_memory_get_device");
 
@@ -147,14 +174,17 @@
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
 		return_VALUE(-EINVAL);
 	}
-
       end:
 	*mem_device = acpi_driver_data(device);
+
 	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
+		/* Try and get the memory_device from the current handle */
+		result = acpi_memory_get_current_resource(handle,mem_device);
+		if (result) {
+			printk(KERN_ERR "\nThere is no data for this memory device\n");
+			return_VALUE(-EINVAL);
+		}
 	}
-
 	return_VALUE(0);
 }
 
#12 lore raw

Re: Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 9 lines · keith

My add event is called with my patch. The notify event is triggering and falling into the right path.

I tried your patch but my device is not making and add event. I really looks to just be a notify with the memory range attached. I really think my patch is the right way to go for my hardware.

Could you show your AML tree around Memory ?
I'm interested in.

if (!(*mem_device)) {
- printk(KERN_ERR "\n driver data not found");
- return_VALUE(-ENODEV);
+ /* Try and get the memory_device from the current handle */
+ result = acpi_memory_get_current_resource(handle,mem_device);
+ if (result) {
+ printk(KERN_ERR "\nThere is no data for this memory device\n");
+ return_VALUE(-EINVAL);
+ }
}
I'm not sure why this is *right* way.

This is traditinal way to attach driver data to device. ==
acpi_bus_add() ->

	acpi_add_single_object() ->  ----------------(*) acpi_device is create here.
		acpi_bus_find_driver()->
			acpi_bus_driver_init()->
				driver->ops.add()

==

Maybe driver->ops.add is not called for some reason. What happens in acpi_add_single_object() in your environment ? acpi_bus_find_driver() is called ?

-- Kame

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#14 lore raw

Re: Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 11 lines · KAMEZAWA Hiroyuki
Quoted 9 lines · keith

My add event is called with my patch. The notify event is triggering and falling into the right path.

I tried your patch but my device is not making and add event. I really looks to just be a notify with the memory range attached. I really think my patch is the right way to go for my hardware.

Could you show your AML tree around Memory ?

See attached SSDT.

Quoted 12 lines

I'm interested in.

  	if (!(*mem_device)) {
drivers/acpi/acpi_memhotplug.c +6 -2
-		printk(KERN_ERR "\n driver data not found");
-		return_VALUE(-ENODEV);
+		/* Try and get the memory_device from the current handle */
+		result = acpi_memory_get_current_resource(handle,mem_device);
+		if (result) {
+			printk(KERN_ERR "\nThere is no data for this memory device\n");
+			return_VALUE(-EINVAL);
+		}
  	}
Quoted 1 line

I'm not sure why this is *right* way.

I am not sure either but the current code just dosen't work for my event.

Quoted 7 lines

This is traditinal way to attach driver data to device. ==
acpi_bus_add() ->

	acpi_add_single_object() ->  ----------------(*) acpi_device is create here.
		acpi_bus_find_driver()->
			acpi_bus_driver_init()->
				driver->ops.add()

The above is not working for my event.

The current code is

Quoted 1 line
Quoted 1 line

detect if the mem_device is already attached. This call fails for me and I goto end.

       if (!acpi_bus_get_device(handle, &device) && device)
                goto end;
Quoted 1 line
Quoted 1 line

If I skip the above by commentting out and just run (isn't the logic backwards anyway?)

        status = acpi_get_parent(handle, &phandle);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
                return_VALUE(-EINVAL);
        }

        /* Get the parent device */
        status = acpi_bus_get_device(phandle, &pdevice);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "Error in acpi_bus_get_device\n"));
                return_VALUE(-EINVAL);
        }

        /*
         * Now add the notified device.  This creates the acpi_device
         * and invokes .add function
         */
        status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
                return_VALUE(-EINVAL);
        }
Quoted 3 lines
Quoted 3 lines

acpi_get_parent acpi_bug_get_device and acpi_bus_add all pass and do not report any failures. But when I check for the mem_device it is not there.

	*mem_device = acpi_driver_data(device);
        if (!(*mem_device)) {
                printk(KERN_ERR "\n driver data not found");
                return_VALUE(-ENODEV);
        }
Quoted 3 lines
Quoted 3 lines

I sill fall into the error and the call fails and I see " driver data not foundacpi_memory-0305 [02] memory_device_notify : Error in finding driver data""

acpi_bus_add while retuning success is not correctly attaching a formed memory_device to my generic acpi_device as the api would seem to indicate. Perhaps the generic code is broken?

Quoted 3 lines

Maybe driver->ops.add is not called for some reason. What happens in () in your environment ? acpi_bus_find_driver() is called ?

Well I can tell you I never see the

printk(KERN_INFO "%s \n", acpi_device_name(device));

from acpi_memory_device_add when I call acpi_bus_add. I am really trying not to dig around in the acpi generic code..... I might have time to have a look at the generic acpi code tomorrow....

Is this driver know to work on any hardware?

Thanks for your feedback.

Signature · 1 line
keith <kmannth-r/[email protected]>

/*
* Intel ACPI Component Architecture
* AML Disassembler version 20050902
*
* Disassembly of SSDT.aml, Thu Nov 17 18:14:58 2005 */
DefinitionBlock ("SSDT.aml", "SSDT", 1, "IBM ", "VIGSSDT0", 4096)

{
    /*
     * These objects were referenced but not defined in this table
     */
    External (VP00, DeviceObj)

    Scope (\)
    {
    }

    Scope (\_PR)
    {
        Processor (CP00, 0x00, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP01, 0x01, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP02, 0x02, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP03, 0x03, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP04, 0x04, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP05, 0x05, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP06, 0x06, 0x00000000, 0x00) {}
    }

    Scope (\_PR)
    {
        Processor (CP07, 0x07, 0x00000000, 0x00) {}
    }

    Scope (\)
    {
    }

    Scope (\_SB)
    {
        Device (ME00)
        {
            Name (_HID, EisaId ("PNP0C80"))
            Name (_CID, 0x010CD041)
            Name (_UID, 0x00)
            Name (BADH, 0x00000000)
            Name (BADL, 0x00100000)
            Name (EADH, 0x00000004)
            Name (EADL, 0x80000000)
            Name (MEID, 0x00000001)
            Name (VC00, 0xFDE86000)
            OperationRegion (CY00, SystemMemory, VC00, 0x8000)
            Field (CY00, DWordAcc, NoLock, Preserve)
            {
                Offset (0x150), 
                    ,   26, 
                PMIO,   6, 
                Offset (0x3600), 
                XTP0,   32, 
                XTP1,   32, 
                XTP2,   32, 
                XTP3,   32, 
                XTP4,   32, 
                XTP5,   32, 
                XTP6,   32, 
                XTP7,   32, 
                XTP8,   32, 
                XTP9,   32, 
                XTPA,   32, 
                XTPB,   32, 
                Offset (0x5040), 
                MSZ0,   9, 
                Offset (0x5050), 
                    ,   28, 
                BCRD,   1, 
                CSTE,   1, 
                Offset (0x5098), 
                Offset (0x509C), 
                MMP0,   1, 
                MMP1,   1, 
                MMP2,   1, 
                MMP3,   1, 
                Offset (0x5140), 
                MSZ1,   9, 
                Offset (0x5240), 
                MSZ2,   9, 
                Offset (0x5340), 
                MSZ3,   9
            }

            Name (INIC, 0x00)
            Method (_INI, 0, NotSerialized)
            {
                If (LNot (INIC))
                {
                    Increment (INIC)
                    If (LNot (LEqual (And (XTP0, 0xFF), 0x81)))
                    {
                        And (XTP0, 0xFFFFFFF0, XTP0)
                        And (XTP1, 0xFFFFFFF0, XTP1)
                        And (XTP2, 0xFFFFFFF0, XTP2)
                        And (XTP3, 0xFFFFFFF0, XTP3)
                        And (XTP4, 0xFFFFFFF0, XTP4)
                        And (XTP5, 0xFFFFFFF0, XTP5)
                        And (XTP6, 0xFFFFFFF0, XTP6)
                        And (XTP7, 0xFFFFFFF0, XTP7)
                        And (XTP8, 0xFFFFFFF0, XTP8)
                        And (XTP9, 0xFFFFFFF0, XTP9)
                        And (XTPA, 0xFFFFFFF0, XTPA)
                        And (XTPB, 0xFFFFFFF0, XTPB)
                    }
                }
            }

            Name (ME1S, 0x00)
            Method (_CRS, 0, NotSerialized)
            {
                Store (\_SB.ECRS, BADH)
                BADL
                EADH
                EADL
                PMIO
                Local0
                Return (Local0)
            }

            Method (_STA, 0, NotSerialized)
            {
                If (CondRefOf (_OSI, Local0))
                {
                    If (\_OSI ("Windows 2001"))
                    {
                        If (LAnd (LEqual (BADH, EADH), LEqual (BADL, EADL)))
                        {
                            Or (MEID, \_SB.MEMI, \_SB.MEMI)
                            Return (0x00)
                        }
                        Else
                        {
                            And (Not (MEID), \_SB.MEMI, \_SB.MEMI)
                            Return (0x0F)
                        }
                    }
                }

                Return (0x00)
            }

            Method (UPDT, 2, NotSerialized)
            {
                If (\_SB.N2GC)
                {
                    EADH
                    EADL
                    Arg0
                    Arg1
                    Store (Arg0, EADH)
                    Store (Arg1, EADL)
                    Store (0x0F, ME1S)
                    Return (0x01)
                }

                Return (0x00)
            }

            Method (MINT, 0, NotSerialized)
            {
                Store (EADH, Local0)
                Store (EADL, Local1)
                Store (0x00, Local2)
                If (CSTE)
                {
                    If (BCRD)
                    {
                        If (LNot (LAnd (MMP0, MMP2)))
                        {
                            Add (MSZ0, MSZ2, Local2)
                        }
                    }
                    Else
                    {
                        If (LNot (LAnd (MMP1, MMP3)))
                        {
                            Add (MSZ1, MSZ3, Local2)
                        }
                    }

                    If (Local2)
                    {
                        Add (Local0, ShiftRight (Local2, 0x03), Local0)
                        Add (Local1, ShiftLeft (Local2, 0x1D, Local2), Local1)
                        If (LGreater (EADL, Local1))
                        {
                            Increment (Local0)
                        }

                        If (UPDT (Local0, Local1))
                        {
                            ^^ME01.RSET (Local0, Local1)
                            Notify (ME00, 0x01)
                        }
                    }
                }
            }
        }

        Device (ME01)
        {
            Name (_HID, EisaId ("PNP0C80"))
            Name (_CID, 0x010CD041)
            Name (_UID, 0x01)
            Name (BADH, 0x00000004)
            Name (BADL, 0x80000000)
            Name (EADH, 0x00000004)
            Name (EADL, 0x80000000)
            Name (MEID, 0x00000002)
            Name (ME1S, 0x00)
            Method (_CRS, 0, NotSerialized)
            {
                Store (\_SB.ECRS, BADH)
                BADL
                EADH
                EADL
                ^^ME00.PMIO
                Local0
                Return (Local0)
            }

            Method (_STA, 0, NotSerialized)
            {
                If (CondRefOf (_OSI, Local0))
                {
                    If (\_OSI ("Windows 2001"))
                    {
                        If (LAnd (LEqual (BADH, EADH), LEqual (BADL, EADL)))
                        {
                            Or (MEID, \_SB.MEMI, \_SB.MEMI)
                            Return (0x00)
                        }
                        Else
                        {
                            And (Not (MEID), \_SB.MEMI, \_SB.MEMI)
                            Return (0x0F)
                        }
                    }
                }

                Return (0x00)
            }

            Method (RSET, 2, NotSerialized)
            {
                Store (Arg0, BADH)
                Store (Arg1, BADL)
                Store (Arg0, EADH)
                Store (Arg1, EADL)
            }

            Method (UPDT, 2, NotSerialized)
            {
                If (\_SB.N2GC)
                {
                    EADH
                    EADL
                    Arg0
                    Arg1
                    Store (Arg0, EADH)
                    Store (Arg1, EADL)
                    Store (0x0F, ME1S)
                    Return (0x01)
                }

                Return (0x00)
            }

            Method (MINT, 0, NotSerialized)
            {
                Store (EADH, Local0)
                Store (EADL, Local1)
                Store (0x00, Local2)
                If (^^ME00.CSTE)
                {
                    If (^^ME00.BCRD)
                    {
                        If (LNot (LAnd (^^ME00.MMP0, ^^ME00.MMP2)))
                        {
                            Add (^^ME00.MSZ0, ^^ME00.MSZ2, Local2)
                        }
                    }
                    Else
                    {
                        If (LNot (LAnd (^^ME00.MMP1, ^^ME00.MMP3)))
                        {
                            Add (^^ME00.MSZ1, ^^ME00.MSZ3, Local2)
                        }
                    }

                    If (Local2)
                    {
                        Add (Local0, ShiftRight (Local2, 0x03), Local0)
                        Add (Local1, ShiftLeft (Local2, 0x1D, Local2), Local1)
                        If (LGreater (EADL, Local1))
                        {
                            Increment (Local0)
                        }

                        If (UPDT (Local0, Local1))
                        {
                            Notify (ME01, 0x01)
                        }
                    }
                }
            }
        }
    }

    Scope (\_SB)
    {
        Name (VW00, 0xFDA00000)
        Name (VW01, 0xFDB00000)
        Name (VND0, 0x00)
        Name (PAD0, 0xDCFE)
        Scope (VP00)
        {
            Name (XHID, 0x030AD041)
            Name (UIDC, 0xFF)
            Method (XUID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x00, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (XBBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (XADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW00, 0x4000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW00, 0x8000), 0x1000)
            OperationRegion (CALR, SystemMemory, VW00, 0x1000)
            Field (CALR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x778), 
                CNMR,   32
            }

            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW00, 0x8000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    If (VND0)
                    {
                        Or (CNMR, 0x80000000, CNMR)
                    }

                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP01)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x01, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW00, 0x5000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW00, 0x9000), 0x1000)
            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW00, 0x9000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP02)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x02, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW00, 0x6000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW00, 0xA000), 0x1000)
            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW00, 0xA000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP03)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x03, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW00, 0x7000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW00, 0xB000), 0x1000)
            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW00, 0xB000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP04)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x04, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW01, 0x4000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW01, 0x8000), 0x1000)
            OperationRegion (CALR, SystemMemory, VW01, 0x1000)
            Field (CALR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x778), 
                CNMR,   32
            }

            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW01, 0x8000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    If (VND0)
                    {
                        Or (CNMR, 0x80000000, CNMR)
                    }

                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP05)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x05, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW01, 0x5000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW01, 0x9000), 0x1000)
            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW01, 0x9000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP06)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x06, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW01, 0x6000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW01, 0xA000), 0x1000)
            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW01, 0xA000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }

        Device (VP07)
        {
            Name (_HID, EisaId ("PNP0A03"))
            Name (UIDC, 0xFF)
            Method (_UID, 0, NotSerialized)
            {
                If (LEqual (UIDC, 0xFF))
                {
                    ShiftLeft (VND0, 0x04, UIDC)
                    Add (UIDC, 0x07, UIDC)
                }

                Return (UIDC)
            }

            Name (BBNC, 0xFF)
            Method (_BBN, 0, NotSerialized)
            {
                If (LEqual (BBNC, 0xFF))
                {
                    Store (BBN0, BBNC)
                }

                Return (BBNC)
            }

            Name (_ADR, 0x00)
            OperationRegion (DBGR, SystemMemory, Add (VW01, 0x7000), 0x1000)
            OperationRegion (PHBR, SystemMemory, Add (VW01, 0xB000), 0x1000)
            Field (DBGR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x10), 
                P0DS,   32, 
                Offset (0x20), 
                MLT0,   8, 
                BBN0,   8, 
                SBN0,   8, 
                Offset (0xF8), 
                P0SR,   32, 
                Offset (0x160), 
                P0MR,   32, 
                Offset (0x298), 
                C0MR,   32
            }

            Field (PHBR, DWordAcc, NoLock, Preserve)
            {
                Offset (0x110), 
                C0SR,   32, 
                Offset (0x160), 
                P0CF,   32, 
                Offset (0x170), 
                I0BA,   32, 
                Offset (0x190), 
                M0L1,   32, 
                Offset (0x1A0), 
                M0H1,   32, 
                Offset (0x1B0), 
                I0SZ,   32, 
                Offset (0x1C0), 
                M0S1,   32, 
                Offset (0x2B0), 
                M0L2,   32, 
                Offset (0x2C0), 
                M0H2,   32, 
                Offset (0x2E0), 
                M0S2,   32, 
                Offset (0x880), 
                M0MD,   32
            }

            Name (CRSR, Buffer (SizeOf (CRST)) {})
            Name (PCKG, Package (0x0B)
            {
                0xFF, 
                0xFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF, 
                0xFFFFFFFF
            })
            Name (INIC, 0x00)
            Method (_INI, 0, Serialized)
            {
                If (INIC) {}
                Else
                {
                    Increment (INIC)
                    Store (0x00, Local0)
                    Store (BBN0, Index (PCKG, 0x00))
                    Store (SBN0, Index (PCKG, 0x01))
                    Store (I0BA, Index (PCKG, 0x02))
                    Store (I0SZ, Index (PCKG, 0x03))
                    Store (M0L1, Index (PCKG, 0x04))
                    Store (M0S1, Index (PCKG, 0x05))
                    Store (P0CF, Index (PCKG, 0x06))
                    Store (M0L2, Index (PCKG, 0x07))
                    Store (M0S2, Index (PCKG, 0x08))
                    Store (Add (VW01, 0xB000), Index (PCKG, 0x09))
                    Store (Local0, Index (PCKG, 0x0A))
                    Store (ICRS, PCKG)
                    CRSR
                    INIH ()
                    Store (C0MR, ENGC)
                    Store (P0MR, ENGP)
                }
            }

            Method (_CRS, 0, NotSerialized)
            {
                Return (CRSR)
            }

            Name (_HPP, Package (0x04)
            {
                0x10, 
                0x64, 
                0x01, 
                0x01
            })
            Name (ENGC, 0x00)
            Name (ENGP, 0x00)
            Name (DBGC, 0x00)
            Name (DBGP, 0x00)
            Name (DBGD, 0x00)
            Method (WRK0, 0, NotSerialized)
            {
            }

            Method (WRK1, 0, NotSerialized)
            {
            }
        }
    }

    Scope (\_SB.VP00)
    {
        Name (API0, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000010
            }, 

            Package (0x04)
            {
                0x0003FFFF, 
                0x00, 
                0x00, 
                0x00000014
            }, 

            Package (0x04)
            {
                0x0003FFFF, 
                0x01, 
                0x00, 
                0x00000014
            }, 

            Package (0x04)
            {
                0x0003FFFF, 
                0x02, 
                0x00, 
                0x00000014
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x60, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP01)
    {
        Name (API1, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000018
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x0000001C
            }, 

            Package (0x04)
            {
                0x0002FFFF, 
                0x00, 
                0x00, 
                0x00000019
            }, 

            Package (0x04)
            {
                0x0002FFFF, 
                0x01, 
                0x00, 
                0x0000001D
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x61, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP02)
    {
        Name (API2, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000012
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x00000016
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                0x00, 
                0x0000001A
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                0x00, 
                0x0000001E
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x62, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP03)
    {
        Name (API3, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000013
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x00000017
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                0x00, 
                0x0000001B
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                0x00, 
                0x0000001F
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x62, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP04)
    {
        Name (API4, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000033
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x00000037
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                0x00, 
                0x0000003B
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                0x00, 
                0x0000003F
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x62, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP05)
    {
        Name (API5, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000034
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x00000038
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                0x00, 
                0x0000003C
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                0x00, 
                0x00000040
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x62, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP06)
    {
        Name (API6, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000035
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x00000039
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                0x00, 
                0x0000003D
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                0x00, 
                0x00000041
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x62, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP07)
    {
        Name (API7, 0x00)
        Name (PICM, Package (0x01)
        {
            Package (0x04)
            {
                0xFFFF, 
                0x00, 
                0x00, 
                0x00
            }
        })
        Name (APIC, Package (0x04)
        {
            Package (0x04)
            {
                0x0001FFFF, 
                0x00, 
                0x00, 
                0x00000036
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x01, 
                0x00, 
                0x0000003A
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                0x00, 
                0x0000003E
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                0x00, 
                0x00000042
            }
        })
        Method (_PRT, 0, NotSerialized)
        {
            Store (0x62, IOPT)
            If (LNot (PICF))
            {
                Return (PICM)
            }
            Else
            {
                Return (APIC)
            }
        }
    }

    Scope (\_SB.VP00)
    {
        Method (SUNC, 1, NotSerialized)
        {
            Multiply (VND0, 0x06, Local0)
            Add (Local0, Arg0, Local0)
            Return (Local0)
        }

        Method (ROWB, 1, NotSerialized)
        {
            Multiply (VND0, 0x08, Local0)
            Add (Arg0, 0x02, Local0)
            Return (Local0)
        }

        Method (ROWS, 1, NotSerialized)
        {
            Add (SUNC (Arg0), 0x40, Local0)
            Return (Local0)
        }

        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.ROWB (0x01), Local1)
            Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Local1)), 0x00))
            Store (^_BBN, Index (DerefOf (Index (\_SB.APCI.APCI, Local1)), 0x05))
            Store (\_SB.VP00.ROWS (0x01), Local2)
            Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Local2)), 0x00))
            Add (VND0, 0x71, Local3)
            Store (0x86, Index (DerefOf (Index (\_SB.APCI.APCI, Local3)), 0x00))
        }
    }

    Scope (\_SB.VP01)
    {
        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.ROWB (0x02), Local1)
            Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Local1)), 0x00))
            Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Local1)), 0x05))
            Store (\_SB.VP00.ROWS (0x02), Local2)
            Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Local2)), 0x00))
        }
    }

    Scope (\_SB.VP02)
    {
        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB00), 
            SHBZ,   16, 
            Offset (0xB2F), 
            SHBD,   3, 
            Offset (0xB31), 
            SHBF,   1, 
            SHBG,   3, 
            Offset (0xB32), 
            SHBY,   5, 
            Offset (0xB33), 
            SHBE,   8, 
            Offset (0xB37), 
            SHBH,   8, 
            Offset (0xB3F), 
            SHBS,   8, 
            SHBT,   8, 
            SHBN,   1, 
            SHBO,   1, 
            SHBP,   1, 
            SHBQ,   1, 
            SHBR,   1, 
            Offset (0xB42), 
            SHBJ,   1, 
            SHBK,   1, 
            SHBL,   2, 
            SHBM,   2, 
            Offset (0xB43), 
            SHBI,   2
        }

        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB2C), 
            SHRD,   3, 
            Offset (0xB30), 
            SHRE,   8, 
            SHRY,   5, 
            Offset (0xB32), 
            SHRF,   1, 
            SHRG,   3, 
            Offset (0xB34), 
            SHRH,   32, 
            Offset (0xB3C), 
            SHRS,   8, 
            Offset (0xB40), 
            SHRI,   2, 
            Offset (0xB41), 
            SHRJ,   1, 
            SHRK,   1, 
            SHRL,   2, 
            SHRM,   2, 
            Offset (0xB42), 
            SHRN,   1, 
            SHRO,   1, 
            SHRP,   1, 
            SHRQ,   1, 
            SHRR,   1, 
            Offset (0xB43), 
            SHRT,   8
        }

        Method (SHPC, 1, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                Store (Local1, ^SHRY)
                Store (Arg0, ^SHRE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                If (^SHRG)
                {
                    BreakPoint
                }
            }
            Else
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                If (LEqual (Local1, 0x00))
                {
                    Increment (Local1)
                }

                Store (Local1, ^SHBY)
                Store (Arg0, ^SHBE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                If (^SHBG)
                {
                    BreakPoint
                }
            }
        }

        Method (SHPF, 0, Serialized)
        {
            ^WRK0 ()
            ^SHPC (Or (Or (0x0100, 0x03), Or (0x10, 0x0C)))
            \_SB.APCI.ZZZN
            ^S1F0.SHPX
            0xE0
            Store (0x03, ^S1F0.SHPP)
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRL, ^S1F0.SHPQ)
            }
            Else
            {
                Store (^SHBL, ^S1F0.SHPQ)
            }
        }

        Method (SHPE, 0, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRH, Local0)
                While (Store (^SHRH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHRN)
                        {
                            Store (One, ^SHRN)
                            Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPX)), 0x0A))
                        }

                        If (^SHRO)
                        {
                            Store (One, ^SHRO)
                            BreakPoint
                        }

                        If (^SHRP)
                        {
                            Store (One, ^SHRP)
                        }

                        If (^SHRQ)
                        {
                            Store (One, ^SHRQ)
                            If (LNot (LEqual (^SHRI, 0x03)))
                            {
                                BreakPoint
                            }

                            ^WRK0 ()
                            If (LEqual (^S1F0.SHPP, 0x02))
                            {
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S1F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHRJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHRL, 0x03))
                                    {
                                        If (LNot (LEqual (^S1F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S1F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHRM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHRM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHRK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHRO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHRO)
                                            \_SB.APCI.ZZZN
                                            ^S1F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S1F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHRD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHRI, ^S1F0.SHPP)
                            Store (^SHRL, ^S1F0.SHPQ)
                        }

                        If (^SHRR)
                        {
                            Store (One, ^SHRR)
                            ^WRK0 ()
                            Store (One, ^SHRR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHRR)
                            \_SB.APCI.ZZZN
                            ^S1F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
            Else
            {
                Store (^SHBH, Local0)
                While (Store (^SHBH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHBN)
                        {
                            Store (One, ^SHBN)
                            Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPX)), 0x0A))
                        }

                        If (^SHBO)
                        {
                            Store (One, ^SHBO)
                            BreakPoint
                        }

                        If (^SHBP)
                        {
                            Store (One, ^SHBP)
                        }

                        If (^SHBQ)
                        {
                            Store (One, ^SHBQ)
                            If (LNot (LEqual (^SHBI, 0x03)))
                            {
                                BreakPoint
                            }

                            If (LEqual (^S1F0.SHPP, 0x02))
                            {
                                ^WRK0 ()
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S1F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHBJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHBL, 0x03))
                                    {
                                        If (LNot (LEqual (^S1F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S1F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHBM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHBM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHBK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHBO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHBO)
                                            \_SB.APCI.ZZZN
                                            ^S1F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S1F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHBD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHBI, ^S1F0.SHPP)
                            Store (^SHBL, ^S1F0.SHPQ)
                        }

                        If (^SHBR)
                        {
                            ^WRK0 ()
                            Store (One, ^SHBR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHBR)
                            \_SB.APCI.ZZZN
                            ^S1F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
        }

        Name (SHPB, Buffer (0x08)
        {
            0x00, 0x01, 0x05, 0x06, 0x07, 0xFF, 0xFF, 0xFF
        })
        Method (SHPI, 4, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHRS)
                    Store (0x65, ^SHRT)
                    If (LNot (LEqual (^SHRI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S1F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S1F0.SHPX)
                    Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S1F0.SHPS)
                    Store (Arg1, ^S1F0._SUN)
                    Store (^SHRI, ^S1F0.SHPP)
                    Store (^SHRL, ^S1F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S1F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S1F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
            Else
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHBS)
                    Store (0x65, ^SHBT)
                    If (LNot (LEqual (^SHBI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S1F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S1F0.SHPX)
                    Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S1F0.SHPS)
                    Store (Arg1, ^S1F0._SUN)
                    Store (^SHBI, ^S1F0.SHPP)
                    Store (^SHBL, ^S1F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S1F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S1F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S1F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
        }

        Device (S1F0)
        {
            Name (_ADR, 0x00010000)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Name (_SUN, Ones)
            Name (SHPP, Ones)
            Name (SHPQ, Ones)
            Name (SHPS, Ones)
            Name (SHPX, Ones)
            Name (SHPY, Ones)
        }

        Device (S1F1)
        {
            Name (_ADR, 0x00010001)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Device (S1F2)
        {
            Name (_ADR, 0x00010002)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Device (S1F3)
        {
            Name (_ADR, 0x00010003)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Device (S1F4)
        {
            Name (_ADR, 0x00010004)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Device (S1F5)
        {
            Name (_ADR, 0x00010005)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Device (S1F6)
        {
            Name (_ADR, 0x00010006)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Device (S1F7)
        {
            Name (_ADR, 0x00010007)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S1F0._SUN)
            }
        }

        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.SUNC (0x01), Local0)
            Store (\_SB.VP00.ROWB (0x01), Local1)
            Store (\_SB.VP00.ROWS (0x01), Local2)
            SHPI (Zero, Local0, Local1, Local2)
        }
    }

    Scope (\_SB.VP03)
    {
        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB00), 
            SHBZ,   16, 
            Offset (0xB2F), 
            SHBD,   3, 
            Offset (0xB31), 
            SHBF,   1, 
            SHBG,   3, 
            Offset (0xB32), 
            SHBY,   5, 
            Offset (0xB33), 
            SHBE,   8, 
            Offset (0xB37), 
            SHBH,   8, 
            Offset (0xB3F), 
            SHBS,   8, 
            SHBT,   8, 
            SHBN,   1, 
            SHBO,   1, 
            SHBP,   1, 
            SHBQ,   1, 
            SHBR,   1, 
            Offset (0xB42), 
            SHBJ,   1, 
            SHBK,   1, 
            SHBL,   2, 
            SHBM,   2, 
            Offset (0xB43), 
            SHBI,   2
        }

        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB2C), 
            SHRD,   3, 
            Offset (0xB30), 
            SHRE,   8, 
            SHRY,   5, 
            Offset (0xB32), 
            SHRF,   1, 
            SHRG,   3, 
            Offset (0xB34), 
            SHRH,   32, 
            Offset (0xB3C), 
            SHRS,   8, 
            Offset (0xB40), 
            SHRI,   2, 
            Offset (0xB41), 
            SHRJ,   1, 
            SHRK,   1, 
            SHRL,   2, 
            SHRM,   2, 
            Offset (0xB42), 
            SHRN,   1, 
            SHRO,   1, 
            SHRP,   1, 
            SHRQ,   1, 
            SHRR,   1, 
            Offset (0xB43), 
            SHRT,   8
        }

        Method (SHPC, 1, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                Store (Local1, ^SHRY)
                Store (Arg0, ^SHRE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                If (^SHRG)
                {
                    BreakPoint
                }
            }
            Else
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                If (LEqual (Local1, 0x00))
                {
                    Increment (Local1)
                }

                Store (Local1, ^SHBY)
                Store (Arg0, ^SHBE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                If (^SHBG)
                {
                    BreakPoint
                }
            }
        }

        Method (SHPF, 0, Serialized)
        {
            ^WRK0 ()
            ^SHPC (Or (Or (0x0100, 0x03), Or (0x10, 0x0C)))
            \_SB.APCI.ZZZN
            ^S2F0.SHPX
            0xE0
            Store (0x03, ^S2F0.SHPP)
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRL, ^S2F0.SHPQ)
            }
            Else
            {
                Store (^SHBL, ^S2F0.SHPQ)
            }
        }

        Method (SHPE, 0, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRH, Local0)
                While (Store (^SHRH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHRN)
                        {
                            Store (One, ^SHRN)
                            Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPX)), 0x0A))
                        }

                        If (^SHRO)
                        {
                            Store (One, ^SHRO)
                            BreakPoint
                        }

                        If (^SHRP)
                        {
                            Store (One, ^SHRP)
                        }

                        If (^SHRQ)
                        {
                            Store (One, ^SHRQ)
                            If (LNot (LEqual (^SHRI, 0x03)))
                            {
                                BreakPoint
                            }

                            ^WRK0 ()
                            If (LEqual (^S2F0.SHPP, 0x02))
                            {
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S2F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHRJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHRL, 0x03))
                                    {
                                        If (LNot (LEqual (^S2F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S2F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHRM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHRM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHRK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHRO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHRO)
                                            \_SB.APCI.ZZZN
                                            ^S2F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S2F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHRD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHRI, ^S2F0.SHPP)
                            Store (^SHRL, ^S2F0.SHPQ)
                        }

                        If (^SHRR)
                        {
                            Store (One, ^SHRR)
                            ^WRK0 ()
                            Store (One, ^SHRR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHRR)
                            \_SB.APCI.ZZZN
                            ^S2F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
            Else
            {
                Store (^SHBH, Local0)
                While (Store (^SHBH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHBN)
                        {
                            Store (One, ^SHBN)
                            Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPX)), 0x0A))
                        }

                        If (^SHBO)
                        {
                            Store (One, ^SHBO)
                            BreakPoint
                        }

                        If (^SHBP)
                        {
                            Store (One, ^SHBP)
                        }

                        If (^SHBQ)
                        {
                            Store (One, ^SHBQ)
                            If (LNot (LEqual (^SHBI, 0x03)))
                            {
                                BreakPoint
                            }

                            If (LEqual (^S2F0.SHPP, 0x02))
                            {
                                ^WRK0 ()
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S2F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHBJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHBL, 0x03))
                                    {
                                        If (LNot (LEqual (^S2F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S2F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHBM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHBM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHBK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHBO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHBO)
                                            \_SB.APCI.ZZZN
                                            ^S2F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S2F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHBD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHBI, ^S2F0.SHPP)
                            Store (^SHBL, ^S2F0.SHPQ)
                        }

                        If (^SHBR)
                        {
                            ^WRK0 ()
                            Store (One, ^SHBR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHBR)
                            \_SB.APCI.ZZZN
                            ^S2F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
        }

        Name (SHPB, Buffer (0x08)
        {
            0x00, 0x01, 0x05, 0x06, 0x07, 0xFF, 0xFF, 0xFF
        })
        Method (SHPI, 4, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHRS)
                    Store (0x65, ^SHRT)
                    If (LNot (LEqual (^SHRI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S2F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S2F0.SHPX)
                    Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S2F0.SHPS)
                    Store (Arg1, ^S2F0._SUN)
                    Store (^SHRI, ^S2F0.SHPP)
                    Store (^SHRL, ^S2F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S2F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S2F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
            Else
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHBS)
                    Store (0x65, ^SHBT)
                    If (LNot (LEqual (^SHBI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S2F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S2F0.SHPX)
                    Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S2F0.SHPS)
                    Store (Arg1, ^S2F0._SUN)
                    Store (^SHBI, ^S2F0.SHPP)
                    Store (^SHBL, ^S2F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S2F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S2F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S2F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
        }

        Device (S2F0)
        {
            Name (_ADR, 0x00010000)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Name (_SUN, Ones)
            Name (SHPP, Ones)
            Name (SHPQ, Ones)
            Name (SHPS, Ones)
            Name (SHPX, Ones)
            Name (SHPY, Ones)
        }

        Device (S2F1)
        {
            Name (_ADR, 0x00010001)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Device (S2F2)
        {
            Name (_ADR, 0x00010002)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Device (S2F3)
        {
            Name (_ADR, 0x00010003)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Device (S2F4)
        {
            Name (_ADR, 0x00010004)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Device (S2F5)
        {
            Name (_ADR, 0x00010005)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Device (S2F6)
        {
            Name (_ADR, 0x00010006)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Device (S2F7)
        {
            Name (_ADR, 0x00010007)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S2F0._SUN)
            }
        }

        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.SUNC (0x02), Local0)
            Store (\_SB.VP00.ROWB (0x02), Local1)
            Store (\_SB.VP00.ROWS (0x02), Local2)
            SHPI (Zero, Local0, Local1, Local2)
        }
    }

    Scope (\_SB.VP04)
    {
        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB00), 
            SHBZ,   16, 
            Offset (0xB2F), 
            SHBD,   3, 
            Offset (0xB31), 
            SHBF,   1, 
            SHBG,   3, 
            Offset (0xB32), 
            SHBY,   5, 
            Offset (0xB33), 
            SHBE,   8, 
            Offset (0xB37), 
            SHBH,   8, 
            Offset (0xB3F), 
            SHBS,   8, 
            SHBT,   8, 
            SHBN,   1, 
            SHBO,   1, 
            SHBP,   1, 
            SHBQ,   1, 
            SHBR,   1, 
            Offset (0xB42), 
            SHBJ,   1, 
            SHBK,   1, 
            SHBL,   2, 
            SHBM,   2, 
            Offset (0xB43), 
            SHBI,   2
        }

        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB2C), 
            SHRD,   3, 
            Offset (0xB30), 
            SHRE,   8, 
            SHRY,   5, 
            Offset (0xB32), 
            SHRF,   1, 
            SHRG,   3, 
            Offset (0xB34), 
            SHRH,   32, 
            Offset (0xB3C), 
            SHRS,   8, 
            Offset (0xB40), 
            SHRI,   2, 
            Offset (0xB41), 
            SHRJ,   1, 
            SHRK,   1, 
            SHRL,   2, 
            SHRM,   2, 
            Offset (0xB42), 
            SHRN,   1, 
            SHRO,   1, 
            SHRP,   1, 
            SHRQ,   1, 
            SHRR,   1, 
            Offset (0xB43), 
            SHRT,   8
        }

        Method (SHPC, 1, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                Store (Local1, ^SHRY)
                Store (Arg0, ^SHRE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                If (^SHRG)
                {
                    BreakPoint
                }
            }
            Else
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                If (LEqual (Local1, 0x00))
                {
                    Increment (Local1)
                }

                Store (Local1, ^SHBY)
                Store (Arg0, ^SHBE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                If (^SHBG)
                {
                    BreakPoint
                }
            }
        }

        Method (SHPF, 0, Serialized)
        {
            ^WRK0 ()
            ^SHPC (Or (Or (0x0100, 0x03), Or (0x10, 0x0C)))
            \_SB.APCI.ZZZN
            ^S3F0.SHPX
            0xE0
            Store (0x03, ^S3F0.SHPP)
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRL, ^S3F0.SHPQ)
            }
            Else
            {
                Store (^SHBL, ^S3F0.SHPQ)
            }
        }

        Method (SHPE, 0, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRH, Local0)
                While (Store (^SHRH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHRN)
                        {
                            Store (One, ^SHRN)
                            Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPX)), 0x0A))
                        }

                        If (^SHRO)
                        {
                            Store (One, ^SHRO)
                            BreakPoint
                        }

                        If (^SHRP)
                        {
                            Store (One, ^SHRP)
                        }

                        If (^SHRQ)
                        {
                            Store (One, ^SHRQ)
                            If (LNot (LEqual (^SHRI, 0x03)))
                            {
                                BreakPoint
                            }

                            ^WRK0 ()
                            If (LEqual (^S3F0.SHPP, 0x02))
                            {
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S3F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHRJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHRL, 0x03))
                                    {
                                        If (LNot (LEqual (^S3F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S3F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHRM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHRM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHRK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHRO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHRO)
                                            \_SB.APCI.ZZZN
                                            ^S3F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S3F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHRD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHRI, ^S3F0.SHPP)
                            Store (^SHRL, ^S3F0.SHPQ)
                        }

                        If (^SHRR)
                        {
                            Store (One, ^SHRR)
                            ^WRK0 ()
                            Store (One, ^SHRR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHRR)
                            \_SB.APCI.ZZZN
                            ^S3F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
            Else
            {
                Store (^SHBH, Local0)
                While (Store (^SHBH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHBN)
                        {
                            Store (One, ^SHBN)
                            Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPX)), 0x0A))
                        }

                        If (^SHBO)
                        {
                            Store (One, ^SHBO)
                            BreakPoint
                        }

                        If (^SHBP)
                        {
                            Store (One, ^SHBP)
                        }

                        If (^SHBQ)
                        {
                            Store (One, ^SHBQ)
                            If (LNot (LEqual (^SHBI, 0x03)))
                            {
                                BreakPoint
                            }

                            If (LEqual (^S3F0.SHPP, 0x02))
                            {
                                ^WRK0 ()
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S3F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHBJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHBL, 0x03))
                                    {
                                        If (LNot (LEqual (^S3F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S3F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHBM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHBM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHBK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHBO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHBO)
                                            \_SB.APCI.ZZZN
                                            ^S3F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S3F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHBD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHBI, ^S3F0.SHPP)
                            Store (^SHBL, ^S3F0.SHPQ)
                        }

                        If (^SHBR)
                        {
                            ^WRK0 ()
                            Store (One, ^SHBR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHBR)
                            \_SB.APCI.ZZZN
                            ^S3F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
        }

        Name (SHPB, Buffer (0x08)
        {
            0x00, 0x01, 0x05, 0x06, 0x07, 0xFF, 0xFF, 0xFF
        })
        Method (SHPI, 4, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHRS)
                    Store (0x65, ^SHRT)
                    If (LNot (LEqual (^SHRI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S3F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S3F0.SHPX)
                    Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S3F0.SHPS)
                    Store (Arg1, ^S3F0._SUN)
                    Store (^SHRI, ^S3F0.SHPP)
                    Store (^SHRL, ^S3F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S3F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S3F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
            Else
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHBS)
                    Store (0x65, ^SHBT)
                    If (LNot (LEqual (^SHBI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S3F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S3F0.SHPX)
                    Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S3F0.SHPS)
                    Store (Arg1, ^S3F0._SUN)
                    Store (^SHBI, ^S3F0.SHPP)
                    Store (^SHBL, ^S3F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S3F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S3F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S3F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
        }

        Device (S3F0)
        {
            Name (_ADR, 0x00010000)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Name (_SUN, Ones)
            Name (SHPP, Ones)
            Name (SHPQ, Ones)
            Name (SHPS, Ones)
            Name (SHPX, Ones)
            Name (SHPY, Ones)
        }

        Device (S3F1)
        {
            Name (_ADR, 0x00010001)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Device (S3F2)
        {
            Name (_ADR, 0x00010002)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Device (S3F3)
        {
            Name (_ADR, 0x00010003)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Device (S3F4)
        {
            Name (_ADR, 0x00010004)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Device (S3F5)
        {
            Name (_ADR, 0x00010005)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Device (S3F6)
        {
            Name (_ADR, 0x00010006)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Device (S3F7)
        {
            Name (_ADR, 0x00010007)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S3F0._SUN)
            }
        }

        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.SUNC (0x03), Local0)
            Store (\_SB.VP00.ROWB (0x03), Local1)
            Store (\_SB.VP00.ROWS (0x03), Local2)
            SHPI (Zero, Local0, Local1, Local2)
        }
    }

    Scope (\_SB.VP05)
    {
        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB00), 
            SHBZ,   16, 
            Offset (0xB2F), 
            SHBD,   3, 
            Offset (0xB31), 
            SHBF,   1, 
            SHBG,   3, 
            Offset (0xB32), 
            SHBY,   5, 
            Offset (0xB33), 
            SHBE,   8, 
            Offset (0xB37), 
            SHBH,   8, 
            Offset (0xB3F), 
            SHBS,   8, 
            SHBT,   8, 
            SHBN,   1, 
            SHBO,   1, 
            SHBP,   1, 
            SHBQ,   1, 
            SHBR,   1, 
            Offset (0xB42), 
            SHBJ,   1, 
            SHBK,   1, 
            SHBL,   2, 
            SHBM,   2, 
            Offset (0xB43), 
            SHBI,   2
        }

        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB2C), 
            SHRD,   3, 
            Offset (0xB30), 
            SHRE,   8, 
            SHRY,   5, 
            Offset (0xB32), 
            SHRF,   1, 
            SHRG,   3, 
            Offset (0xB34), 
            SHRH,   32, 
            Offset (0xB3C), 
            SHRS,   8, 
            Offset (0xB40), 
            SHRI,   2, 
            Offset (0xB41), 
            SHRJ,   1, 
            SHRK,   1, 
            SHRL,   2, 
            SHRM,   2, 
            Offset (0xB42), 
            SHRN,   1, 
            SHRO,   1, 
            SHRP,   1, 
            SHRQ,   1, 
            SHRR,   1, 
            Offset (0xB43), 
            SHRT,   8
        }

        Method (SHPC, 1, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                Store (Local1, ^SHRY)
                Store (Arg0, ^SHRE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                If (^SHRG)
                {
                    BreakPoint
                }
            }
            Else
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                If (LEqual (Local1, 0x00))
                {
                    Increment (Local1)
                }

                Store (Local1, ^SHBY)
                Store (Arg0, ^SHBE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                If (^SHBG)
                {
                    BreakPoint
                }
            }
        }

        Method (SHPF, 0, Serialized)
        {
            ^WRK0 ()
            ^SHPC (Or (Or (0x0100, 0x03), Or (0x10, 0x0C)))
            \_SB.APCI.ZZZN
            ^S4F0.SHPX
            0xE0
            Store (0x03, ^S4F0.SHPP)
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRL, ^S4F0.SHPQ)
            }
            Else
            {
                Store (^SHBL, ^S4F0.SHPQ)
            }
        }

        Method (SHPE, 0, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRH, Local0)
                While (Store (^SHRH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHRN)
                        {
                            Store (One, ^SHRN)
                            Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPX)), 0x0A))
                        }

                        If (^SHRO)
                        {
                            Store (One, ^SHRO)
                            BreakPoint
                        }

                        If (^SHRP)
                        {
                            Store (One, ^SHRP)
                        }

                        If (^SHRQ)
                        {
                            Store (One, ^SHRQ)
                            If (LNot (LEqual (^SHRI, 0x03)))
                            {
                                BreakPoint
                            }

                            ^WRK0 ()
                            If (LEqual (^S4F0.SHPP, 0x02))
                            {
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S4F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHRJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHRL, 0x03))
                                    {
                                        If (LNot (LEqual (^S4F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S4F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHRM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHRM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHRK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHRO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHRO)
                                            \_SB.APCI.ZZZN
                                            ^S4F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S4F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHRD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHRI, ^S4F0.SHPP)
                            Store (^SHRL, ^S4F0.SHPQ)
                        }

                        If (^SHRR)
                        {
                            Store (One, ^SHRR)
                            ^WRK0 ()
                            Store (One, ^SHRR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHRR)
                            \_SB.APCI.ZZZN
                            ^S4F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
            Else
            {
                Store (^SHBH, Local0)
                While (Store (^SHBH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHBN)
                        {
                            Store (One, ^SHBN)
                            Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPX)), 0x0A))
                        }

                        If (^SHBO)
                        {
                            Store (One, ^SHBO)
                            BreakPoint
                        }

                        If (^SHBP)
                        {
                            Store (One, ^SHBP)
                        }

                        If (^SHBQ)
                        {
                            Store (One, ^SHBQ)
                            If (LNot (LEqual (^SHBI, 0x03)))
                            {
                                BreakPoint
                            }

                            If (LEqual (^S4F0.SHPP, 0x02))
                            {
                                ^WRK0 ()
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S4F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHBJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHBL, 0x03))
                                    {
                                        If (LNot (LEqual (^S4F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S4F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHBM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHBM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHBK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHBO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHBO)
                                            \_SB.APCI.ZZZN
                                            ^S4F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S4F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHBD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHBI, ^S4F0.SHPP)
                            Store (^SHBL, ^S4F0.SHPQ)
                        }

                        If (^SHBR)
                        {
                            ^WRK0 ()
                            Store (One, ^SHBR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHBR)
                            \_SB.APCI.ZZZN
                            ^S4F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
        }

        Name (SHPB, Buffer (0x08)
        {
            0x00, 0x01, 0x05, 0x06, 0x07, 0xFF, 0xFF, 0xFF
        })
        Method (SHPI, 4, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHRS)
                    Store (0x65, ^SHRT)
                    If (LNot (LEqual (^SHRI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S4F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S4F0.SHPX)
                    Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S4F0.SHPS)
                    Store (Arg1, ^S4F0._SUN)
                    Store (^SHRI, ^S4F0.SHPP)
                    Store (^SHRL, ^S4F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S4F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S4F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
            Else
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHBS)
                    Store (0x65, ^SHBT)
                    If (LNot (LEqual (^SHBI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S4F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S4F0.SHPX)
                    Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S4F0.SHPS)
                    Store (Arg1, ^S4F0._SUN)
                    Store (^SHBI, ^S4F0.SHPP)
                    Store (^SHBL, ^S4F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S4F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S4F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S4F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
        }

        Device (S4F0)
        {
            Name (_ADR, 0x00010000)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Name (_SUN, Ones)
            Name (SHPP, Ones)
            Name (SHPQ, Ones)
            Name (SHPS, Ones)
            Name (SHPX, Ones)
            Name (SHPY, Ones)
        }

        Device (S4F1)
        {
            Name (_ADR, 0x00010001)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Device (S4F2)
        {
            Name (_ADR, 0x00010002)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Device (S4F3)
        {
            Name (_ADR, 0x00010003)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Device (S4F4)
        {
            Name (_ADR, 0x00010004)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Device (S4F5)
        {
            Name (_ADR, 0x00010005)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Device (S4F6)
        {
            Name (_ADR, 0x00010006)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Device (S4F7)
        {
            Name (_ADR, 0x00010007)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S4F0._SUN)
            }
        }

        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.SUNC (0x04), Local0)
            Store (\_SB.VP00.ROWB (0x04), Local1)
            Store (\_SB.VP00.ROWS (0x04), Local2)
            SHPI (Zero, Local0, Local1, Local2)
        }
    }

    Scope (\_SB.VP06)
    {
        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB00), 
            SHBZ,   16, 
            Offset (0xB2F), 
            SHBD,   3, 
            Offset (0xB31), 
            SHBF,   1, 
            SHBG,   3, 
            Offset (0xB32), 
            SHBY,   5, 
            Offset (0xB33), 
            SHBE,   8, 
            Offset (0xB37), 
            SHBH,   8, 
            Offset (0xB3F), 
            SHBS,   8, 
            SHBT,   8, 
            SHBN,   1, 
            SHBO,   1, 
            SHBP,   1, 
            SHBQ,   1, 
            SHBR,   1, 
            Offset (0xB42), 
            SHBJ,   1, 
            SHBK,   1, 
            SHBL,   2, 
            SHBM,   2, 
            Offset (0xB43), 
            SHBI,   2
        }

        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB2C), 
            SHRD,   3, 
            Offset (0xB30), 
            SHRE,   8, 
            SHRY,   5, 
            Offset (0xB32), 
            SHRF,   1, 
            SHRG,   3, 
            Offset (0xB34), 
            SHRH,   32, 
            Offset (0xB3C), 
            SHRS,   8, 
            Offset (0xB40), 
            SHRI,   2, 
            Offset (0xB41), 
            SHRJ,   1, 
            SHRK,   1, 
            SHRL,   2, 
            SHRM,   2, 
            Offset (0xB42), 
            SHRN,   1, 
            SHRO,   1, 
            SHRP,   1, 
            SHRQ,   1, 
            SHRR,   1, 
            Offset (0xB43), 
            SHRT,   8
        }

        Method (SHPC, 1, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                Store (Local1, ^SHRY)
                Store (Arg0, ^SHRE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                If (^SHRG)
                {
                    BreakPoint
                }
            }
            Else
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                If (LEqual (Local1, 0x00))
                {
                    Increment (Local1)
                }

                Store (Local1, ^SHBY)
                Store (Arg0, ^SHBE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                If (^SHBG)
                {
                    BreakPoint
                }
            }
        }

        Method (SHPF, 0, Serialized)
        {
            ^WRK0 ()
            ^SHPC (Or (Or (0x0100, 0x03), Or (0x10, 0x0C)))
            \_SB.APCI.ZZZN
            ^S5F0.SHPX
            0xE0
            Store (0x03, ^S5F0.SHPP)
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRL, ^S5F0.SHPQ)
            }
            Else
            {
                Store (^SHBL, ^S5F0.SHPQ)
            }
        }

        Method (SHPE, 0, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRH, Local0)
                While (Store (^SHRH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHRN)
                        {
                            Store (One, ^SHRN)
                            Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPX)), 0x0A))
                        }

                        If (^SHRO)
                        {
                            Store (One, ^SHRO)
                            BreakPoint
                        }

                        If (^SHRP)
                        {
                            Store (One, ^SHRP)
                        }

                        If (^SHRQ)
                        {
                            Store (One, ^SHRQ)
                            If (LNot (LEqual (^SHRI, 0x03)))
                            {
                                BreakPoint
                            }

                            ^WRK0 ()
                            If (LEqual (^S5F0.SHPP, 0x02))
                            {
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S5F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHRJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHRL, 0x03))
                                    {
                                        If (LNot (LEqual (^S5F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S5F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHRM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHRM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHRK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHRO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHRO)
                                            \_SB.APCI.ZZZN
                                            ^S5F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S5F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHRD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHRI, ^S5F0.SHPP)
                            Store (^SHRL, ^S5F0.SHPQ)
                        }

                        If (^SHRR)
                        {
                            Store (One, ^SHRR)
                            ^WRK0 ()
                            Store (One, ^SHRR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHRR)
                            \_SB.APCI.ZZZN
                            ^S5F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
            Else
            {
                Store (^SHBH, Local0)
                While (Store (^SHBH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHBN)
                        {
                            Store (One, ^SHBN)
                            Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPX)), 0x0A))
                        }

                        If (^SHBO)
                        {
                            Store (One, ^SHBO)
                            BreakPoint
                        }

                        If (^SHBP)
                        {
                            Store (One, ^SHBP)
                        }

                        If (^SHBQ)
                        {
                            Store (One, ^SHBQ)
                            If (LNot (LEqual (^SHBI, 0x03)))
                            {
                                BreakPoint
                            }

                            If (LEqual (^S5F0.SHPP, 0x02))
                            {
                                ^WRK0 ()
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S5F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHBJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHBL, 0x03))
                                    {
                                        If (LNot (LEqual (^S5F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S5F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHBM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHBM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHBK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHBO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHBO)
                                            \_SB.APCI.ZZZN
                                            ^S5F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S5F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHBD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHBI, ^S5F0.SHPP)
                            Store (^SHBL, ^S5F0.SHPQ)
                        }

                        If (^SHBR)
                        {
                            ^WRK0 ()
                            Store (One, ^SHBR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHBR)
                            \_SB.APCI.ZZZN
                            ^S5F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
        }

        Name (SHPB, Buffer (0x08)
        {
            0x00, 0x01, 0x05, 0x06, 0x07, 0xFF, 0xFF, 0xFF
        })
        Method (SHPI, 4, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHRS)
                    Store (0x65, ^SHRT)
                    If (LNot (LEqual (^SHRI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S5F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S5F0.SHPX)
                    Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S5F0.SHPS)
                    Store (Arg1, ^S5F0._SUN)
                    Store (^SHRI, ^S5F0.SHPP)
                    Store (^SHRL, ^S5F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S5F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S5F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
            Else
            {
                If (LEqual (Arg0, Zero))
                {
                    Store (0x7E, ^SHBS)
                    Store (0x65, ^SHBT)
                    If (LNot (LEqual (^SHBI, 0x02)))
                    {
                        ^WRK0 ()
                    }

                    Store (Arg2, ^S5F0.SHPY)
                    Store (^_BBN (), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x05))
                    Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x08))
                    Store (0x81, Index (DerefOf (Index (\_SB.APCI.APCI, Arg2)), 0x00))
                    Store (Arg3, ^S5F0.SHPX)
                    Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0A))
                    Store (Arg1, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x0C))
                    Store (0x82, Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x00))
                    Store (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, Arg3)), 0x02)), ^S5F0.SHPS)
                    Store (Arg1, ^S5F0._SUN)
                    Store (^SHBI, ^S5F0.SHPP)
                    Store (^SHBL, ^S5F0.SHPQ)
                    Return (Increment (Arg1))
                }

                If (LEqual (Arg0, One))
                {
                    If (LEqual (^S5F0.SHPS, Arg1))
                    {
                        If (Arg2)
                        {
                            Store (0x20, Local0)
                            Store (0x08, Local1)
                        }
                        Else
                        {
                            If (DerefOf (Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPX)), 0x09)))
                            {
                                Store (0x10, Local0)
                            }
                            Else
                            {
                                Store (0x30, Local0)
                            }

                            Store (Zero, Local1)
                        }

                        ^SHPC (Or (0x0100, Local0))
                        Store (Local1, Index (DerefOf (Index (\_SB.APCI.APCI, ^S5F0.SHPX)), 0x0B))
                        \_SB.APCI.ZZZN
                        ^S5F0.SHPX
                        0xF3
                    }
                }

                Return (Zero)
            }
        }

        Device (S5F0)
        {
            Name (_ADR, 0x00010000)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Name (_SUN, Ones)
            Name (SHPP, Ones)
            Name (SHPQ, Ones)
            Name (SHPS, Ones)
            Name (SHPX, Ones)
            Name (SHPY, Ones)
        }

        Device (S5F1)
        {
            Name (_ADR, 0x00010001)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Device (S5F2)
        {
            Name (_ADR, 0x00010002)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Device (S5F3)
        {
            Name (_ADR, 0x00010003)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Device (S5F4)
        {
            Name (_ADR, 0x00010004)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Device (S5F5)
        {
            Name (_ADR, 0x00010005)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Device (S5F6)
        {
            Name (_ADR, 0x00010006)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Device (S5F7)
        {
            Name (_ADR, 0x00010007)
            Method (_EJ0, 1, NotSerialized)
            {
                ^^SHPF ()
            }

            Method (_SUN, 0, NotSerialized)
            {
                Return (^^S5F0._SUN)
            }
        }

        Method (INIH, 0, NotSerialized)
        {
            Store (\_SB.VP00.SUNC (0x05), Local0)
            Store (\_SB.VP00.ROWB (0x05), Local1)
            Store (\_SB.VP00.ROWS (0x05), Local2)
            SHPI (Zero, Local0, Local1, Local2)
        }
    }

    Scope (\_SB.VP07)
    {
        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB00), 
            SHBZ,   16, 
            Offset (0xB2F), 
            SHBD,   3, 
            Offset (0xB31), 
            SHBF,   1, 
            SHBG,   3, 
            Offset (0xB32), 
            SHBY,   5, 
            Offset (0xB33), 
            SHBE,   8, 
            Offset (0xB37), 
            SHBH,   8, 
            Offset (0xB3F), 
            SHBS,   8, 
            SHBT,   8, 
            SHBN,   1, 
            SHBO,   1, 
            SHBP,   1, 
            SHBQ,   1, 
            SHBR,   1, 
            Offset (0xB42), 
            SHBJ,   1, 
            SHBK,   1, 
            SHBL,   2, 
            SHBM,   2, 
            Offset (0xB43), 
            SHBI,   2
        }

        Field (PHBR, ByteAcc, NoLock, WriteAsZeros)
        {
            Offset (0xB2C), 
            SHRD,   3, 
            Offset (0xB30), 
            SHRE,   8, 
            SHRY,   5, 
            Offset (0xB32), 
            SHRF,   1, 
            SHRG,   3, 
            Offset (0xB34), 
            SHRH,   32, 
            Offset (0xB3C), 
            SHRS,   8, 
            Offset (0xB40), 
            SHRI,   2, 
            Offset (0xB41), 
            SHRJ,   1, 
            SHRK,   1, 
            SHRL,   2, 
            SHRM,   2, 
            Offset (0xB42), 
            SHRN,   1, 
            SHRO,   1, 
            SHRP,   1, 
            SHRQ,   1, 
            SHRR,   1, 
            Offset (0xB43), 
            SHRT,   8
        }

        Method (SHPC, 1, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                Store (Local1, ^SHRY)
                Store (Arg0, ^SHRE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHRF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHRF)
                {
                    BreakPoint
                }

                If (^SHRG)
                {
                    BreakPoint
                }
            }
            Else
            {
                Store (0x05DC, Local0)
                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                ShiftRight (Arg0, 0x08, Local1)
                If (LEqual (Local1, 0x00))
                {
                    Increment (Local1)
                }

                Store (Local1, ^SHBY)
                Store (Arg0, ^SHBE)
                If (LOr (LEqual (And (Arg0, 0xFF), 0x48), LEqual (And (Arg0, 0xFF), 0x49)))
                {
                    Store (0x05DC, Local0)
                }
                Else
                {
                    Store (0x64, Local0)
                }

                While (LAnd (^SHBF, Local0))
                {
                    Sleep (0x0A)
                    Decrement (Local0)
                }

                If (^SHBF)
                {
                    BreakPoint
                }

                If (^SHBG)
                {
                    BreakPoint
                }
            }
        }

        Method (SHPF, 0, Serialized)
        {
            ^WRK0 ()
            ^SHPC (Or (Or (0x0100, 0x03), Or (0x10, 0x0C)))
            \_SB.APCI.ZZZN
            ^S6F0.SHPX
            0xE0
            Store (0x03, ^S6F0.SHPP)
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRL, ^S6F0.SHPQ)
            }
            Else
            {
                Store (^SHBL, ^S6F0.SHPQ)
            }
        }

        Method (SHPE, 0, Serialized)
        {
            If (LEqual (^SHBZ, 0x1014))
            {
                Store (^SHRH, Local0)
                While (Store (^SHRH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHRN)
                        {
                            Store (One, ^SHRN)
                            Store (ShiftLeft (^SHRL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S6F0.SHPX)), 0x0A))
                        }

                        If (^SHRO)
                        {
                            Store (One, ^SHRO)
                            BreakPoint
                        }

                        If (^SHRP)
                        {
                            Store (One, ^SHRP)
                        }

                        If (^SHRQ)
                        {
                            Store (One, ^SHRQ)
                            If (LNot (LEqual (^SHRI, 0x03)))
                            {
                                BreakPoint
                            }

                            ^WRK0 ()
                            If (LEqual (^S6F0.SHPP, 0x02))
                            {
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S6F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHRJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHRL, 0x03))
                                    {
                                        If (LNot (LEqual (^S6F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S6F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHRM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHRM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHRK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHRD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S6F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHRO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHRO)
                                            \_SB.APCI.ZZZN
                                            ^S6F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S6F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHRD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHRI, ^S6F0.SHPP)
                            Store (^SHRL, ^S6F0.SHPQ)
                        }

                        If (^SHRR)
                        {
                            Store (One, ^SHRR)
                            ^WRK0 ()
                            Store (One, ^SHRR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHRR)
                            \_SB.APCI.ZZZN
                            ^S6F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

                Return (Local0)
            }
            Else
            {
                Store (^SHBH, Local0)
                While (Store (^SHBH, Local1))
                {
                    If (And (Local1, 0x02))
                    {
                        If (^SHBN)
                        {
                            Store (One, ^SHBN)
                            Store (ShiftLeft (^SHBL, 0x03), Index (DerefOf (Index (\_SB.APCI.APCI, ^S6F0.SHPX)), 0x0A))
                        }

                        If (^SHBO)
                        {
                            Store (One, ^SHBO)
                            BreakPoint
                        }

                        If (^SHBP)
                        {
                            Store (One, ^SHBP)
                        }

                        If (^SHBQ)
                        {
                            Store (One, ^SHBQ)
                            If (LNot (LEqual (^SHBI, 0x03)))
                            {
                                BreakPoint
                            }

                            If (LEqual (^S6F0.SHPP, 0x02))
                            {
                                ^WRK0 ()
                                ^SHPC (Or (0x0100, Or (0x0C, 0x10)))
                                Notify (^, 0x00)
                                \_SB.APCI.ZZZN
                                ^S6F0.SHPX
                                0xEA
                            }
                            Else
                            {
                                If (LNot (^SHBJ))
                                {
                                    ^SHPC (Or (0x0100, 0x30))
                                    If (LEqual (^SHBL, 0x03))
                                    {
                                        If (LNot (LEqual (^S6F0.SHPQ, 0x03)))
                                        {
                                            \_SB.APCI.ZZZN
                                            ^S6F0.SHPX
                                            0xF1
                                        }
                                    }
                                    Else
                                    {
                                        ^SHPC (Or (0x0100, Or (0x04, 0x01)))
                                        If (LEqual (^SHBM, 0x03))
                                        {
                                            Store (0x44, Local0)
                                        }
                                        Else
                                        {
                                            If (LEqual (^SHBM, 0x01))
                                            {
                                                Store (0x42, Local0)
                                            }
                                            Else
                                            {
                                                If (^SHBK)
                                                {
                                                    Store (0x41, Local0)
                                                }
                                                Else
                                                {
                                                    Store (0x40, Local0)
                                                }
                                            }
                                        }

                                        ^SHPC (Local0)
                                        Store (DerefOf (Index (^SHPB, ^SHBD)), Index (DerefOf (Index (\_SB.APCI.APCI, ^S6F0.SHPY)), 0x08))
                                        Sleep (0x1388)
                                        If (^SHBO)
                                        {
                                            ^WRK0 ()
                                            Store (One, SHRO)
                                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                                            Store (One, ^SHBO)
                                            \_SB.APCI.ZZZN
                                            ^S6F0.SHPX
                                            0xE9
                                        }
                                        Else
                                        {
                                            ^SHPC (Or (0x0100, 0x02))
                                            Sleep (0x0BB8)
                                            ^WRK1 ()
                                            \_SB.APCI.ZZZN
                                            ^S6F0.SHPX
                                            0xF0
                                            Notify (^, 0x00)
                                            Store (^SHBD, IOPT)
                                        }
                                    }
                                }
                            }

                            Store (^SHBI, ^S6F0.SHPP)
                            Store (^SHBL, ^S6F0.SHPQ)
                        }

                        If (^SHBR)
                        {
                            ^WRK0 ()
                            Store (One, ^SHBR)
                            ^SHPC (Or (Or (0x0C, 0x10), Or (0x0100, 0x03)))
                            Store (One, ^SHBR)
                            \_SB.APCI.ZZZN
                            ^S6F0.SHPX
                            0xE9
                        }
                    }
                    Else
                    {
                        BreakPoint
                    }
                }

253 lines not shown · raw message

Part of this message is not shown here. View the raw message.

#15 lore raw

Re: Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 6 lines · keith
Quoted 2 lines
Quoted 1 line

Could you show your AML tree around Memory ?

See attached SSDT.

Thanks, at the first look.....

Quoted 2 lines
        Device (ME00)
        {

<snip>

Quoted 13 lines
            Method (_STA, 0, NotSerialized)
            {
                If (CondRefOf (_OSI, Local0))
                {
                    If (\_OSI ("Windows 2001"))
                    {
                        If (LAnd (LEqual (BADH, EADH), LEqual (BADL, EADL)))
                        {
                            Or (MEID, \_SB.MEMI, \_SB.MEMI)
                            Return (0x00)
                        }
                        Else
                        {
Quoted 8 lines
                            And (Not (MEID), \_SB.MEMI, \_SB.MEMI)
                            Return (0x0F)
                        }
                    }
                }

                Return (0x00)
            }

It seems memory device's _STA never returns 0xF always returns 0x0. (Device is online and enabled) when OS is not Windows2001. All PNP0C80 decvices in this SSDT has same _STA function.

So, I think why your hot add failes is _STA has no present bit. ==
drivers/acpi/scan.c

acpi_add_single_object()
<snip>

        case ACPI_BUS_TYPE_DEVICE:
                result = acpi_bus_get_status(device);  in drivers/acpi/bus.c
                if (ACPI_FAILURE(result) || !device->status.present) { <----(*)
                        result = -ENOENT;
                        goto end;
                }
                break;

==

rewriting your DSDT would be sane approach.

-- Kame

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#17 lore raw

Re: Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

Quoted 31 lines · KAMEZAWA Hiroyuki
Quoted 6 lines · keith
Quoted 2 lines
Quoted 1 line

Could you show your AML tree around Memory ?

See attached SSDT.

Thanks, at the first look.....

Quoted 2 lines
        Device (ME00)
        {

<snip>

Quoted 19 lines
            Method (_STA, 0, NotSerialized)
            {
                If (CondRefOf (_OSI, Local0))
                {
                    If (\_OSI ("Windows 2001"))
                    {
                        If (LAnd (LEqual (BADH, EADH), LEqual (BADL, EADL)))
                        {
                            Or (MEID, \_SB.MEMI, \_SB.MEMI)
                            Return (0x00)
                        }
                        Else
                        {
                            And (Not (MEID), \_SB.MEMI, \_SB.MEMI)
                            Return (0x0F)
                        }
                    }
                }
Quoted 5 lines
Quoted 2 lines
                Return (0x00)
            }

It seems memory device's _STA never returns 0xF always returns 0x0. (Device is online and enabled) when OS is not Windows2001. All PNP0C80 decvices in this SSDT has same _STA function.

I see. I have no experience reading these ASL files...

Quoted 13 lines

So, I think why your hot add failes is _STA has no present bit. ==
drivers/acpi/scan.c

acpi_add_single_object()
<snip>

         case ACPI_BUS_TYPE_DEVICE:
                 result = acpi_bus_get_status(device);  in drivers/acpi/bus.c
                 if (ACPI_FAILURE(result) || !device->status.present) { <----(*)
                         result = -ENOENT;
                         goto end;
                 }
                 break;
Quoted 3 lines

==

rewriting your DSDT would be sane approach.

I shall go to the bios writers.

Thank you very much for you help in determining the root cause of my troubles with the hot-add event.

Keith Mannthey
LTC xSeries

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

#18 lore raw

Re: [Lhms-devel] [PATCH 1/1] patch to fix acpi_memhotplug.c

In reply to keith
Quoted 35 lines · On Wed, 16 Nov 2005 20:18:27 -0800 keith…
Quoted 29 lines · Yasunori Goto

Hello, Keith-san.

Quoted 11 lines

I am submitting this patch for inclusion in the acpi development tree.
I have not received any feedback of my beta patch or emails over the past week. I cleaned my previous patch up and made the error handling match the rest of the driver. I need this patch to support my hardware (IBM x460/x366/x445) acpi hot-add memory events.

In general acpi_bus_get_device fails for my event.
acpi_bus-0072 [04] bus_get_device : No context for object [ffff81007ff397f0]
The current driver relies on acpi_bus_get_device to create the acpi
memory_device but these call fails for my hardware.

Quoted 8 lines

My event is a single notify with a memory range passed along as data.
The current driver is expecting some other event or series of events (As I have posted before I am a little confused on how the current driver works at all). My code provides a way for the data that is passed along during the event to be converted directly to the memory_device without reliance on acpi_bus_get_device. My code in no way breaks the current implementation and seems a reasonable addition for increased flexibility.

Hmm.
I have a bit similar (but contrastive) problem on our making box. In my case, physical hotplug unit is a node. So, notification of event will reach "container driver". And container driver just call struct acpi_driver ops.add via acpi_bus_scan(). And it will also call ops.start if start method is exist.

Quoted 4 lines

Howerver, there is no ops.start method in acpi_memhotplug.c. So, when bus is scaned by container driver add event, add_memory is not called.
Following patch is to add start method for it.

Quoted 6 lines

My add event is called with my patch. The notify event is triggering and falling into the right path.

I tried your patch but my device is not making and add event. I really looks to just be a notify with the memory range attached. I really think my patch is the right way to go for my hardware.

Oops. I didn't say clearly. Sorry.
Just I meant each patches were necessary for each case.

Anyway, I also have a concern about Kame-san's following question.

Quoted 3 lines

Maybe driver->ops.add is not called for some reason. What happens in acpi_add_single_object() in your environment ? acpi_bus_find_driver() is called ?

Thanks.

Signature · 10 lines
Yasunori Goto 




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click