Index: uspace/srv/bd/ata_bd/ata_bd.c
===================================================================
--- uspace/srv/bd/ata_bd/ata_bd.c	(revision 0d247f5e064308de35b22a948ee6b049771527da)
+++ uspace/srv/bd/ata_bd/ata_bd.c	(revision bb0eab1891f2101c5a0213a586259f5a5bca0a2a)
@@ -56,4 +56,5 @@
 #include <as.h>
 #include <fibril_synch.h>
+#include <stdint.h>
 #include <str.h>
 #include <devmap.h>
@@ -62,4 +63,5 @@
 #include <errno.h>
 #include <bool.h>
+#include <byteorder.h>
 #include <task.h>
 #include <macros.h>
@@ -368,5 +370,5 @@
 	identify_data_t idata;
 	uint8_t model[40];
-	uint8_t inq_buf[36];
+	ata_inquiry_data_t inq_data;
 	uint16_t w;
 	uint8_t c;
@@ -471,5 +473,5 @@
 	if (d->dev_type == ata_pkt_dev) {
 		/* Send inquiry. */
-		rc = ata_pcmd_inquiry(0, inq_buf, 36);
+		rc = ata_pcmd_inquiry(0, &inq_data, sizeof(inq_data));
 		if (rc != EOK) {
 			printf("Device inquiry failed.\n");
@@ -479,15 +481,6 @@
 
 		/* Check device type. */
-		if ((inq_buf[0] & 0x1f) != 0x05)
+		if (INQUIRY_PDEV_TYPE(inq_data.pdev_type) != PDEV_TYPE_CDROM)
 			printf("Warning: Peripheral device type is not CD-ROM.\n");
-
-		/* XXX Test some reading */
-		uint8_t rdbuf[4096];
-		rc = ata_pcmd_read_12(0, 0, 1, rdbuf, 4096);
-		if (rc != EOK) {
-			printf("read(12) failed\n");
-		} else {
-			printf("read(12) succeeded\n");
-		}
 
 		/* Assume 2k block size for now. */
@@ -714,5 +707,4 @@
 	data_size = (uint16_t) pio_read_8(&cmd->cylinder_low) +
 	    ((uint16_t) pio_read_8(&cmd->cylinder_high) << 8);
-	printf("data_size = %u\n", data_size);
 
 	/* Check whether data fits into output buffer. */
@@ -749,12 +741,13 @@
 static int ata_pcmd_inquiry(int dev_idx, void *obuf, size_t obuf_size)
 {
-	uint8_t cp[12];
+	ata_pcmd_inquiry_t cp;
 	int rc;
 
-	memset(cp, 0, 12);
-	cp[0] = 0x12; /* Inquiry */
-	cp[4] = min(obuf_size, 0xff); /* Allocation length */
-
-	rc = ata_cmd_packet(0, cp, 12, obuf, obuf_size);
+	memset(&cp, 0, sizeof(cp));
+
+	cp.opcode = PCMD_INQUIRY;
+	cp.alloc_len = min(obuf_size, 0xff); /* Allocation length */
+
+	rc = ata_cmd_packet(0, &cp, sizeof(cp), obuf, obuf_size);
 	if (rc != EOK)
 		return rc;
@@ -766,23 +759,17 @@
     void *obuf, size_t obuf_size)
 {
-	uint8_t cp[12];
+	ata_pcmd_read_12_t cp;
 	int rc;
 
-	if (ba > 0xffffffff)
+	if (ba > UINT32_MAX)
 		return EINVAL;
 
-	memset(cp, 0, 12);
-	cp[0] = 0xa8; /* Read(12) */
-	cp[2] = (ba >> 24) & 0xff;
-	cp[3] = (ba >> 16) & 0xff;
-	cp[4] = (ba >> 8) & 0xff;
-	cp[5] = ba & 0xff;
-
-	cp[6] = (cnt >> 24) & 0xff;
-	cp[7] = (cnt >> 16) & 0xff;
-	cp[8] = (cnt >> 8) & 0xff;
-	cp[9] = cnt & 0xff;
-
-	rc = ata_cmd_packet(0, cp, 12, obuf, obuf_size);
+	memset(&cp, 0, sizeof(cp));
+
+	cp.opcode = PCMD_READ_12;
+	cp.ba = host2uint32_t_be(ba);
+	cp.nblocks = host2uint32_t_be(cnt);
+
+	rc = ata_cmd_packet(0, &cp, sizeof(cp), obuf, obuf_size);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/bd/ata_bd/ata_hw.h
===================================================================
--- uspace/srv/bd/ata_bd/ata_hw.h	(revision 0d247f5e064308de35b22a948ee6b049771527da)
+++ uspace/srv/bd/ata_bd/ata_hw.h	(revision bb0eab1891f2101c5a0213a586259f5a5bca0a2a)
@@ -241,4 +241,56 @@
 };
 
+/** ATA packet command codes. */
+enum ata_pkt_command {
+	PCMD_INQUIRY		= 0x12,
+	PCMD_READ_12		= 0xa8
+};
+
+/** ATAPI Inquiry command */
+typedef struct {
+	uint8_t opcode;		/**< Operation code (PCMD_INQUIRY) */
+	uint8_t _res0;
+	uint8_t _res1;
+	uint8_t _res2;
+	uint8_t alloc_len;	/**< Allocation length */
+	uint8_t _res3;
+	uint8_t _res4;
+	uint8_t _res5;
+	uint32_t _res6;
+} __attribute__ ((packed)) ata_pcmd_inquiry_t;
+
+/** ATAPI Read(12) command */
+typedef struct {
+	uint8_t opcode;		/**< Operation code (PCMD_READ_12) */
+	uint8_t _res0;
+	uint32_t ba;		/**< Starting block address */
+	uint32_t nblocks;	/**< Number of blocks to transfer */
+	uint8_t _res1;
+	uint8_t _res2;
+} __attribute__ ((packed)) ata_pcmd_read_12_t;
+
+/** Data returned from Inquiry command (mandatory part) */
+typedef struct {
+	uint8_t pdev_type;	/** Reserved, Peripheral device type */
+	uint8_t rmb;		/** RMB, Reserved */
+	uint8_t std_version;	/** ISO version, ECMA version, ANSI version */
+	uint8_t atapi_ver_rdf;	/** ATAPI version, Response data format */
+	uint8_t additional_len;	/** Additional length */
+	uint8_t _res0;
+	uint8_t _res1;
+	uint8_t _res2;
+	uint8_t vendor_id[8];	/** Vendor ID */
+	uint8_t product_id[8];	/** Product ID */
+	uint8_t product_rev[4];	/** Product revision level */
+} ata_inquiry_data_t;
+
+/** Extract value of ata_inquiry_data_t.pdev_type */
+#define INQUIRY_PDEV_TYPE(val) ((val) & 0x1f)
+
+/** Values for ata_inquiry_data_t.pdev_type */
+enum ata_pdev_type {
+	PDEV_TYPE_CDROM		= 0x05
+};
+
 #endif
 
