Skip to contentSkip to conversation

disk/ata.c patch

PATCH Maciej 'Agaran' Pijanka 1 participant 1 message Feb 1, 2008

lore
Share & tools
lore
#0 lore raw

Hello

am trying to get working grub2 as payload for coreboot2 without much success but thats another story but i created that patch maybe anyone finds it usefull or interesting.

Index: disk/ata.c
===================================================================
RCS file: /sources/grub/grub2/disk/ata.c,v
retrieving revision 1.6

ata.c +27 -9
diff -u -r1.6 ata.c
@@ -204,18 +204,36 @@
 grub_ata_dumpinfo (struct grub_ata_device *dev, char *info)
 {
   char text[41];
+  char *s,*p = 0;
 
   /* The device information was read, dump it for debugging.  */
-  grub_ata_strncpy (text, info + 20, 20);
-  grub_printf ("Serial: %s\n", text);
+  grub_ata_strncpy (text, info + 54, 40); // model
+  s=text;
+  while(*s) {
+	  if(*s != ' ')
+		  p = (char *)s;
+	  s++;
+  }
+  *p = '\0';
+  grub_printf("ata%d: Model: %s, ", dev->port * 2 + dev->device, text);
+  grub_ata_strncpy (text, info + 20, 20); // serial
+  s=text;
+  while(*s) {
+	  if(*s != ' ')
+		  p = (char *)s;
+	  s++;
+  }
+  *p = '\0';
+  grub_printf("Serial: %s, ", text);
   grub_ata_strncpy (text, info + 46, 8);
-  grub_printf ("Firmware: %s\n", text);
-  grub_ata_strncpy (text, info + 54, 40);
-  grub_printf ("Model: %s\n", text);
-
-  grub_printf ("Addressing: %d\n", dev->addr);
-  grub_printf ("#sectors: %d\n", dev->size);
-
+  s=text;
+  while(*s) {
+	  if(*s != ' ')
+		  p = (char *)s;
+	  s++;
+  }
+  *p = '\0';
+  grub_printf ("Firmware: %s, Addressing: %d, #sectors: %d\n", text, dev->addr, dev->size);
 }
 
 static grub_err_t

best regards

Signature · 2 lines
agaran at pld dash linux dot org :: PLD Linux Developer [#133161]
I do not fear computers. I fear the lack of them. [Isaac Asimov]