7 static unsigned long memsz[] = {
26 void smram_aseg_dump(void) {
28 unsigned char smramc, drp, drp2;
32 smramc = pci_read8(0, 0, 0, SMRAMC);
33 drp = pci_read8(0, 0, 0, DRP);
34 drp2 = pci_read8(0, 0, 0, DRP2);
36 printf("SMRAMC: %02x\n", smramc);
38 tom += memsz[drp & 0xF];
39 tom += memsz[drp >> 4];
40 tom += memsz[drp2 & 0xF];
42 printf("Top of DRAM: %08x\n", tom);
44 usmm = (smramc >> 4) & 0x3;
45 lsmm = (smramc >> 2) & 0x3;
50 printf("TSEG and HSEG both off\n");
53 printf("TSEG off, HSEG %s\n", lsmm ? "off" : "on");
56 printf("TSEG 512KB (%08x - %08x), HSEG %s\n",
57 tom - 512 * 1024, tom - 1, lsmm ? "off" : "on");
60 printf("TSEG 1MB (%08x - %08x), HSEG %s\n",
61 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");
85 unsigned char smramc = pci_read8(0, 0, 0, SMRAMC);
87 return (smramc & SMRAMC_LOCK) ? 1 : 0;
90 smram_state_t smram_save_state()
92 return pci_read8(0, 0, 0, SMRAMC);
95 void smram_restore_state(smram_state_t state)
97 pci_write8(0, 0, 0, SMRAMC, state);
100 int smram_aseg_set_state (int open) {
101 unsigned char smramc;
106 smramc = pci_read8(0, 0, 0, SMRAMC);
110 case SMRAM_ASEG_CLOSED:
111 smramc = (smramc & 0xF0) | 0x00;
113 case SMRAM_ASEG_OPEN:
114 smramc = (smramc & 0xF0) | 0x04;
116 case SMRAM_ASEG_SMMCODE:
117 smramc = (smramc & 0xF0) | 0x08;
119 case SMRAM_ASEG_SMMONLY:
120 smramc = (smramc & 0xF0) | 0x0C;
126 pci_write8(0, 0, 0, SMRAMC, smramc);