Add generation for remaining, fix invalid fseek().
diff --git a/generator/sections/gen-section-pci-dev.c b/generator/sections/gen-section-pci-dev.c
new file mode 100644
index 0000000..1882d6c
--- /dev/null
+++ b/generator/sections/gen-section-pci-dev.c
@@ -0,0 +1,37 @@
+/**
+ * Functions for generating psuedo-random CPER PCI component error sections.
+ *
+ * Author: Lawrence.Tang@arm.com
+ **/
+
+#include <stdlib.h>
+#include "../../edk/BaseTypes.h"
+#include "../gen-utils.h"
+#include "gen-sections.h"
+
+//Generates a single psuedo-random PCI component error section, saving the resulting address to the given
+//location. Returns the size of the newly created section.
+size_t generate_section_pci_dev(void** location)
+{
+ //Generate how many register pairs will be attached to this section.
+ UINT32 num_memory_pairs = rand() % 4;
+ UINT32 num_io_pairs = rand() % 4;
+ UINT32 num_registers = num_memory_pairs + num_io_pairs;
+
+ //Create random bytes.
+ int size = 40 + (num_registers * 16);
+ UINT8* bytes = generate_random_bytes(size);
+
+ //Set reserved areas to zero.
+ UINT64* validation = (UINT64*)bytes;
+ *validation &= 0b11111; //Validation 5-63
+ for (int i=0; i<5; i++)
+ *(bytes + 27 + i) = 0; //Bytes 11-15 of ID info.
+
+ //Fix error status.
+ create_valid_error_section(bytes + 8);
+
+ //Set return values, exit.
+ *location = bytes;
+ return size;
+}
\ No newline at end of file