4.2. Big-little endian (we should have known)

4.2.1. Probing the CPC700

Finally, we reached the PCI-probing part of the boot process, only to discover that it didn't work. We tried communicating with the CPC700 using cpc700_read_local_pci_cfgb(), which was supplied along with the PMPPC's LSP, and tried to read CPC's config register. We should have gotten 0x1014, which is the vendor ID, but we didn't. We realized that we were talking little-endian and the CPC was listening in big-endian. We made a small patch to the functions, so that we spoke big-endian to the CPC700. We could then read the vendor ID correctly, but the rest of it still didn't work. We didn't want to alter the code so that everything would be done big-endian style.

4.2.2. Making CPC700 speak little-endian

We discovered that the CPC700 can be initialized to do automatic byte-swapping, which does little-to-big endian convertion on the fly. As it seems, our board was initialized to do just that. We added a small code segment in setup_arch(), which checks if byte-swapping is enabled, and if so, disables it:

while (cnt<2) {
	cpc700_read_local_pci_cfgb(0, );
	cpc700_read_local_pci_cfgb(1, );
	if (l == 0 && h == 0) {
		if (cnt == 0) {
			printk("CPC700 byte swaping enabled - trying to disable ... ");
			cpc700_write_pifcfg_be(0x18, 0); /* disable byte-swapping */
		} else {
			printk("FAILED !!\n");
			break;
		}
	} else {cd
		printk("byte swapping disabled.\n");
		break;
	}
	++cnt;
}
A short compilation later, PCI probing was working! We got some beer and partied ;-)