Smartcore commit. IDE fixup for cs5530.

Enable debug prints to try to find etherboot problems Smartcore fixes.
This commit is contained in:
Ronald G. Minnich 2002-09-10 14:57:40 +00:00
parent 6415f2997f
commit 6fa605c210
9 changed files with 63 additions and 34 deletions

View file

@ -85,13 +85,13 @@ void jmp_to_elf_entry(void *entry, unsigned long buffer)
adjusted_boot_notes = (unsigned long)&elf_boot_notes;
adjusted_boot_notes += adjust;
printk_spew("entry = 0x%08lx\n", (unsigned long)entry);
printk_spew("lb_start = 0x%08lx\n", lb_start);
printk_spew("lb_size = 0x%08lx\n", lb_size);
printk_spew("adjust = 0x%08lx\n", adjust);
printk_spew("buffer = 0x%08lx\n", buffer);
printk_spew(" elf_boot_notes = 0x%08lx\n", (unsigned long)&elf_boot_notes);
printk_spew("adjusted_boot_notes = 0x%08lx\n", adjusted_boot_notes);
printk_info("entry = 0x%08lx\n", (unsigned long)entry);
printk_info("lb_start = 0x%08lx\n", lb_start);
printk_info("lb_size = 0x%08lx\n", lb_size);
printk_info("adjust = 0x%08lx\n", adjust);
printk_info("buffer = 0x%08lx\n", buffer);
printk_info(" elf_boot_notes = 0x%08lx\n", (unsigned long)&elf_boot_notes);
printk_info("adjusted_boot_notes = 0x%08lx\n", adjusted_boot_notes);
/* Jump to kernel */
__asm__ __volatile__(

View file

@ -570,19 +570,22 @@ int elfload(struct stream *stream, struct lb_memory *mem,
if (!load_elf_segments(&head, stream, header, header_size))
goto out;
printk_info("Loaded segments\n");
/* Verify the loaded image */
/*
if (!verify_loaded_image(cb_chain, ehdr, phdr, &head))
goto out;
/*
*/
printk_info("verified segments\n");
/* Shutdown the stream device */
stream->fini();
printk_info("closed down stream\n");
/* Reset to booting from this image as late as possible */
boot_successful();
printk_debug("Jumping to boot code\n");
printk_debug("Jumping to boot code at 0x%x\n", entry);
post_code(0xfe);
/* Jump to kernel */

View file

@ -52,7 +52,7 @@ option CS5530_PRIMARY_IDE=1
########################################################################
option NO_KEYBOARD
option NO_KEYBOARD=1
option FINAL_MAINBOARD_FIXUP=1
object mainboard.o
object irq_tables.o

View file

@ -29,6 +29,7 @@ option ZKERNEL_START=0xfffc0000
option ZKERNEL_MASK=0x7f
option L440BX=1
option SMC_BASE=0x3F0
option CONFIG_UDELAY_TSC
object mainboard.o
object irq_tables.o

View file

@ -180,4 +180,5 @@ void mainboard_fixup()
__rdtsc_delay2(1000000000UL, pm_io);
}
#endif
southbridge_fixup();
}

View file

@ -29,6 +29,8 @@ option ZKERNEL_START=0xfffc0000
option ZKERNEL_MASK=0x7f
option L430TX
option SMC_BASE=0x3F0
option CONFIG_UDELAY_TSC
object mainboard.o
object irq_tables.o

View file

@ -99,7 +99,7 @@ int ide_read_data(unsigned base, void * buf, size_t size)
register unsigned short * ptr = (unsigned short *) buf;
if (wait_for_dataready(base)) {
printk_debug("data not ready...\n");
printk_info("data not ready...\n");
return 1;
}
@ -151,7 +151,7 @@ static int init_drive(unsigned base, int driveno)
if ((inb_p(IDE_REG_STATUS(base)) & 1) != 0) {
/* Well, if that command didn't work, we probably don't have drive. */
printk_debug("Drive %d: detect FAILED\n", driveno);
printk_info("Drive %d: detect FAILED\n", driveno);
return 1;
}
ide_read_data(base, buffer, IDE_SECTOR_SIZE);
@ -165,16 +165,16 @@ static int init_drive(unsigned base, int driveno)
memcpy(harddisk_info[driveno].model_number, ((unsigned short*)&(drive_info[27])), 40);
harddisk_info[driveno].drive_exists = 1;
printk_debug("%s \n", harddisk_info[driveno].model_number);
printk_info("%s \n", harddisk_info[driveno].model_number);
printk_debug(__FUNCTION__ " sectors_per_track=[%d], num_heads=[%d], num_cylinders=[%d]\n",
printk_info(__FUNCTION__ " sectors_per_track=[%d], num_heads=[%d], num_cylinders=[%d]\n",
harddisk_info[driveno].num_sectors_per_track,
harddisk_info[driveno].num_heads,
harddisk_info[driveno].num_cylinders);
#define HD harddisk_info[driveno]
if(drive_info[49] != 0) {
printk_debug("IDE%d %d/%d/%d cap: %04x\n",
printk_info("IDE%d %d/%d/%d cap: %04x\n",
(int)driveno,
(int)HD.num_heads, (int)HD.num_cylinders,
(int)HD.num_sectors_per_track,
@ -248,18 +248,18 @@ static int init_drive(unsigned base, int driveno)
#if 0
/* Exercise the drive to see if it works OK */
printk_debug("Exercising HardDisk- buffer=0x%08lX\n", (unsigned long) buffer);
printk_info("Exercising HardDisk- buffer=0x%08lX\n", (unsigned long) buffer);
outb_p(0x42, 0xeb);
while (1) {
for (idx = 0; idx < harddisk_info[driveno].num_sectors; ++idx) {
outb_p(idx & 0xFF, 0x80);
retval = ide_read_sector(driveno, buffer, idx);
if (retval != 0) {
printk_debug("readsector(driveno=%d, sector=%lu) returned %d!\n",
printk_info("readsector(driveno=%d, sector=%lu) returned %d!\n",
driveno, (unsigned long) idx, retval);
}
}
printk_debug("Exercise complete!\n");
printk_info("Exercise complete!\n");
outb(0x42, 0xeb);
}
#endif /* 0 */
@ -274,12 +274,12 @@ static int init_controller(unsigned base, int basedrive) {
/* First, check to see if the controller even exists */
outb_p(0x5, IDE_REG_SECTOR_COUNT(base));
if (inb_p(IDE_REG_SECTOR_COUNT(base)) != 0x5) {
printk_debug("Controller %d: detect FAILED (1)\n", basedrive / 2);
printk_info("Controller %d: detect FAILED (1)\n", basedrive / 2);
return -1;
}
outb_p(0xA, IDE_REG_SECTOR_COUNT(base));
if (inb_p(IDE_REG_SECTOR_COUNT(base)) != 0xA) {
printk_debug("Controller %d: detect FAILED (2)\n", basedrive / 2);
printk_info("Controller %d: detect FAILED (2)\n", basedrive / 2);
return -2;
}
@ -299,10 +299,10 @@ static int init_controller(unsigned base, int basedrive) {
int ide_init(void)
{
outb_p(0x42, 0xEB);
printk_debug ("I am now initializing the ide system\n");
printk_info ("I am now initializing the ide system\n");
if (init_controller(IDE_BASE1, 0) < 0) {
printk_debug ("Initializing the main controller failed!\n");
printk_info ("Initializing the main controller failed!\n");
/* error return error */
return -1;
};
@ -332,13 +332,13 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
int address_mode = harddisk_info[drive].address_mode;
//int i;
//printk_debug(__FUNCTION__ " drive[%d], buffer[%08x], block[%08x], offset[%d], n_bytes[%d]\n",
// drive, buffer, block, byte_offset, n_bytes);
// printk_debug(__FUNCTION__ " block(%08x) to addr(%08x)\r", block, (int)buffer);
printk_info(__FUNCTION__ " drive[%d], buffer[%08x], block[%08x], offset[%d], n_bytes[%d]\n",
drive, buffer, block, byte_offset, n_bytes);
printk_info(__FUNCTION__ " block(%08x) to addr(%08x)\r", block, (int)buffer);
if ((drive < 0) || (drive >= NUM_HD) ||
(harddisk_info[drive].drive_exists == 0))
{
printk_debug("unknown drive\n");
printk_info("unknown drive\n");
return 1;
}
base = harddisk_info[drive].controller_port;
@ -360,9 +360,8 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
IDE_DH_HEAD(track % harddisk_info[drive].num_heads) |
IDE_DH_DRIVE(drive) |
IDE_DH_CHS;
printk_info(__FUNCTION__ " CHS: track=[%d], sector_number=[%d], cylinder=[%d]\n", track, cmd.sector_number, cmd.cylinder);
/*
printk_debug(__FUNCTION__ " CHS: track=[%d], sector_number=[%d], cylinder=[%d]\n",
track, cmd.sector_number, cmd.cylinder);
*/
} else {
#if 1
@ -380,15 +379,15 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
IDE_DH_DRIVE(drive) |
IDE_DH_LBA;
#endif
/*
printk_debug(__FUNCTION__ " LBA: drivehead[%0x], cylinder[%04x], sector[%0x], block[%8x]\n",
printk_info(__FUNCTION__ " LBA: drivehead[%0x], cylinder[%04x], sector[%0x], block[%8x]\n",
cmd.drivehead, cmd.cylinder, cmd.sector_number, block & 0x0fffffff);
/*
*/
}
write_command(base, IDE_CMD_READ_MULTI_RETRY, &cmd);
if ((inb_p(IDE_REG_STATUS(base)) & 1) != 0) {
printk_debug("ide not ready...\n");
printk_info("ide not ready...\n");
return 1;
}
if (n_bytes != IDE_SECTOR_SIZE) {
@ -435,8 +434,8 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
IDE_DH_DRIVE(drive) |
IDE_DH_CHS;
// printk_debug(__FUNCTION__ " track=[%d], sector_number=[%d], cylinder=[%d]\n",
// track, cmd.sector_number, cmd.cylinder);
printk_info(__FUNCTION__ " track=[%d], sector_number=[%d], cylinder=[%d]\n",
track, cmd.sector_number, cmd.cylinder);
write_command(base, IDE_CMD_READ_MULTI_RETRY, &cmd);
if ((inb_p(IDE_REG_STATUS(base)) & 1) != 0) {
return 1;
@ -449,7 +448,7 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
} else {
status = ide_read_data(base, buffer, IDE_SECTOR_SIZE);
}
// printk_debug(__FUNCTION__ " status = [%d]\n", status);
printk_info(__FUNCTION__ " status = [%d]\n", status);
return status;
}
#endif

View file

@ -20,9 +20,19 @@ southbridge_fixup()
pci_read_config_word(pcidev, 0x41, &c);
c |= 0x80;
pci_write_config_word(pcidev, 0x41, &c);
pci_read_config_word(pcidev, 0x43, &c);
c |= 0x80;
pci_write_config_word(pcidev, 0x43, &c);
printk_info("Enabled IDE for channels 1 and 2\n");
#if (CONFIG_LINUXBIOS_LEGACY_IDE == 1)
printk_info("Enabling Legacy IDE\n");
pci_read_config_word(pcidev, 4, &c);
c |= 1;
pci_write_config_word(pcidev, 4, &c);
pci_read_config_word(pcidev, 4, &c);
printk_info("Word at 4 is now 0x%x\n", c);
#endif
}
printk_info("done.\n");

View file

@ -38,6 +38,19 @@ void nvram_on()
// now set PCI decode
pci_read_config_byte(dev, 0x5b, &b);
b |= 1 << 5;
/* why would you ever turn these off? */
#define CONFIG_CS5530_PRIMARY_IDE
#define CONFIG_CS5530_SECONDARY_IDE
#ifdef CONFIG_CS5530_PRIMARY_IDE
printk_info(NAME "Enabling Primary IDE Controller\n");
b |= 1<<3;
#endif
#ifdef CONFIG_CS5530_SECONDARY_IDE
printk_info(NAME "Enabling Secondary IDE Controller\n");
b |= 1<<4;
#endif
printk_debug("Set F0/0x5b to |= 1 << 5(0x%x)\n", b);
pci_write_config_byte(dev, 0x5b, b);