[coreboot] patch: first steps to VSA support in v3

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Jan 24 19:06:44 CET 2008


On 23.01.2008 20:19, ron minnich wrote:
> On Jan 23, 2008 11:06 AM, Marc Jones <marc.jones at amd.com> wrote:
>   
>> BUT, I don't think that you need them. VSA should default to reasonable
>> settings without the in15 calls. I need to test it in v2 this afternoon.
>> If VSA does require them I would rather change VSA. There is no reason
>> it can't get the pci speed and cpu speed from the MSRs. Either way, i
>> don't think you need to add it to v3.
>>     
>
> patch now has those two un-needed functions removed. Can you verify
> that vsa will do the right thing? I think I had to put these in as the
> calls were being made.
>   

Some comments about the code:

> This is a first cut at the implementation of VSM support. What has do be done, long term, 
> is to remove almost all of the vsmsetup.c file and use functions in the vm86.c file. 
>
> The barrier to achieving that goal is the specialized nature of the vga bios support
> code vs. the vsm bios support code. There are a few issues to resolve but what I'd like
> to do is get VSA working first, then work out how to merge the rest of the code. 
>
> I have already done some merging at this point. 
>
> vsmsetup.c: Add this file from v2. Fix copyright and includes. 
> Remove almost all assembly code in favor of code in vm86.c
>
> vm86.c: make some assembly symbols .globl so that vmssetup.c can use them. 
>
> Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
>
> Index: northbridge/amd/geodelx/vsmsetup.c
> ===================================================================
> --- northbridge/amd/geodelx/vsmsetup.c	(revision 0)
> +++ northbridge/amd/geodelx/vsmsetup.c	(revision 0)
> @@ -0,0 +1,302 @@
> +/*
> + *  Erik Arjan Hendriks <hendriks at lanl.gov>
>   

Missing "copyright"?

> + *  Copyright (C) 2000 Scyld.
> + *  Copyright (C) 2000 Scyld Computing Corporation
> + *  Copyright (C) 2001 University of California.  LA-CC Number 01-67.
>   

Is LA-CC "Los Alamos Computer Code"?

> + *  Copyright (C) 2005 Nick.Barker9 at btinternet.com
> + *  Copyright (C) 2007 coresystems GmbH
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> + *
> + */
> [...]
> +void do_vsmbios(void *bios)
> +{
> +	struct device *dev;
> +	unsigned long busdevfn;
> +	unsigned int rom = 0;
> +	unsigned char *buf;
> +	unsigned int size = SMM_SIZE * 1024;
> +	int i;
> +	unsigned long ilen, olen;
> +
> +	printk(BIOS_ERR, "do_vsmbios\n");
> +	/* clear vsm bios data area */
> +	for (i = 0x400; i < 0x500; i++) {
> +		*(volatile unsigned char *)i = 0;
> +	}
> +
> +	rom = (unsigned long) bios;
> +	buf = (unsigned char *)VSA2_BUFFER;
> +	// FIXME
> +	//olen = unrv2b((u8 *) rom, buf, &ilen);
>   

How exactly is the VSA going to end up in VSA2_BUFFER if you don't
copy/uncompress it there?

> +	printk(BIOS_DEBUG, "buf ilen %d olen%d\n", ilen, olen);
> +	printk(BIOS_DEBUG, "buf %p *buf %d buf[256k] %d\n",
> +		     buf, buf[0], buf[SMM_SIZE * 1024]);
> +	printk(BIOS_DEBUG, "buf[0x20] signature is %x:%x:%x:%x\n",
> +		     buf[0x20], buf[0x21], buf[0x22], buf[0x23]);
> +	/* check for post code at start of vsainit.bin. If you don't see it,
> +	   don't bother. */
> +	if ((buf[0x20] != 0xb0) || (buf[0x21] != 0x10) ||
> +	    (buf[0x22] != 0xe6) || (buf[0x23] != 0x80)) {
> +		printk(BIOS_ERR, "do_vsmbios: no vsainit.bin signature, skipping!\n");
> +		return;
> +	}
> +
> +	/* ecx gets smm, edx gets sysm */
> +	printk(BIOS_ERR, "Call real_mode_switch_call_vsm\n");
> +	real_mode_switch_call_vsm(MSR_GLIU0_SMM, MSR_GLIU0_SYSMEM);
> +
> +	/* restart timer 1 */
> +	outb(0x56, 0x43);
> +	outb(0x12, 0x41);
> +
> +	// check that VSA is running OK
> +	if (VSA_vrRead(SIGNATURE) == VSA2_SIGNATURE)
> +		printk(BIOS_DEBUG, "do_vsmbios: VSA2 VR signature verified\n");
> +	else
> +		printk(BIOS_ERR, 
> +		       "do_vsmbios: VSA2 VR signature not valid, install failed!\n");
> +}
> +

Rest looks good so far from a first glance.


Regards,
Carl-Daniel




More information about the coreboot mailing list