From: Jacob Potter Date: Mon, 20 Oct 2008 07:48:59 +0000 (-0400) Subject: add new functions to smram-ich2 X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/2cd64cbf2e235c588ffee9f3de974903d5e7087e?hp=--cc add new functions to smram-ich2 --- 2cd64cbf2e235c588ffee9f3de974903d5e7087e diff --git a/ich2/smram-ich2.c b/ich2/smram-ich2.c index edf8ad5..efc79e6 100644 --- a/ich2/smram-ich2.c +++ b/ich2/smram-ich2.c @@ -2,8 +2,6 @@ #include #include -#ifndef __RAW__ - static unsigned long memsz[] = { 0, // 0 32*1024*1024, // 1 @@ -23,6 +21,44 @@ static unsigned long memsz[] = { 512*1024*1024 // F }; +unsigned int smram_tseg_length(void) { + unsigned char smramc; + int usmm; + + smramc = pci_read8(0, 0, 0, SMRAMC); + + usmm = (smramc >> 4) & 0x3; + + switch (usmm) + { + case 0: + return 0; + case 1: + return 0; + case 2: + return 512 * 1024; + case 3: + return 1024 * 1024; + } + return 0; +} + +void * smram_tseg_start(void) { + unsigned char drp, drp2; + unsigned int tom = 0; + + drp = pci_read8(0, 0, 0, DRP); + drp2 = pci_read8(0, 0, 0, DRP2); + + tom += memsz[drp & 0xF]; + tom += memsz[drp >> 4]; + tom += memsz[drp2 & 0xF]; + + return (void *)(tom - smram_tseg_length()); +} + +#ifndef __RAW__ + void smram_aseg_dump(void) { unsigned char smramc, drp, drp2;