Преглед на файлове

[efi] Remove obsolete EFI I/O implementation using EFI_CPU_IO_PROTOCOL

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown преди 11 години
родител
ревизия
0f7b3fa6f9
променени са 5 файла, в които са добавени 0 реда и са изтрити 591 реда
  1. 0
    48
      src/include/ipxe/efi/Protocol/CpuIo.h
  2. 0
    144
      src/include/ipxe/efi/Protocol/CpuIo2.h
  3. 0
    180
      src/include/ipxe/efi/efi_io.h
  4. 0
    1
      src/include/ipxe/io.h
  5. 0
    218
      src/interface/efi/efi_io.c

+ 0
- 48
src/include/ipxe/efi/Protocol/CpuIo.h Целия файл

@@ -1,48 +0,0 @@
1
-/** @file
2
-  This code abstracts the CPU IO Protocol which installed by some platform or chipset-specific
3
-  PEIM that abstracts the processor-visible I/O operations.
4
-
5
-  Note: This is a runtime protocol and can be used by runtime drivers after ExitBootServices().
6
-  It is different from the PI 1.2 CPU I/O 2 Protocol, which is a boot services only protocol
7
-  and may not be used by runtime drivers after ExitBootServices().
8
-
9
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
10
-This program and the accompanying materials are licensed and made available under
11
-the terms and conditions of the BSD License that accompanies this distribution.
12
-The full text of the license may be found at
13
-http://opensource.org/licenses/bsd-license.php.
14
-
15
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
-
18
-  @par Revision Reference:
19
-  CPU IO Protocol is defined in Framework of EFI CPU IO Protocol Spec
20
-  Version 0.9.
21
-
22
-**/
23
-
24
-#ifndef _CPUIO_H_
25
-#define _CPUIO_H_
26
-
27
-FILE_LICENCE ( BSD3 );
28
-
29
-#include <ipxe/efi/Protocol/CpuIo2.h>
30
-
31
-#define EFI_CPU_IO_PROTOCOL_GUID \
32
-  { \
33
-    0xB0732526, 0x38C8, 0x4b40, {0x88, 0x77, 0x61, 0xC7, 0xB0, 0x6A, 0xAC, 0x45 } \
34
-  }
35
-
36
-//
37
-// Framework CPU IO protocol structure is the same as CPU IO 2 protocol defined in PI 1.2 spec.
38
-// However, there is a significant different between the Framework CPU I/O
39
-// Protocol and the PI 1.2 CPU I/O 2 Protocol.  The Framework one is a runtime
40
-// protocol, which means it can be used by runtime drivers after ExitBootServices().
41
-// The PI one is not runtime safe, so it is a boot services only protocol and may
42
-// not be used by runtime drivers after ExitBootServices().
43
-//
44
-typedef EFI_CPU_IO2_PROTOCOL EFI_CPU_IO_PROTOCOL;
45
-
46
-extern EFI_GUID gEfiCpuIoProtocolGuid;
47
-
48
-#endif

+ 0
- 144
src/include/ipxe/efi/Protocol/CpuIo2.h Целия файл

@@ -1,144 +0,0 @@
1
-/** @file
2
-  This files describes the CPU I/O 2 Protocol.
3
-
4
-  This protocol provides an I/O abstraction for a system processor. This protocol
5
-  is used by a PCI root bridge I/O driver to perform memory-mapped I/O and I/O transactions.
6
-  The I/O or memory primitives can be used by the consumer of the protocol to materialize
7
-  bus-specific configuration cycles, such as the transitional configuration address and data
8
-  ports for PCI. Only drivers that require direct access to the entire system should use this
9
-  protocol.
10
-
11
-  Note: This is a boot-services only protocol and it may not be used by runtime drivers after
12
-  ExitBootServices(). It is different from the Framework CPU I/O Protocol, which is a runtime
13
-  protocol and can be used by runtime drivers after ExitBootServices().
14
-
15
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
16
-  This program and the accompanying materials
17
-  are licensed and made available under the terms and conditions of the BSD License
18
-  which accompanies this distribution.  The full text of the license may be found at
19
-  http://opensource.org/licenses/bsd-license.php
20
-
21
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
22
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23
-
24
-  @par Revision Reference:
25
-  This Protocol is defined in UEFI Platform Initialization Specification 1.2
26
-  Volume 5: Standards
27
-
28
-**/
29
-
30
-#ifndef __CPU_IO2_H__
31
-#define __CPU_IO2_H__
32
-
33
-FILE_LICENCE ( BSD3 );
34
-
35
-#define EFI_CPU_IO2_PROTOCOL_GUID \
36
-  { \
37
-    0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} \
38
-  }
39
-
40
-typedef struct _EFI_CPU_IO2_PROTOCOL EFI_CPU_IO2_PROTOCOL;
41
-
42
-///
43
-/// Enumeration that defines the width of the I/O operation.
44
-///
45
-typedef enum {
46
-  EfiCpuIoWidthUint8,
47
-  EfiCpuIoWidthUint16,
48
-  EfiCpuIoWidthUint32,
49
-  EfiCpuIoWidthUint64,
50
-  EfiCpuIoWidthFifoUint8,
51
-  EfiCpuIoWidthFifoUint16,
52
-  EfiCpuIoWidthFifoUint32,
53
-  EfiCpuIoWidthFifoUint64,
54
-  EfiCpuIoWidthFillUint8,
55
-  EfiCpuIoWidthFillUint16,
56
-  EfiCpuIoWidthFillUint32,
57
-  EfiCpuIoWidthFillUint64,
58
-  EfiCpuIoWidthMaximum
59
-} EFI_CPU_IO_PROTOCOL_WIDTH;
60
-
61
-/**
62
-  Enables a driver to access registers in the PI CPU I/O space.
63
-
64
-  The Io.Read() and Io.Write() functions enable a driver to access PCI controller
65
-  registers in the PI CPU I/O space.
66
-
67
-  The I/O operations are carried out exactly as requested. The caller is responsible
68
-  for satisfying any alignment and I/O width restrictions that a PI System on a
69
-  platform might require. For example on some platforms, width requests of
70
-  EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
71
-  be handled by the driver.
72
-
73
-  If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
74
-  or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
75
-  each of the Count operations that is performed.
76
-
77
-  If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
78
-  EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
79
-  incremented for each of the Count operations that is performed. The read or
80
-  write operation is performed Count times on the same Address.
81
-
82
-  If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
83
-  EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
84
-  incremented for each of the Count operations that is performed. The read or
85
-  write operation is performed Count times from the first element of Buffer.
86
-
87
-  @param[in]       This     A pointer to the EFI_CPU_IO2_PROTOCOL instance.
88
-  @param[in]       Width    Signifies the width of the I/O or Memory operation.
89
-  @param[in]       Address  The base address of the I/O operation.
90
-  @param[in]       Count    The number of I/O operations to perform. The number
91
-                            of bytes moved is Width size * Count, starting at Address.
92
-  @param[in, out]  Buffer   For read operations, the destination buffer to store the results.
93
-                            For write operations, the source buffer from which to write data.
94
-
95
-  @retval EFI_SUCCESS            The data was read from or written to the PI system.
96
-  @retval EFI_INVALID_PARAMETER  Width is invalid for this PI system.
97
-  @retval EFI_INVALID_PARAMETER  Buffer is NULL.
98
-  @retval EFI_UNSUPPORTED        The Buffer is not aligned for the given Width.
99
-  @retval EFI_UNSUPPORTED        The address range specified by Address, Width,
100
-                                 and Count is not valid for this PI system.
101
-
102
-**/
103
-typedef
104
-EFI_STATUS
105
-(EFIAPI *EFI_CPU_IO_PROTOCOL_IO_MEM)(
106
-  IN     EFI_CPU_IO2_PROTOCOL              *This,
107
-  IN     EFI_CPU_IO_PROTOCOL_WIDTH         Width,
108
-  IN     UINT64                            Address,
109
-  IN     UINTN                             Count,
110
-  IN OUT VOID                              *Buffer
111
-  );
112
-
113
-///
114
-/// Service for read and write accesses.
115
-///
116
-typedef struct {
117
-  ///
118
-  /// This service provides the various modalities of memory and I/O read.
119
-  ///
120
-  EFI_CPU_IO_PROTOCOL_IO_MEM  Read;
121
-  ///
122
-  /// This service provides the various modalities of memory and I/O write.
123
-  ///
124
-  EFI_CPU_IO_PROTOCOL_IO_MEM  Write;
125
-} EFI_CPU_IO_PROTOCOL_ACCESS;
126
-
127
-///
128
-/// Provides the basic memory and I/O interfaces that are used to abstract
129
-/// accesses to devices in a system.
130
-///
131
-struct _EFI_CPU_IO2_PROTOCOL {
132
-  ///
133
-  /// Enables a driver to access memory-mapped registers in the EFI system memory space.
134
-  ///
135
-  EFI_CPU_IO_PROTOCOL_ACCESS  Mem;
136
-  ///
137
-  /// Enables a driver to access registers in the EFI CPU I/O space.
138
-  ///
139
-  EFI_CPU_IO_PROTOCOL_ACCESS  Io;
140
-};
141
-
142
-extern EFI_GUID gEfiCpuIo2ProtocolGuid;
143
-
144
-#endif

+ 0
- 180
src/include/ipxe/efi/efi_io.h Целия файл

@@ -1,180 +0,0 @@
1
-#ifndef _IPXE_EFI_IO_H
2
-#define _IPXE_EFI_IO_H
3
-
4
-/** @file
5
- *
6
- * iPXE I/O API for EFI
7
- *
8
- * EFI runs with flat physical addressing, so the various mappings
9
- * between virtual addresses, I/O addresses and bus addresses are all
10
- * no-ops.  I/O is handled using the EFI_CPU_IO_PROTOCOL.
11
- */
12
-
13
-FILE_LICENCE ( GPL2_OR_LATER );
14
-
15
-#ifdef IOAPI_EFI
16
-#define IOAPI_PREFIX_efi
17
-#else
18
-#define IOAPI_PREFIX_efi __efi_
19
-#endif
20
-
21
-extern unsigned long long efi_ioread ( volatile void *io_addr,
22
-				       size_t size );
23
-extern void efi_iowrite ( unsigned long long data, volatile void *io_addr,
24
-			  size_t size );
25
-extern void efi_ioreads ( volatile void *io_addr, void *data,
26
-			  size_t size, unsigned int count );
27
-extern void efi_iowrites ( volatile void *io_addr, const void *data,
28
-			  size_t size, unsigned int count );
29
-
30
-/*
31
- * Physical<->Bus and Bus<->I/O address mappings
32
- *
33
- * EFI runs with flat physical addressing, so these are all no-ops.
34
- *
35
- */
36
-
37
-static inline __always_inline unsigned long
38
-IOAPI_INLINE ( efi, phys_to_bus ) ( unsigned long phys_addr ) {
39
-	return phys_addr;
40
-}
41
-
42
-static inline __always_inline unsigned long
43
-IOAPI_INLINE ( efi, bus_to_phys ) ( unsigned long bus_addr ) {
44
-	return bus_addr;
45
-}
46
-
47
-static inline __always_inline void *
48
-IOAPI_INLINE ( efi, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
49
-	return ( ( void * ) bus_addr );
50
-}
51
-
52
-static inline __always_inline void
53
-IOAPI_INLINE ( efi, iounmap ) ( volatile const void *io_addr __unused ) {
54
-	/* Nothing to do */
55
-}
56
-
57
-static inline __always_inline unsigned long
58
-IOAPI_INLINE ( efi, io_to_bus ) ( volatile const void *io_addr ) {
59
-	return ( ( unsigned long ) io_addr );
60
-}
61
-
62
-/*
63
- * I/O functions
64
- *
65
- */
66
-
67
-static inline __always_inline uint8_t
68
-IOAPI_INLINE ( efi, readb ) ( volatile uint8_t *io_addr ) {
69
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
70
-}
71
-
72
-static inline __always_inline uint16_t
73
-IOAPI_INLINE ( efi, readw ) ( volatile uint16_t *io_addr ) {
74
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
75
-}
76
-
77
-static inline __always_inline uint32_t
78
-IOAPI_INLINE ( efi, readl ) ( volatile uint32_t *io_addr ) {
79
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
80
-}
81
-
82
-static inline __always_inline uint64_t
83
-IOAPI_INLINE ( efi, readq ) ( volatile uint64_t *io_addr ) {
84
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
85
-}
86
-
87
-static inline __always_inline void
88
-IOAPI_INLINE ( efi, writeb ) ( uint8_t data, volatile uint8_t *io_addr ) {
89
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
90
-}
91
-
92
-static inline __always_inline void
93
-IOAPI_INLINE ( efi, writew ) ( uint16_t data, volatile uint16_t *io_addr ) {
94
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
95
-}
96
-
97
-static inline __always_inline void
98
-IOAPI_INLINE ( efi, writel ) ( uint32_t data, volatile uint32_t *io_addr ) {
99
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
100
-}
101
-
102
-static inline __always_inline void
103
-IOAPI_INLINE ( efi, writeq ) ( uint64_t data, volatile uint64_t *io_addr ) {
104
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
105
-}
106
-
107
-static inline __always_inline uint8_t
108
-IOAPI_INLINE ( efi, inb ) ( volatile uint8_t *io_addr ) {
109
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
110
-}
111
-
112
-static inline __always_inline uint16_t
113
-IOAPI_INLINE ( efi, inw ) ( volatile uint16_t *io_addr ) {
114
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
115
-}
116
-
117
-static inline __always_inline uint32_t
118
-IOAPI_INLINE ( efi, inl ) ( volatile uint32_t *io_addr ) {
119
-	return efi_ioread ( io_addr, sizeof ( *io_addr ) );
120
-}
121
-
122
-static inline __always_inline void
123
-IOAPI_INLINE ( efi, outb ) ( uint8_t data, volatile uint8_t *io_addr ) {
124
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
125
-}
126
-
127
-static inline __always_inline void
128
-IOAPI_INLINE ( efi, outw ) ( uint16_t data, volatile uint16_t *io_addr ) {
129
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
130
-}
131
-
132
-static inline __always_inline void
133
-IOAPI_INLINE ( efi, outl ) ( uint32_t data, volatile uint32_t *io_addr ) {
134
-	efi_iowrite ( data, io_addr, sizeof ( *io_addr ) );
135
-}
136
-
137
-static inline __always_inline void
138
-IOAPI_INLINE ( efi, insb ) ( volatile uint8_t *io_addr, uint8_t *data,
139
-			     unsigned int count ) {
140
-	efi_ioreads ( io_addr, data, sizeof ( *io_addr ), count );
141
-}
142
-
143
-static inline __always_inline void
144
-IOAPI_INLINE ( efi, insw ) ( volatile uint16_t *io_addr, uint16_t *data,
145
-			     unsigned int count ) {
146
-	efi_ioreads ( io_addr, data, sizeof ( *io_addr ), count );
147
-}
148
-
149
-static inline __always_inline void
150
-IOAPI_INLINE ( efi, insl ) ( volatile uint32_t *io_addr, uint32_t *data,
151
-			     unsigned int count ) {
152
-	efi_ioreads ( io_addr, data, sizeof ( *io_addr ), count );
153
-}
154
-
155
-static inline __always_inline void
156
-IOAPI_INLINE ( efi, outsb ) ( volatile uint8_t *io_addr, const uint8_t *data,
157
-			      unsigned int count ) {
158
-	efi_iowrites ( io_addr, data, sizeof ( *io_addr ), count );
159
-}
160
-
161
-static inline __always_inline void
162
-IOAPI_INLINE ( efi, outsw ) ( volatile uint16_t *io_addr, const uint16_t *data,
163
-			      unsigned int count ) {
164
-	efi_iowrites ( io_addr, data, sizeof ( *io_addr ), count );
165
-}
166
-
167
-static inline __always_inline void
168
-IOAPI_INLINE ( efi, outsl ) ( volatile uint32_t *io_addr, const uint32_t *data,
169
-			      unsigned int count ) {
170
-	efi_iowrites ( io_addr, data, sizeof ( *io_addr ), count );
171
-}
172
-
173
-static inline __always_inline void
174
-IOAPI_INLINE ( efi, mb ) ( void ) {
175
-	/* Do nothing; EFI readl()/writel() calls already act as
176
-	 * memory barriers.
177
-	 */
178
-}
179
-
180
-#endif /* _IPXE_EFI_IO_H */

+ 0
- 1
src/include/ipxe/io.h Целия файл

@@ -53,7 +53,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
53 53
 	PROVIDE_SINGLE_API_INLINE ( IOAPI_PREFIX_ ## _subsys, _api_func )
54 54
 
55 55
 /* Include all architecture-independent I/O API headers */
56
-#include <ipxe/efi/efi_io.h>
57 56
 
58 57
 /* Include all architecture-dependent I/O API headers */
59 58
 #include <bits/io.h>

+ 0
- 218
src/interface/efi/efi_io.c Целия файл

@@ -1,218 +0,0 @@
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., 51 Franklin Street, Fifth Floor, Boston, MA
17
- * 02110-1301, USA.
18
- */
19
-
20
-FILE_LICENCE ( GPL2_OR_LATER );
21
-
22
-#include <assert.h>
23
-#include <ipxe/io.h>
24
-#include <ipxe/efi/efi.h>
25
-#include <ipxe/efi/Protocol/CpuIo.h>
26
-#include <ipxe/efi/efi_io.h>
27
-
28
-/** @file
29
- *
30
- * iPXE I/O API for EFI
31
- *
32
- */
33
-
34
-/** CPU I/O protocol */
35
-static EFI_CPU_IO_PROTOCOL *cpu_io;
36
-EFI_REQUIRE_PROTOCOL ( EFI_CPU_IO_PROTOCOL, &cpu_io );
37
-
38
-/** Maximum address that can be used for port I/O */
39
-#define MAX_PORT_ADDRESS 0xffff
40
-
41
-/**
42
- * Determine whether or not address is a port I/O address
43
- *
44
- * @v io_addr		I/O address
45
- * @v is_port		I/O address is a port I/O address
46
- */
47
-#define IS_PORT_ADDRESS(io_addr) \
48
-	( ( ( intptr_t ) (io_addr) ) <= MAX_PORT_ADDRESS )
49
-
50
-/**
51
- * Determine EFI CPU I/O width code
52
- *
53
- * @v size		Size of value
54
- * @ret width		EFI width code
55
- *
56
- * Someone at Intel clearly gets paid by the number of lines of code
57
- * they write.  No-one should ever be able to make I/O this
58
- * convoluted.  The EFI_CPU_IO_PROTOCOL_WIDTH enum is my favourite
59
- * idiocy.
60
- */
61
-static EFI_CPU_IO_PROTOCOL_WIDTH efi_width ( size_t size ) {
62
-	switch ( size ) {
63
-	case 1 :	return EfiCpuIoWidthFifoUint8;
64
-	case 2 :	return EfiCpuIoWidthFifoUint16;
65
-	case 4 :	return EfiCpuIoWidthFifoUint32;
66
-	case 8 :	return EfiCpuIoWidthFifoUint64;
67
-	default :
68
-		assert ( 0 );
69
-		/* I wonder what this will actually do... */
70
-		return EfiCpuIoWidthMaximum;
71
-	}
72
-}
73
-
74
-/**
75
- * Read from device
76
- *
77
- * @v io_addr		I/O address
78
- * @v size		Size of value
79
- * @ret data		Value read
80
- */
81
-unsigned long long efi_ioread ( volatile void *io_addr, size_t size ) {
82
-	EFI_CPU_IO_PROTOCOL_IO_MEM read;
83
-	unsigned long long data = 0;
84
-	EFI_STATUS efirc;
85
-
86
-	read = ( IS_PORT_ADDRESS ( io_addr ) ?
87
-		 cpu_io->Io.Read : cpu_io->Mem.Read );
88
-
89
-	if ( ( efirc = read ( cpu_io, efi_width ( size ),
90
-			      ( intptr_t ) io_addr, 1,
91
-			      ( void * ) &data ) ) != 0 ) {
92
-		DBG ( "EFI I/O read at %p failed: %s\n",
93
-		      io_addr, efi_strerror ( efirc ) );
94
-		return -1ULL;
95
-	}
96
-
97
-	return data;
98
-}
99
-
100
-/**
101
- * Write to device
102
- *
103
- * @v data		Value to write
104
- * @v io_addr		I/O address
105
- * @v size		Size of value
106
- */
107
-void efi_iowrite ( unsigned long long data, volatile void *io_addr,
108
-		   size_t size ) {
109
-	EFI_CPU_IO_PROTOCOL_IO_MEM write;
110
-	EFI_STATUS efirc;
111
-
112
-	write = ( IS_PORT_ADDRESS ( io_addr ) ?
113
-		  cpu_io->Io.Write : cpu_io->Mem.Write );
114
-
115
-	if ( ( efirc = write ( cpu_io, efi_width ( size ),
116
-			       ( intptr_t ) io_addr, 1,
117
-			       ( void * ) &data ) ) != 0 ) {
118
-		DBG ( "EFI I/O write at %p failed: %s\n",
119
-		      io_addr, efi_strerror ( efirc ) );
120
-	}
121
-}
122
-
123
-/**
124
- * String read from device
125
- *
126
- * @v io_addr		I/O address
127
- * @v data		Data buffer
128
- * @v size		Size of values
129
- * @v count		Number of values to read
130
- */
131
-void efi_ioreads ( volatile void *io_addr, void *data,
132
-		   size_t size, unsigned int count ) {
133
-	EFI_CPU_IO_PROTOCOL_IO_MEM read;
134
-	EFI_STATUS efirc;
135
-
136
-	read = ( IS_PORT_ADDRESS ( io_addr ) ?
137
-		 cpu_io->Io.Read : cpu_io->Mem.Read );
138
-
139
-	if ( ( efirc = read ( cpu_io, efi_width ( size ),
140
-			      ( intptr_t ) io_addr, count,
141
-			      ( void * ) data ) ) != 0 ) {
142
-		DBG ( "EFI I/O string read at %p failed: %s\n",
143
-		      io_addr, efi_strerror ( efirc ) );
144
-	}
145
-}
146
-
147
-/**
148
- * String write to device
149
- *
150
- * @v io_addr		I/O address
151
- * @v data		Data buffer
152
- * @v size		Size of values
153
- * @v count		Number of values to write
154
- */
155
-void efi_iowrites ( volatile void *io_addr, const void *data,
156
-		    size_t size, unsigned int count ) {
157
-	EFI_CPU_IO_PROTOCOL_IO_MEM write;
158
-	EFI_STATUS efirc;
159
-
160
-	write = ( IS_PORT_ADDRESS ( io_addr ) ?
161
-		 cpu_io->Io.Write : cpu_io->Mem.Write );
162
-
163
-	if ( ( efirc = write ( cpu_io, efi_width ( size ),
164
-			       ( intptr_t ) io_addr, count,
165
-			       ( void * ) data ) ) != 0 ) {
166
-		DBG ( "EFI I/O write at %p failed: %s\n",
167
-		      io_addr, efi_strerror ( efirc ) );
168
-	}
169
-}
170
-
171
-/**
172
- * Wait for I/O-mapped operation to complete
173
- *
174
- */
175
-static void efi_iodelay ( void ) {
176
-	/* Write to non-existent port.  Probably x86-only. */
177
-	outb ( 0, 0x80 );
178
-}
179
-
180
-/**
181
- * Get memory map
182
- *
183
- * Can't be done on EFI so return an empty map
184
- *
185
- * @v memmap		Memory map to fill in
186
- */
187
-static void efi_get_memmap ( struct memory_map *memmap ) {
188
-	memmap->count = 0;
189
-}
190
-
191
-PROVIDE_IOAPI_INLINE ( efi, phys_to_bus );
192
-PROVIDE_IOAPI_INLINE ( efi, bus_to_phys );
193
-PROVIDE_IOAPI_INLINE ( efi, ioremap );
194
-PROVIDE_IOAPI_INLINE ( efi, iounmap );
195
-PROVIDE_IOAPI_INLINE ( efi, io_to_bus );
196
-PROVIDE_IOAPI_INLINE ( efi, readb );
197
-PROVIDE_IOAPI_INLINE ( efi, readw );
198
-PROVIDE_IOAPI_INLINE ( efi, readl );
199
-PROVIDE_IOAPI_INLINE ( efi, readq );
200
-PROVIDE_IOAPI_INLINE ( efi, writeb );
201
-PROVIDE_IOAPI_INLINE ( efi, writew );
202
-PROVIDE_IOAPI_INLINE ( efi, writel );
203
-PROVIDE_IOAPI_INLINE ( efi, writeq );
204
-PROVIDE_IOAPI_INLINE ( efi, inb );
205
-PROVIDE_IOAPI_INLINE ( efi, inw );
206
-PROVIDE_IOAPI_INLINE ( efi, inl );
207
-PROVIDE_IOAPI_INLINE ( efi, outb );
208
-PROVIDE_IOAPI_INLINE ( efi, outw );
209
-PROVIDE_IOAPI_INLINE ( efi, outl );
210
-PROVIDE_IOAPI_INLINE ( efi, insb );
211
-PROVIDE_IOAPI_INLINE ( efi, insw );
212
-PROVIDE_IOAPI_INLINE ( efi, insl );
213
-PROVIDE_IOAPI_INLINE ( efi, outsb );
214
-PROVIDE_IOAPI_INLINE ( efi, outsw );
215
-PROVIDE_IOAPI_INLINE ( efi, outsl );
216
-PROVIDE_IOAPI ( efi, iodelay, efi_iodelay );
217
-PROVIDE_IOAPI_INLINE ( efi, mb );
218
-PROVIDE_IOAPI ( efi, get_memmap, efi_get_memmap );

Loading…
Отказ
Запис