Add start of PCI and AHCI drivers
diff --git a/README.md b/README.md
index 09b62a7..e7ed2a1 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,9 @@
 - [ ] Filesystem
   - [x] Virtual file system
   - [x] Initial ramdisk
-  - [ ] ATA/SATA drivers
+  - [ ] Storage device drivers
+    - [x] ATA PIO
+    - [ ] SATA
   - [ ] Filesystem drivers
     - [ ] EXT2
     - [ ] FAT32
@@ -39,6 +41,12 @@
   - [ ] Lisp API
 - [ ] Graphical subsystem
   - [ ] Graphical environment in Lisp
+- [ ] Network stack in Lisp
+  - [ ] Ethernet driver
+  - [ ] IP
+  - [ ] TCP
+    - [ ] Graphical applications like browser, IRC client
+  - [ ] UDP
 
 ## Documentation
 
diff --git a/include/kernel/dri/ahci/ahci.h b/include/kernel/dri/ahci/ahci.h
new file mode 100644
index 0000000..6f70f09
--- /dev/null
+++ b/include/kernel/dri/ahci/ahci.h
@@ -0,0 +1 @@
+#pragma once
diff --git a/include/kernel/dri/pci/pci.h b/include/kernel/dri/pci/pci.h
new file mode 100644
index 0000000..196a525
--- /dev/null
+++ b/include/kernel/dri/pci/pci.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <kint.h>
+
+struct pci_config_address
+{
+	union
+	{
+		struct
+		{
+			int enable : 1;
+			int reserved : 7;
+			int bus : 8;
+			int device : 5;
+			int function : 3;
+			// Offset into the 256 byte register. Least significant two bits must be zero.
+			int offset : 8;
+		};
+
+		uint packed;
+	};
+	
+} __attribute__((packed));
+
+ushort pci_config_readw(uchar bus, uchar slot, uchar func, uchar offset);
diff --git a/include/kernel/io.h b/include/kernel/io.h
index 85f2e8c..136c4f9 100644
--- a/include/kernel/io.h
+++ b/include/kernel/io.h
@@ -16,8 +16,10 @@
 extern struct kbd_scan_code_info scan_code_table[0xff];
 
 void outb(ushort port, uchar val);
+void outl(ushort port, uint val);
 uchar inb(ushort port);
 ushort inw(ushort port);
+uint inl(ushort port);
 
 /* Random string.h stuff, TODO: move to own header */
 void *memset(void *s, int c, size_t n);
diff --git a/src/kernel/dri/ahci/Jmk b/src/kernel/dri/ahci/Jmk
new file mode 100644
index 0000000..dd2d4be
--- /dev/null
+++ b/src/kernel/dri/ahci/Jmk
@@ -0,0 +1,17 @@
+init(ahci, ahci.a)
+
+preset(freestanding)
+preset(optimize)
+preset(debug)
+preset(32)
+preset(warn)
+
+CFLAGS += -I $(ROOT)/include/kernel
+
+archetype(c)
+
+OBJECTS = ahci.o
+
+type(static_lib)
+
+finish
diff --git a/src/kernel/dri/ahci/ahci.c b/src/kernel/dri/ahci/ahci.c
new file mode 100644
index 0000000..1f5e1c3
--- /dev/null
+++ b/src/kernel/dri/ahci/ahci.c
@@ -0,0 +1 @@
+#include <dri/ahci.h>
diff --git a/src/kernel/dri/pci/Jmk b/src/kernel/dri/pci/Jmk
new file mode 100644
index 0000000..07b50d2
--- /dev/null
+++ b/src/kernel/dri/pci/Jmk
@@ -0,0 +1,17 @@
+init(pci, pci.a)
+
+preset(freestanding)
+preset(optimize)
+preset(debug)
+preset(32)
+preset(warn)
+
+CFLAGS += -I $(ROOT)/include/kernel
+
+archetype(c)
+
+OBJECTS = pci.o
+
+type(static_lib)
+
+finish
diff --git a/src/kernel/dri/pci/pci.c b/src/kernel/dri/pci/pci.c
new file mode 100644
index 0000000..09c9056
--- /dev/null
+++ b/src/kernel/dri/pci/pci.c
@@ -0,0 +1,13 @@
+#include <dri/pci.h>
+
+ushort pci_config_readw(uchar bus, uchar slot, uchar func, uchar offset)
+{
+	struct pci_config_address address =
+	{
+		.enabled = 1,
+		.bus = bus,
+		.device = slot,
+		.function = func,
+		.offset = offset ^ 0b11,
+	};
+}
diff --git a/src/kernel/io.c b/src/kernel/io.c
index 4f7d3d3..90a365c 100644
--- a/src/kernel/io.c
+++ b/src/kernel/io.c
@@ -30,6 +30,18 @@
 	return ret;
 }
 
+void outl(ushort port, uint val)
+{
+	asm volatile("outl %1, %0" : : "dN"(port), "a"(val));
+}
+
+uint inl(ushort port)
+{
+	uint ret;
+	asm volatile("inl %1, %0" : "=a"(ret) : "dN"(port));
+	return ret;
+}
+
 void *memset(void *s, int c, size_t n)
 {
 	for (size_t i = 0; i < n; i++)