diff mbox

lib: remove fwts_virt, it contains code that is not used (LP: #1259655)

Message ID 1386703366-29565-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Dec. 10, 2013, 7:22 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The helper function fwts_exec_cpuid() is no longer used, so remove
it from the fwts lib.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts.h      |  1 -
 src/lib/include/fwts_virt.h | 39 ------------------------
 src/lib/src/Makefile.am     |  1 -
 src/lib/src/fwts_virt.c     | 73 ---------------------------------------------
 4 files changed, 114 deletions(-)
 delete mode 100644 src/lib/include/fwts_virt.h
 delete mode 100644 src/lib/src/fwts_virt.c

Comments

Keng-Yu Lin Dec. 11, 2013, 5:46 a.m. UTC | #1
On Wed, Dec 11, 2013 at 3:22 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The helper function fwts_exec_cpuid() is no longer used, so remove
> it from the fwts lib.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/include/fwts.h      |  1 -
>  src/lib/include/fwts_virt.h | 39 ------------------------
>  src/lib/src/Makefile.am     |  1 -
>  src/lib/src/fwts_virt.c     | 73 ---------------------------------------------
>  4 files changed, 114 deletions(-)
>  delete mode 100644 src/lib/include/fwts_virt.h
>  delete mode 100644 src/lib/src/fwts_virt.c
>
> diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h
> index dc1bccc..c29e7f2 100644
> --- a/src/lib/include/fwts.h
> +++ b/src/lib/include/fwts.h
> @@ -55,7 +55,6 @@
>  #include "fwts_stringextras.h"
>  #include "fwts_tty.h"
>  #include "fwts_wakealarm.h"
> -#include "fwts_virt.h"
>  #include "fwts_formatting.h"
>  #include "fwts_summary.h"
>  #include "fwts_mmap.h"
> diff --git a/src/lib/include/fwts_virt.h b/src/lib/include/fwts_virt.h
> deleted file mode 100644
> index 473830e..0000000
> --- a/src/lib/include/fwts_virt.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> - * Copyright (C) 2006, Intel Corp
> - * Copyright (C) 2007, AMD Inc
> - * Copyright (C) 2010-2013 Canonical
> - *
> - * This code was originally part of the Linux-ready Firmware Developer Kit
> - *
> - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - *
> - */
> -
> -#ifndef __FWTS_VIRT_H__
> -#define __FWTS_VIRT_H__
> -
> -#define CURRENT_CPU             0xFF
> -
> -typedef struct __cpu_registers
> -{
> -       uint32_t eax;
> -       uint32_t ebx;
> -       uint32_t ecx;
> -       uint32_t edx;
> -} cpu_registers;
> -
> -void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs);
> -
> -#endif
> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
> index c8f4919..4760a6f 100644
> --- a/src/lib/src/Makefile.am
> +++ b/src/lib/src/Makefile.am
> @@ -69,5 +69,4 @@ libfwts_la_SOURCES =          \
>         fwts_text_list.c        \
>         fwts_tty.c              \
>         fwts_uefi.c             \
> -       fwts_virt.c             \
>         fwts_wakealarm.c
> diff --git a/src/lib/src/fwts_virt.c b/src/lib/src/fwts_virt.c
> deleted file mode 100644
> index 64d56b6..0000000
> --- a/src/lib/src/fwts_virt.c
> +++ /dev/null
> @@ -1,73 +0,0 @@
> -/*
> - * Copyright (C) 2006, Intel Corp
> - * Copyright (C) 2007, AMD Inc
> - * Copyright (C) 2010-2013 Canonical
> - *
> - * This code was originally part of the Linux-ready Firmware Developer Kit
> - *
> - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - *
> - */
> -#define _GNU_SOURCE
> -#include <sched.h>
> -#include <string.h>
> -#include <stdint.h>
> -
> -#include "fwts.h"
> -
> -/*
> - *  fwts_exec_cpuid()
> - *     execute cpuid instruction on a given CPU
> - */
> -void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs)
> -{
> -       cpu_set_t mask, oldmask;
> -
> -       if (cpu != CURRENT_CPU) {
> -               sched_getaffinity(0, sizeof(oldmask), &oldmask);
> -               CPU_ZERO(&mask);
> -               CPU_SET(cpu, &mask);
> -               /* Select CPU */
> -               sched_setaffinity(0, sizeof(mask), &mask);
> -       }
> -
> -#if defined(__i386__)
> -       __asm__ __volatile__ (  "pushl %%ebx \n\t"
> -                               "cpuid  \n\t"
> -                               "movl %%ebx,%%esi \n\t"
> -                               "popl %%ebx \n\t"
> -                               : "=a"(regs->eax),"=S"(regs->ebx),
> -                               "=c"(regs->ecx),"=d"(regs->edx)
> -                               : "a"(cmd)
> -       );
> -#elif defined (__x86_64__)
> -       __asm__ __volatile__ ( "cpuid \n\t"
> -                          : "=a"(regs->eax),"=b"(regs->ebx),
> -                             "=c"(regs->ecx),"=d"(regs->edx)
> -                          : "a"(cmd)
> -       );
> -#else
> -       /* Non x86 we just fake it */
> -       FWTS_UNUSED(cmd);
> -
> -       regs->eax = 0;
> -       regs->ebx = 0;
> -       regs->ecx = 0;
> -       regs->edx = 0;
> -#endif
> -
> -       if (cpu != CURRENT_CPU)
> -               sched_setaffinity(0, sizeof(oldmask), &oldmask);
> -}
> --
> 1.8.5.1
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung Dec. 11, 2013, 5:54 a.m. UTC | #2
On 12/11/2013 03:22 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The helper function fwts_exec_cpuid() is no longer used, so remove
> it from the fwts lib.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/include/fwts.h      |  1 -
>   src/lib/include/fwts_virt.h | 39 ------------------------
>   src/lib/src/Makefile.am     |  1 -
>   src/lib/src/fwts_virt.c     | 73 ---------------------------------------------
>   4 files changed, 114 deletions(-)
>   delete mode 100644 src/lib/include/fwts_virt.h
>   delete mode 100644 src/lib/src/fwts_virt.c
>
> diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h
> index dc1bccc..c29e7f2 100644
> --- a/src/lib/include/fwts.h
> +++ b/src/lib/include/fwts.h
> @@ -55,7 +55,6 @@
>   #include "fwts_stringextras.h"
>   #include "fwts_tty.h"
>   #include "fwts_wakealarm.h"
> -#include "fwts_virt.h"
>   #include "fwts_formatting.h"
>   #include "fwts_summary.h"
>   #include "fwts_mmap.h"
> diff --git a/src/lib/include/fwts_virt.h b/src/lib/include/fwts_virt.h
> deleted file mode 100644
> index 473830e..0000000
> --- a/src/lib/include/fwts_virt.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> - * Copyright (C) 2006, Intel Corp
> - * Copyright (C) 2007, AMD Inc
> - * Copyright (C) 2010-2013 Canonical
> - *
> - * This code was originally part of the Linux-ready Firmware Developer Kit
> - *
> - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - *
> - */
> -
> -#ifndef __FWTS_VIRT_H__
> -#define __FWTS_VIRT_H__
> -
> -#define CURRENT_CPU             0xFF
> -
> -typedef struct __cpu_registers
> -{
> -	uint32_t eax;
> -	uint32_t ebx;
> -	uint32_t ecx;
> -	uint32_t edx;
> -} cpu_registers;
> -
> -void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs);
> -
> -#endif
> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
> index c8f4919..4760a6f 100644
> --- a/src/lib/src/Makefile.am
> +++ b/src/lib/src/Makefile.am
> @@ -69,5 +69,4 @@ libfwts_la_SOURCES = 		\
>   	fwts_text_list.c 	\
>   	fwts_tty.c 		\
>   	fwts_uefi.c 		\
> -	fwts_virt.c 		\
>   	fwts_wakealarm.c
> diff --git a/src/lib/src/fwts_virt.c b/src/lib/src/fwts_virt.c
> deleted file mode 100644
> index 64d56b6..0000000
> --- a/src/lib/src/fwts_virt.c
> +++ /dev/null
> @@ -1,73 +0,0 @@
> -/*
> - * Copyright (C) 2006, Intel Corp
> - * Copyright (C) 2007, AMD Inc
> - * Copyright (C) 2010-2013 Canonical
> - *
> - * This code was originally part of the Linux-ready Firmware Developer Kit
> - *
> - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - *
> - */
> -#define _GNU_SOURCE
> -#include <sched.h>
> -#include <string.h>
> -#include <stdint.h>
> -
> -#include "fwts.h"
> -
> -/*
> - *  fwts_exec_cpuid()
> - *	execute cpuid instruction on a given CPU
> - */
> -void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs)
> -{
> -	cpu_set_t mask, oldmask;
> -
> -	if (cpu != CURRENT_CPU) {
> -		sched_getaffinity(0, sizeof(oldmask), &oldmask);
> -		CPU_ZERO(&mask);
> -		CPU_SET(cpu, &mask);
> -		/* Select CPU */
> -		sched_setaffinity(0, sizeof(mask), &mask);
> -	}
> -
> -#if defined(__i386__)
> -    	__asm__ __volatile__ (  "pushl %%ebx \n\t"
> -				"cpuid	\n\t"
> -				"movl %%ebx,%%esi \n\t"
> -				"popl %%ebx \n\t"
> -			   	: "=a"(regs->eax),"=S"(regs->ebx),
> -                             	"=c"(regs->ecx),"=d"(regs->edx)
> -			   	: "a"(cmd)
> -	);
> -#elif defined (__x86_64__)
> -    	__asm__ __volatile__ ( "cpuid \n\t"
> -			   : "=a"(regs->eax),"=b"(regs->ebx),
> -                             "=c"(regs->ecx),"=d"(regs->edx)
> -			   : "a"(cmd)
> -	);
> -#else
> -	/* Non x86 we just fake it */
> -	FWTS_UNUSED(cmd);
> -
> -	regs->eax = 0;
> -	regs->ebx = 0;
> -	regs->ecx = 0;
> -	regs->edx = 0;
> -#endif
> -
> -	if (cpu != CURRENT_CPU)
> -		sched_setaffinity(0, sizeof(oldmask), &oldmask);
> -}
>

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h
index dc1bccc..c29e7f2 100644
--- a/src/lib/include/fwts.h
+++ b/src/lib/include/fwts.h
@@ -55,7 +55,6 @@ 
 #include "fwts_stringextras.h"
 #include "fwts_tty.h"
 #include "fwts_wakealarm.h"
-#include "fwts_virt.h"
 #include "fwts_formatting.h"
 #include "fwts_summary.h"
 #include "fwts_mmap.h"
diff --git a/src/lib/include/fwts_virt.h b/src/lib/include/fwts_virt.h
deleted file mode 100644
index 473830e..0000000
--- a/src/lib/include/fwts_virt.h
+++ /dev/null
@@ -1,39 +0,0 @@ 
-/*
- * Copyright (C) 2006, Intel Corp
- * Copyright (C) 2007, AMD Inc
- * Copyright (C) 2010-2013 Canonical
- *
- * This code was originally part of the Linux-ready Firmware Developer Kit
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef __FWTS_VIRT_H__
-#define __FWTS_VIRT_H__
-
-#define CURRENT_CPU             0xFF
-
-typedef struct __cpu_registers
-{
-	uint32_t eax;
-	uint32_t ebx;
-	uint32_t ecx;
-	uint32_t edx;
-} cpu_registers;
-
-void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs);
-
-#endif
diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
index c8f4919..4760a6f 100644
--- a/src/lib/src/Makefile.am
+++ b/src/lib/src/Makefile.am
@@ -69,5 +69,4 @@  libfwts_la_SOURCES = 		\
 	fwts_text_list.c 	\
 	fwts_tty.c 		\
 	fwts_uefi.c 		\
-	fwts_virt.c 		\
 	fwts_wakealarm.c 
diff --git a/src/lib/src/fwts_virt.c b/src/lib/src/fwts_virt.c
deleted file mode 100644
index 64d56b6..0000000
--- a/src/lib/src/fwts_virt.c
+++ /dev/null
@@ -1,73 +0,0 @@ 
-/*
- * Copyright (C) 2006, Intel Corp
- * Copyright (C) 2007, AMD Inc
- * Copyright (C) 2010-2013 Canonical
- *
- * This code was originally part of the Linux-ready Firmware Developer Kit
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-#define _GNU_SOURCE
-#include <sched.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "fwts.h"
-
-/*
- *  fwts_exec_cpuid()
- *	execute cpuid instruction on a given CPU
- */
-void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs)
-{
-	cpu_set_t mask, oldmask;
-
-	if (cpu != CURRENT_CPU) {
-		sched_getaffinity(0, sizeof(oldmask), &oldmask);
-		CPU_ZERO(&mask);
-		CPU_SET(cpu, &mask);
-		/* Select CPU */
-		sched_setaffinity(0, sizeof(mask), &mask);
-	}
-
-#if defined(__i386__)
-    	__asm__ __volatile__ (  "pushl %%ebx \n\t"
-				"cpuid	\n\t"
-				"movl %%ebx,%%esi \n\t"
-				"popl %%ebx \n\t"
-			   	: "=a"(regs->eax),"=S"(regs->ebx),
-                             	"=c"(regs->ecx),"=d"(regs->edx)
-			   	: "a"(cmd)
-	);
-#elif defined (__x86_64__)
-    	__asm__ __volatile__ ( "cpuid \n\t"
-			   : "=a"(regs->eax),"=b"(regs->ebx),
-                             "=c"(regs->ecx),"=d"(regs->edx)
-			   : "a"(cmd)
-	);
-#else
-	/* Non x86 we just fake it */
-	FWTS_UNUSED(cmd);
-
-	regs->eax = 0;
-	regs->ebx = 0;
-	regs->ecx = 0;
-	regs->edx = 0;
-#endif
-
-	if (cpu != CURRENT_CPU)
-		sched_setaffinity(0, sizeof(oldmask), &oldmask);
-}