diff --git a/gbsim.h b/gbsim.h
index d3a519a..032f003 100644
--- a/gbsim.h
+++ b/gbsim.h
@@ -14,6 +14,7 @@
 
 #include <svc_msg.h>
 
+#include "gpio.h"
 #include "i2s.h"
 
 extern int bbb_backend;
@@ -72,82 +73,6 @@ struct protocol_version_rsp {
 	__u8	version_minor;
 };
 
-/* GPIO */
-struct gpio_line_count_rsp {
-	__u8	count;
-};
-
-struct gpio_activate_req {
-	__u8	which;
-};
-
-struct gpio_deactivate_req {
-	__u8	which;
-};
-
-struct gpio_get_direction_req {
-	__u8	which;
-};
-
-struct gpio_get_direction_rsp {
-	__u8	direction;
-};
-
-struct gpio_direction_input_req {
-	__u8	which;
-};
-
-struct gpio_direction_output_req {
-	__u8	which;
-	__u8	value;
-};
-
-struct gpio_get_value_req {
-	__u8	which;
-};
-
-struct gpio_get_value_rsp {
-	__u8	value;
-};
-
-struct gpio_set_value_req {
-	__u8	which;
-	__u8	value;
-};
-
-struct gpio_set_debounce_req {
-	__u8	which;
-	__le16	usec __attribute__((__packed__));
-};
-
-struct gpio_irq_type_request {
-	__u8	which;
-	__u8	type;
-};
-/* irq type response has no payload */
-
-struct gpio_irq_mask_request {
-	__u8	which;
-};
-/* irq mask response has no payload */
-
-struct gpio_irq_unmask_request {
-	__u8	which;
-};
-/* irq unmask response has no payload */
-
-struct gpio_irq_ack_request {
-	__u8	which;
-};
-/* irq ack response has no payload */
-
-/* irq event requests originate on another module and are handled on the AP */
-struct gpio_irq_event_request {
-	__u8	which;
-};
-/* irq event response has no payload */
-
-
 /* I2C */
 struct i2c_functionality_rsp {
 	__le32	functionality;
@@ -205,22 +130,22 @@ struct op_msg {
 	struct op_header	header;
 	union {
 		struct protocol_version_rsp		pv_rsp;
-		struct gpio_line_count_rsp		gpio_lc_rsp;
-		struct gpio_activate_req		gpio_act_req;
-		struct gpio_deactivate_req		gpio_deact_req;
-		struct gpio_get_direction_req		gpio_get_dir_req;
-		struct gpio_get_direction_rsp		gpio_get_dir_rsp;
-		struct gpio_direction_input_req		gpio_dir_input_req;
-		struct gpio_direction_output_req	gpio_dir_output_req;
-		struct gpio_get_value_req		gpio_get_val_req;
-		struct gpio_get_value_rsp		gpio_get_val_rsp;
-		struct gpio_set_value_req		gpio_set_val_req;
-		struct gpio_set_debounce_req		gpio_set_db_req;
-		struct gpio_irq_type_request		gpio_irq_type_req;
-		struct gpio_irq_mask_request		gpio_irq_mask_req;
-		struct gpio_irq_unmask_request		gpio_irq_unmask_req;
-		struct gpio_irq_ack_request		gpio_irq_ack_req;
-		struct gpio_irq_event_request		gpio_irq_event_req;
+		struct gb_gpio_line_count_response	gpio_lc_rsp;
+		struct gb_gpio_activate_request		gpio_act_req;
+		struct gb_gpio_deactivate_request	gpio_deact_req;
+		struct gb_gpio_get_direction_request	gpio_get_dir_req;
+		struct gb_gpio_get_direction_response	gpio_get_dir_rsp;
+		struct gb_gpio_direction_in_request	gpio_dir_input_req;
+		struct gb_gpio_direction_out_request	gpio_dir_output_req;
+		struct gb_gpio_get_value_request	gpio_get_val_req;
+		struct gb_gpio_get_value_response	gpio_get_val_rsp;
+		struct gb_gpio_set_value_request	gpio_set_val_req;
+		struct gb_gpio_set_debounce_request	gpio_set_db_req;
+		struct gb_gpio_irq_type_request		gpio_irq_type_req;
+		struct gb_gpio_irq_mask_request		gpio_irq_mask_req;
+		struct gb_gpio_irq_unmask_request	gpio_irq_unmask_req;
+		struct gb_gpio_irq_ack_request		gpio_irq_ack_req;
+		struct gb_gpio_irq_event_request	gpio_irq_event_req;
 		struct i2c_functionality_rsp		i2c_fcn_rsp;
 		struct i2c_transfer_req			i2c_xfer_req;
 		struct i2c_transfer_rsp			i2c_xfer_rsp;
diff --git a/gpio.c b/gpio.c
index ca413c8..3d9acf0 100644
--- a/gpio.c
+++ b/gpio.c
@@ -76,7 +76,7 @@ void gpio_handler(__u8 *rbuf, size_t size)
 		break;
 	case GB_GPIO_TYPE_LINE_COUNT:
 		op_rsp->header.size = sizeof(struct op_header) +
-				   sizeof(struct gpio_line_count_rsp);
+				   sizeof(struct gb_gpio_line_count_response);
 		op_rsp->header.id = oph->id;
 		op_rsp->header.type = OP_RESPONSE | GB_GPIO_TYPE_LINE_COUNT;
 		op_rsp->header.result = PROTOCOL_STATUS_SUCCESS;
@@ -111,7 +111,7 @@ void gpio_handler(__u8 *rbuf, size_t size)
 		break;
 	case GB_GPIO_TYPE_GET_DIRECTION:
 		op_rsp->header.size = sizeof(struct op_header) +
-				   sizeof(struct gpio_get_direction_rsp);
+				   sizeof(struct gb_gpio_get_direction_response);
 		op_rsp->header.id = oph->id;
 		op_rsp->header.type = OP_RESPONSE | GB_GPIO_TYPE_GET_DIRECTION;
 		op_rsp->header.result = PROTOCOL_STATUS_SUCCESS;
@@ -157,7 +157,7 @@ void gpio_handler(__u8 *rbuf, size_t size)
 		break;
 	case GB_GPIO_TYPE_GET_VALUE:
 		op_rsp->header.size = sizeof(struct op_header) +
-				   sizeof(struct gpio_get_value_rsp);
+				   sizeof(struct gb_gpio_get_value_response);
 		op_rsp->header.id = oph->id;
 		op_rsp->header.type = OP_RESPONSE | GB_GPIO_TYPE_GET_VALUE;
 		op_rsp->header.result = PROTOCOL_STATUS_SUCCESS;
