Parcourir la source

[efi] Use EFI-native mechanism for accessing SMBIOS table

EFI provides a copy of the SMBIOS table accessible via the EFI system
table, which we should use instead of manually scanning through the
F000:0000 segment.
tags/v0.9.7
Michael Brown il y a 15 ans
Parent
révision
29480dd715

+ 1
- 1
src/Makefile Voir le fichier

@@ -58,7 +58,7 @@ SRCDIRS		+= drivers/block
58 58
 SRCDIRS		+= drivers/nvs
59 59
 SRCDIRS		+= drivers/bitbash
60 60
 SRCDIRS		+= drivers/infiniband
61
-SRCDIRS		+= interface/pxe interface/efi
61
+SRCDIRS		+= interface/pxe interface/efi interface/smbios
62 62
 SRCDIRS		+= tests
63 63
 SRCDIRS		+= crypto crypto/axtls crypto/matrixssl
64 64
 SRCDIRS		+= hci hci/commands hci/tui

+ 1
- 2
src/arch/i386/include/bits/errfile.h Voir le fichier

@@ -9,10 +9,9 @@
9 9
 #define ERRFILE_memtop_umalloc	( ERRFILE_ARCH | ERRFILE_CORE | 0x00000000 )
10 10
 #define ERRFILE_memmap		( ERRFILE_ARCH | ERRFILE_CORE | 0x00010000 )
11 11
 #define ERRFILE_pnpbios		( ERRFILE_ARCH | ERRFILE_CORE | 0x00020000 )
12
-#define ERRFILE_smbios		( ERRFILE_ARCH | ERRFILE_CORE | 0x00030000 )
12
+#define ERRFILE_bios_smbios	( ERRFILE_ARCH | ERRFILE_CORE | 0x00030000 )
13 13
 #define ERRFILE_biosint		( ERRFILE_ARCH | ERRFILE_CORE | 0x00040000 )
14 14
 #define ERRFILE_int13		( ERRFILE_ARCH | ERRFILE_CORE | 0x00050000 )
15
-#define ERRFILE_smbios_settings	( ERRFILE_ARCH | ERRFILE_CORE | 0x00060000 )
16 15
 
17 16
 #define ERRFILE_bootsector     ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
18 17
 #define ERRFILE_bzimage	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )

+ 12
- 0
src/arch/i386/include/bits/smbios.h Voir le fichier

@@ -0,0 +1,12 @@
1
+#ifndef _BITS_SMBIOS_H
2
+#define _BITS_SMBIOS_H
3
+
4
+/** @file
5
+ *
6
+ * i386-specific SMBIOS API implementations
7
+ *
8
+ */
9
+
10
+#include <gpxe/bios_smbios.h>
11
+
12
+#endif /* _BITS_SMBIOS_H */

+ 16
- 0
src/arch/i386/include/gpxe/bios_smbios.h Voir le fichier

@@ -0,0 +1,16 @@
1
+#ifndef _GPXE_BIOS_SMBIOS_H
2
+#define _GPXE_BIOS_SMBIOS_H
3
+
4
+/** @file
5
+ *
6
+ * Standard PC-BIOS SMBIOS interface
7
+ *
8
+ */
9
+
10
+#ifdef SMBIOS_PCBIOS
11
+#define SMBIOS_PREFIX_pcbios
12
+#else
13
+#define SMBIOS_PREFIX_pcbios __pcbios_
14
+#endif
15
+
16
+#endif /* _GPXE_BIOS_SMBIOS_H */

+ 0
- 60
src/arch/i386/include/smbios.h Voir le fichier

@@ -1,60 +0,0 @@
1
-#ifndef _SMBIOS_H
2
-#define _SMBIOS_H
3
-
4
-/** @file
5
- *
6
- * System Management BIOS
7
- */
8
-
9
-#include <stdint.h>
10
-
11
-/** An SMBIOS structure header */
12
-struct smbios_header {
13
-	/** Type */
14
-	uint8_t type;
15
-	/** Length */
16
-	uint8_t len;
17
-	/** Handle */
18
-	uint16_t handle;
19
-} __attribute__ (( packed ));
20
-
21
-/** SMBIOS structure descriptor */
22
-struct smbios_structure {
23
-	/** Copy of SMBIOS structure header */
24
-	struct smbios_header header;
25
-	/** Offset of structure within SMBIOS */
26
-	size_t offset;
27
-	/** Length of strings section */
28
-	size_t strings_len;
29
-};
30
-
31
-/** SMBIOS system information structure */
32
-struct smbios_system_information {
33
-	/** SMBIOS structure header */
34
-	struct smbios_header header;
35
-	/** Manufacturer string */
36
-	uint8_t manufacturer;
37
-	/** Product string */
38
-	uint8_t product;
39
-	/** Version string */
40
-	uint8_t version;
41
-	/** Serial number string */
42
-	uint8_t serial;
43
-	/** UUID */
44
-	uint8_t uuid[16];
45
-	/** Wake-up type */
46
-	uint8_t wakeup;
47
-} __attribute__ (( packed ));
48
-
49
-/** SMBIOS system information structure type */
50
-#define SMBIOS_TYPE_SYSTEM_INFORMATION 1
51
-
52
-extern int find_smbios_structure ( unsigned int type,
53
-				   struct smbios_structure *structure );
54
-extern int read_smbios_structure ( struct smbios_structure *structure,
55
-				   void *data, size_t len );
56
-extern int read_smbios_string ( struct smbios_structure *structure,
57
-				unsigned int index,
58
-				void *data, size_t len );
59
-
60
-#endif /* _SMBIOS_H */

+ 84
- 0
src/arch/i386/interface/pcbios/bios_smbios.c Voir le fichier

@@ -0,0 +1,84 @@
1
+/*
2
+ * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU General Public License as
6
+ * published by the Free Software Foundation; either version 2 of the
7
+ * License, or any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful, but
10
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ */
18
+
19
+#include <stdint.h>
20
+#include <string.h>
21
+#include <errno.h>
22
+#include <assert.h>
23
+#include <gpxe/uaccess.h>
24
+#include <gpxe/smbios.h>
25
+#include <realmode.h>
26
+#include <pnpbios.h>
27
+
28
+/** @file
29
+ *
30
+ * System Management BIOS
31
+ *
32
+ */
33
+
34
+/**
35
+ * Find SMBIOS
36
+ *
37
+ * @v smbios		SMBIOS entry point descriptor structure to fill in
38
+ * @ret rc		Return status code
39
+ */
40
+static int bios_find_smbios ( struct smbios *smbios ) {
41
+	union {
42
+		struct smbios_entry entry;
43
+		uint8_t bytes[256]; /* 256 is maximum length possible */
44
+	} u;
45
+	static unsigned int offset = 0;
46
+	size_t len;
47
+	unsigned int i;
48
+	uint8_t sum;
49
+
50
+	/* Try to find SMBIOS */
51
+	for ( ; offset < 0x10000 ; offset += 0x10 ) {
52
+
53
+		/* Read start of header and verify signature */
54
+		copy_from_real ( &u.entry, BIOS_SEG, offset,
55
+				 sizeof ( u.entry ));
56
+		if ( u.entry.signature != SMBIOS_SIGNATURE )
57
+			continue;
58
+
59
+		/* Read whole header and verify checksum */
60
+		len = u.entry.len;
61
+		copy_from_real ( &u.bytes, BIOS_SEG, offset, len );
62
+		for ( i = 0 , sum = 0 ; i < len ; i++ ) {
63
+			sum += u.bytes[i];
64
+		}
65
+		if ( sum != 0 ) {
66
+			DBG ( "SMBIOS at %04x:%04x has bad checksum %02x\n",
67
+			      BIOS_SEG, offset, sum );
68
+			continue;
69
+		}
70
+
71
+		/* Fill result structure */
72
+		DBG ( "Found SMBIOS v%d.%d entry point at %04x:%04x\n",
73
+		      u.entry.major, u.entry.minor, BIOS_SEG, offset );
74
+		smbios->address = phys_to_user ( u.entry.smbios_address );
75
+		smbios->len = u.entry.smbios_len;
76
+		smbios->count = u.entry.smbios_count;
77
+		return 0;
78
+	}
79
+
80
+	DBG ( "No SMBIOS found\n" );
81
+	return -ENODEV;
82
+}
83
+
84
+PROVIDE_SMBIOS ( pcbios, find_smbios, bios_find_smbios );

+ 1
- 0
src/config/defaults/efi.h Voir le fichier

@@ -14,6 +14,7 @@
14 14
 #define TIMER_EFI
15 15
 #define NAP_EFIX86
16 16
 #define UMALLOC_EFI
17
+#define SMBIOS_EFI
17 18
 
18 19
 #define	IMAGE_EFI		/* EFI image support */
19 20
 

+ 1
- 0
src/config/defaults/pcbios.h Voir le fichier

@@ -14,6 +14,7 @@
14 14
 #define CONSOLE_PCBIOS
15 15
 #define NAP_PCBIOS
16 16
 #define UMALLOC_MEMTOP
17
+#define SMBIOS_PCBIOS
17 18
 
18 19
 #define	IMAGE_ELF		/* ELF image support */
19 20
 #define	IMAGE_MULTIBOOT		/* MultiBoot image support */

+ 34
- 0
src/include/gpxe/efi/Guid/SmBios.h Voir le fichier

@@ -0,0 +1,34 @@
1
+/** @file
2
+  GUIDs used to locate the SMBIOS tables in the UEFI 2.0 system table.
3
+
4
+  This GUID in the system table is the only legal way to search for and
5
+  locate the SMBIOS tables. Do not search the 0xF0000 segment to find SMBIOS
6
+  tables.
7
+
8
+  Copyright (c) 2006, Intel Corporation
9
+  All rights reserved. This program and the accompanying materials
10
+  are licensed and made available under the terms and conditions of the BSD License
11
+  which accompanies this distribution.  The full text of the license may be found at
12
+  http://opensource.org/licenses/bsd-license.php
13
+
14
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
+
17
+  @par Revision Reference:
18
+  GUIDs defined in UEFI 2.0 spec.
19
+
20
+**/
21
+
22
+#ifndef __SMBIOS_GUID_H__
23
+#define __SMBIOS_GUID_H__
24
+
25
+#define EFI_SMBIOS_TABLE_GUID \
26
+  { \
27
+    0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
28
+  }
29
+
30
+#define SMBIOS_TABLE_GUID EFI_SMBIOS_TABLE_GUID
31
+
32
+extern EFI_GUID       gEfiSmbiosTableGuid;
33
+
34
+#endif

+ 16
- 0
src/include/gpxe/efi/efi_smbios.h Voir le fichier

@@ -0,0 +1,16 @@
1
+#ifndef _GPXE_EFI_SMBIOS_H
2
+#define _GPXE_EFI_SMBIOS_H
3
+
4
+/** @file
5
+ *
6
+ * gPXE SMBIOS API for EFI
7
+ *
8
+ */
9
+
10
+#ifdef SMBIOS_EFI
11
+#define SMBIOS_PREFIX_efi
12
+#else
13
+#define SMBIOS_PREFIX_efi __efi_
14
+#endif
15
+
16
+#endif /* _GPXE_EFI_SMBIOS_H */

+ 3
- 0
src/include/gpxe/errfile.h Voir le fichier

@@ -164,6 +164,9 @@
164 164
 #define ERRFILE_iscsiboot	      ( ERRFILE_OTHER | 0x000f0000 )
165 165
 #define ERRFILE_efi_pci		      ( ERRFILE_OTHER | 0x00100000 )
166 166
 #define ERRFILE_efi_snp		      ( ERRFILE_OTHER | 0x00110000 )
167
+#define ERRFILE_smbios		      ( ERRFILE_OTHER | 0x00120000 )
168
+#define ERRFILE_smbios_settings	      ( ERRFILE_OTHER | 0x00130000 )
169
+#define ERRFILE_efi_smbios	      ( ERRFILE_OTHER | 0x00140000 )
167 170
 
168 171
 /** @} */
169 172
 

+ 140
- 0
src/include/gpxe/smbios.h Voir le fichier

@@ -0,0 +1,140 @@
1
+#ifndef _GPXE_SMBIOS_H
2
+#define _GPXE_SMBIOS_H
3
+
4
+/** @file
5
+ *
6
+ * System Management BIOS
7
+ *
8
+ */
9
+
10
+#include <stdint.h>
11
+#include <gpxe/api.h>
12
+#include <config/general.h>
13
+#include <gpxe/uaccess.h>
14
+
15
+/**
16
+ * Provide an SMBIOS API implementation
17
+ *
18
+ * @v _prefix		Subsystem prefix
19
+ * @v _api_func		API function
20
+ * @v _func		Implementing function
21
+ */
22
+#define PROVIDE_SMBIOS( _subsys, _api_func, _func ) \
23
+	PROVIDE_SINGLE_API ( SMBIOS_PREFIX_ ## _subsys, _api_func, _func )
24
+
25
+/* Include all architecture-independent SMBIOS API headers */
26
+#include <gpxe/efi/efi_smbios.h>
27
+
28
+/* Include all architecture-dependent SMBIOS API headers */
29
+#include <bits/smbios.h>
30
+
31
+/** Signature for SMBIOS entry point */
32
+#define SMBIOS_SIGNATURE \
33
+        ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
34
+
35
+/**
36
+ * SMBIOS entry point
37
+ *
38
+ * This is the single table which describes the list of SMBIOS
39
+ * structures.  It is located by scanning through the BIOS segment.
40
+ */
41
+struct smbios_entry {
42
+	/** Signature
43
+	 *
44
+	 * Must be equal to SMBIOS_SIGNATURE
45
+	 */
46
+	uint32_t signature;
47
+	/** Checksum */
48
+	uint8_t checksum;
49
+	/** Length */
50
+	uint8_t len;
51
+	/** Major version */
52
+	uint8_t major;
53
+	/** Minor version */
54
+	uint8_t minor;
55
+	/** Maximum structure size */
56
+	uint16_t max;
57
+	/** Entry point revision */
58
+	uint8_t revision;
59
+	/** Formatted area */
60
+	uint8_t formatted[5];
61
+	/** DMI Signature */
62
+	uint8_t dmi_signature[5];
63
+	/** DMI checksum */
64
+	uint8_t dmi_checksum;
65
+	/** Structure table length */
66
+	uint16_t smbios_len;
67
+	/** Structure table address */
68
+	uint32_t smbios_address;
69
+	/** Number of SMBIOS structures */
70
+	uint16_t smbios_count;
71
+	/** BCD revision */
72
+	uint8_t bcd_revision;
73
+} __attribute__ (( packed ));
74
+
75
+/** An SMBIOS structure header */
76
+struct smbios_header {
77
+	/** Type */
78
+	uint8_t type;
79
+	/** Length */
80
+	uint8_t len;
81
+	/** Handle */
82
+	uint16_t handle;
83
+} __attribute__ (( packed ));
84
+
85
+/** SMBIOS structure descriptor */
86
+struct smbios_structure {
87
+	/** Copy of SMBIOS structure header */
88
+	struct smbios_header header;
89
+	/** Offset of structure within SMBIOS */
90
+	size_t offset;
91
+	/** Length of strings section */
92
+	size_t strings_len;
93
+};
94
+
95
+/** SMBIOS system information structure */
96
+struct smbios_system_information {
97
+	/** SMBIOS structure header */
98
+	struct smbios_header header;
99
+	/** Manufacturer string */
100
+	uint8_t manufacturer;
101
+	/** Product string */
102
+	uint8_t product;
103
+	/** Version string */
104
+	uint8_t version;
105
+	/** Serial number string */
106
+	uint8_t serial;
107
+	/** UUID */
108
+	uint8_t uuid[16];
109
+	/** Wake-up type */
110
+	uint8_t wakeup;
111
+} __attribute__ (( packed ));
112
+
113
+/** SMBIOS system information structure type */
114
+#define SMBIOS_TYPE_SYSTEM_INFORMATION 1
115
+
116
+/**
117
+ * SMBIOS entry point descriptor
118
+ *
119
+ * This contains the information from the SMBIOS entry point that we
120
+ * care about.
121
+ */
122
+struct smbios {
123
+	/** Start of SMBIOS structures */
124
+	userptr_t address;
125
+	/** Length of SMBIOS structures */
126
+	size_t len;
127
+	/** Number of SMBIOS structures */
128
+	unsigned int count;
129
+};
130
+
131
+extern int find_smbios ( struct smbios *smbios );
132
+extern int find_smbios_structure ( unsigned int type,
133
+				   struct smbios_structure *structure );
134
+extern int read_smbios_structure ( struct smbios_structure *structure,
135
+				   void *data, size_t len );
136
+extern int read_smbios_string ( struct smbios_structure *structure,
137
+				unsigned int index,
138
+				void *data, size_t len );
139
+
140
+#endif /* _GPXE_SMBIOS_H */

+ 62
- 0
src/interface/efi/efi_smbios.c Voir le fichier

@@ -0,0 +1,62 @@
1
+/*
2
+ * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU General Public License as
6
+ * published by the Free Software Foundation; either version 2 of the
7
+ * License, or any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful, but
10
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ */
18
+
19
+#include <errno.h>
20
+#include <gpxe/smbios.h>
21
+#include <gpxe/efi/efi.h>
22
+#include <gpxe/efi/Guid/SmBios.h>
23
+
24
+/** @file
25
+ *
26
+ * gPXE SMBIOS API for EFI
27
+ *
28
+ */
29
+
30
+/** SMBIOS configuration table */
31
+static struct smbios_entry *smbios_entry;
32
+EFI_USE_TABLE ( EFI_SMBIOS_TABLE, &smbios_entry, 0 );
33
+
34
+/**
35
+ * Find SMBIOS
36
+ *
37
+ * @v smbios		SMBIOS entry point descriptor structure to fill in
38
+ * @ret rc		Return status code
39
+ */
40
+static int efi_find_smbios ( struct smbios *smbios ) {
41
+
42
+	if ( ! smbios_entry ) {
43
+		DBG ( "No SMBIOS table provided\n" );
44
+		return -ENODEV;
45
+	}
46
+
47
+	if ( smbios_entry->signature != SMBIOS_SIGNATURE ) {
48
+		DBG ( "Invalid SMBIOS signature\n" );
49
+		return -ENODEV;
50
+	}
51
+
52
+	smbios->address = phys_to_user ( smbios_entry->smbios_address );
53
+	smbios->len = smbios_entry->smbios_len;
54
+	smbios->count = smbios_entry->smbios_count;
55
+	DBG ( "Found SMBIOS v%d.%d entry point at %p (%x+%zx)\n",
56
+	      smbios_entry->major, smbios_entry->minor, smbios_entry,
57
+	      smbios_entry->smbios_address, smbios->len );
58
+
59
+	return 0;
60
+}
61
+
62
+PROVIDE_SMBIOS ( efi, find_smbios, efi_find_smbios );

src/arch/i386/firmware/pcbios/smbios.c → src/interface/smbios/smbios.c Voir le fichier

@@ -21,9 +21,7 @@
21 21
 #include <errno.h>
22 22
 #include <assert.h>
23 23
 #include <gpxe/uaccess.h>
24
-#include <realmode.h>
25
-#include <pnpbios.h>
26
-#include <smbios.h>
24
+#include <gpxe/smbios.h>
27 25
 
28 26
 /** @file
29 27
  *
@@ -31,123 +29,11 @@
31 29
  *
32 30
  */
33 31
 
34
-/** Signature for SMBIOS entry point */
35
-#define SMBIOS_SIGNATURE \
36
-        ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
37
-
38
-/**
39
- * SMBIOS entry point
40
- *
41
- * This is the single table which describes the list of SMBIOS
42
- * structures.  It is located by scanning through the BIOS segment.
43
- */
44
-struct smbios_entry {
45
-	/** Signature
46
-	 *
47
-	 * Must be equal to SMBIOS_SIGNATURE
48
-	 */
49
-	uint32_t signature;
50
-	/** Checksum */
51
-	uint8_t checksum;
52
-	/** Length */
53
-	uint8_t len;
54
-	/** Major version */
55
-	uint8_t major;
56
-	/** Minor version */
57
-	uint8_t minor;
58
-	/** Maximum structure size */
59
-	uint16_t max;
60
-	/** Entry point revision */
61
-	uint8_t revision;
62
-	/** Formatted area */
63
-	uint8_t formatted[5];
64
-	/** DMI Signature */
65
-	uint8_t dmi_signature[5];
66
-	/** DMI checksum */
67
-	uint8_t dmi_checksum;
68
-	/** Structure table length */
69
-	uint16_t smbios_len;
70
-	/** Structure table address */
71
-	physaddr_t smbios_address;
72
-	/** Number of SMBIOS structures */
73
-	uint16_t smbios_count;
74
-	/** BCD revision */
75
-	uint8_t bcd_revision;
76
-} __attribute__ (( packed ));
77
-
78
-/**
79
- * SMBIOS entry point descriptor
80
- *
81
- * This contains the information from the SMBIOS entry point that we
82
- * care about.
83
- */
84
-struct smbios {
85
-	/** Start of SMBIOS structures */
86
-	userptr_t address;
87
-	/** Length of SMBIOS structures */ 
88
-	size_t len;
89
-	/** Number of SMBIOS structures */
90
-	unsigned int count;
91
-};
92
-
93 32
 /** SMBIOS entry point descriptor */
94 33
 static struct smbios smbios = {
95 34
 	.address = UNULL,
96 35
 };
97 36
 
98
-/**
99
- * Find SMBIOS
100
- *
101
- * @ret rc		Return status code
102
- */
103
-static int find_smbios ( void ) {
104
-	union {
105
-		struct smbios_entry entry;
106
-		uint8_t bytes[256]; /* 256 is maximum length possible */
107
-	} u;
108
-	static unsigned int offset = 0;
109
-	size_t len;
110
-	unsigned int i;
111
-	uint8_t sum;
112
-
113
-	/* Return cached result if avaiable */
114
-	if ( smbios.address != UNULL )
115
-		return 0;
116
-
117
-	/* Try to find SMBIOS */
118
-	for ( ; offset < 0x10000 ; offset += 0x10 ) {
119
-
120
-		/* Read start of header and verify signature */
121
-		copy_from_real ( &u.entry, BIOS_SEG, offset,
122
-				 sizeof ( u.entry ));
123
-		if ( u.entry.signature != SMBIOS_SIGNATURE )
124
-			continue;
125
-
126
-		/* Read whole header and verify checksum */
127
-		len = u.entry.len;
128
-		copy_from_real ( &u.bytes, BIOS_SEG, offset, len );
129
-		for ( i = 0 , sum = 0 ; i < len ; i++ ) {
130
-			sum += u.bytes[i];
131
-		}
132
-		if ( sum != 0 ) {
133
-			DBG ( "SMBIOS at %04x:%04x has bad checksum %02x\n",
134
-			      BIOS_SEG, offset, sum );
135
-			continue;
136
-		}
137
-
138
-		/* Fill result structure */
139
-		DBG ( "Found SMBIOS v%d.%d entry point at %04x:%04x\n",
140
-		      u.entry.major, u.entry.minor, BIOS_SEG, offset );
141
-		smbios.address = phys_to_user ( u.entry.smbios_address );
142
-		smbios.len = u.entry.smbios_len;
143
-		smbios.count = u.entry.smbios_count;
144
-		return 0;
145
-	}
146
-
147
-	DBG ( "No SMBIOS found\n" );
148
-	return -ENODEV;
149
-}
150
-
151 37
 /**
152 38
  * Find SMBIOS strings terminator
153 39
  *
@@ -182,8 +68,10 @@ int find_smbios_structure ( unsigned int type,
182 68
 	int rc;
183 69
 
184 70
 	/* Find SMBIOS */
185
-	if ( ( rc = find_smbios() ) != 0 )
71
+	if ( ( smbios.address == UNULL ) &&
72
+	     ( ( rc = find_smbios ( &smbios ) ) != 0 ) )
186 73
 		return rc;
74
+	assert ( smbios.address != UNULL );
187 75
 
188 76
 	/* Scan through list of structures */
189 77
 	while ( ( ( offset + sizeof ( structure->header ) ) < smbios.len )

src/arch/i386/firmware/pcbios/smbios_settings.c → src/interface/smbios/smbios_settings.c Voir le fichier

@@ -22,7 +22,7 @@
22 22
 #include <gpxe/settings.h>
23 23
 #include <gpxe/init.h>
24 24
 #include <gpxe/uuid.h>
25
-#include <smbios.h>
25
+#include <gpxe/smbios.h>
26 26
 
27 27
 /** SMBIOS settings tag magic number */
28 28
 #define SMBIOS_TAG_MAGIC 0x5B /* "SmBios" */

Chargement…
Annuler
Enregistrer