4 unsigned long memsz[] = {
23 int main(int argc, char **argv)
25 unsigned char smramc, drp, drp2;
29 smramc = pci_read8(0, 0, 0, SMRAMC);
30 drp = pci_read8(0, 0, 0, DRP);
31 drp2 = pci_read8(0, 0, 0, DRP2);
33 tom += memsz[drp & 0xF];
34 tom += memsz[drp >> 4];
35 tom += memsz[drp2 & 0xF];
37 printf("Top of DRAM: %08x\n", tom);
39 printf("SMRAMC: %02x\n", smramc);
40 if (smramc & SMRAMC_LOCK)
42 printf("SMRAM is locked, cannot load anything :-(\n");
46 usmm = (smramc >> 4) & 0x3;
47 lsmm = (smramc >> 2) & 0x3;
52 printf("TSEG and HSEG both off\n");
55 printf("TSEG off, HSEG %s\n", lsmm ? "off" : "on");
58 printf("TSEG 512KB (%08x - %08x), HSEG %s\n", tom - 512 * 1024, tom - 1, lsmm ? "off" : "on");
61 printf("TSEG 1MB (%08x - %08x), HSEG %s\n", tom - 1 * 1024 * 1024, tom - 1, lsmm ? "off" : "on");
68 printf("ABSEG disabled\n");
71 printf("ABSEG enabled as system RAM\n");
74 printf("ABSEG enabled for SMM code only\n");
77 printf("ABSEG enabled for both SMM code and data\n");
87 pci_write8(0, 0, 0, SMRAMC, smramc);
88 printf("With any luck, ABSEG is now enabled as system RAM... enjoy!\n");
90 smramc = strtoul(argv[1], 0, 0);
92 pci_write8(0, 0, 0, SMRAMC, smramc);
93 printf("OK, set it up as you like.\n");