3 unsigned long memsz[] = {
24 void smram_aseg_dump(void) {
26 unsigned char smramc, drp, drp2;
30 smramc = pci_read8(0, 0, 0, SMRAMC);
31 drp = pci_read8(0, 0, 0, DRP);
32 drp2 = pci_read8(0, 0, 0, DRP2);
34 printf("SMRAMC: %02x\n", smramc);
36 tom += memsz[drp & 0xF];
37 tom += memsz[drp >> 4];
38 tom += memsz[drp2 & 0xF];
40 printf("Top of DRAM: %08x\n", tom);
42 usmm = (smramc >> 4) & 0x3;
43 lsmm = (smramc >> 2) & 0x3;
48 printf("TSEG and HSEG both off\n");
51 printf("TSEG off, HSEG %s\n", lsmm ? "off" : "on");
54 printf("TSEG 512KB (%08x - %08x), HSEG %s\n",
55 tom - 512 * 1024, tom - 1, lsmm ? "off" : "on");
58 printf("TSEG 1MB (%08x - %08x), HSEG %s\n",
59 tom - 1 * 1024 * 1024, tom - 1, lsmm ? "off" : "on");
66 printf("ABSEG disabled\n");
69 printf("ABSEG enabled as system RAM\n");
72 printf("ABSEG enabled for SMM code only\n");
75 printf("ABSEG enabled for both SMM code and data\n");
81 int smram_aseg_set_state (int open) {
83 smramc = pci_read8(0, 0, 0, SMRAMC);
85 if (smramc & SMRAMC_LOCK)
87 /* SMRAM is locked; can't load anything. */
92 /* Set LSMM to 01 (ABseg = system RAM) */
93 smramc = (smramc & 0xF0) | 0x04;
95 /* Set LSMM to 11 (ABseg = SMM RAM) */
96 smramc = (smramc & 0xF0) | 0x0C;
99 pci_write8(0, 0, 0, SMRAMC);