addr = grub_pci_make_address (dev, reg);
space = grub_pci_read (addr);
- reg++;
-
+ reg += sizeof (grub_uint32_t);
-
++
if (space == 0)
continue;
-
+
switch (space & GRUB_PCI_ADDR_SPACE_MASK)
{
case GRUB_PCI_ADDR_SPACE_IO:
int regb;
int i;
static int controller = 0;
+ int cs5536 = 0;
+ int nports = 2;
/* Read class. */
- addr = grub_pci_make_address (dev, 2);
+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
class = grub_pci_read (addr);
+ /* AMD CS5536 Southbridge. */
+ if (pciid == 0x208f1022)
+ {
+ cs5536 = 1;
+ nports = 1;
+ }
+
/* Check if this class ID matches that of a PCI IDE Controller. */
- if (class >> 16 != 0x0101)
+ if (!cs5536 && (class >> 16 != 0x0101))
return 0;
- for (i = 0; i < 2; i++)
+ for (i = 0; i < nports; i++)
{
/* Set to 0 when the channel operated in compatibility mode. */
- int compat = (class >> (8 + 2 * i)) & 1;
+ int compat;
+
+ /* We don't support non-compatibility mode for CS5536. */
+ if (cs5536)
+ compat = 0;
+ else
+ compat = (class >> (8 + 2 * i)) & 1;
rega = 0;
regb = 0;