Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2013 15:58:35 -0800
From:      Nathan Whitehorn <nwhitehorn@freebsd.org>
To:        Marcel Moolenaar <marcel@FreeBSD.org>
Cc:        svn-src-projects@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r245399 - projects/altix2/sys/geom/part
Message-ID:  <50F34A2B.3080202@freebsd.org>
In-Reply-To: <201301132336.r0DNaLb7038996@svn.freebsd.org>
References:  <201301132336.r0DNaLb7038996@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Why not make this a GEOM flag?
-Nathan

On 01/13/13 15:36, Marcel Moolenaar wrote:
> Author: marcel
> Date: Sun Jan 13 23:36:21 2013
> New Revision: 245399
> URL: http://svnweb.freebsd.org/changeset/base/245399
> 
> Log:
>   Marking the PMBR as active may be needed for some BIOSes to boot from the
>   disk, but also has some EFI implementations reject the GPT altogether.
>   Make the behaviour controllable by a sysctll and have it default to 1
>   on i386 and amd64 and 0 otherwise. This means that we mark the PMBR as
>   active on i386 and amd64 by default, but remain compliant most of the
>   time.
> 
> Modified:
>   projects/altix2/sys/geom/part/g_part_gpt.c
> 
> Modified: projects/altix2/sys/geom/part/g_part_gpt.c
> ==============================================================================
> --- projects/altix2/sys/geom/part/g_part_gpt.c	Sun Jan 13 23:00:40 2013	(r245398)
> +++ projects/altix2/sys/geom/part/g_part_gpt.c	Sun Jan 13 23:36:21 2013	(r245399)
> @@ -50,6 +50,20 @@ __FBSDID("$FreeBSD$");
>  
>  FEATURE(geom_part_gpt, "GEOM partitioning class for GPT partitions support");
>  
> +SYSCTL_DECL(_kern_geom_part);
> +static SYSCTL_NODE(_kern_geom_part, OID_AUTO, gpt, CTLFLAG_RW, 0,
> +    "gpart GPT controls");
> +
> +#if defined(__i386__) || defined(__amd64__)
> +#define	PMBR_ACTIVE	1
> +#else
> +#define	PMBR_ACTIVE	0
> +#endif
> +
> +static u_int gpt_mark_pmbr_active = PMBR_ACTIVE;
> +SYSCTL_UINT(_kern_geom_part_gpt, OID_AUTO, mark_pmbr_active, CTLFLAG_RW,
> +    &gpt_mark_pmbr_active, 0, "Mark the PMBR active on creation");
> +
>  CTASSERT(offsetof(struct gpt_hdr, padding) == 92);
>  CTASSERT(sizeof(struct gpt_ent) == 128);
>  
> @@ -1040,7 +1054,8 @@ g_part_gpt_write(struct g_part_table *ba
>  		gpt_write_mbr_entry(table->mbr, 0, 0xee, 1,
>  		    MIN(pp->mediasize / pp->sectorsize - 1, UINT32_MAX));
>  		/* Mark the PMBR active since some BIOS require it. */
> -		table->mbr[DOSPARTOFF] = 0x80;
> +		if (gpt_mark_pmbr_active)
> +			table->mbr[DOSPARTOFF] = 0x80;
>  	}
>  	le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC);
>  
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50F34A2B.3080202>