Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
b0087a6b
O
OpenCorePKG_MOD
项目概览
btwise
/
OpenCorePKG_MOD
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OpenCorePKG_MOD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0087a6b
编写于
6月 06, 2020
作者:
G
Goldfish64
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
AudioDxe: Fallback to LPIB register when DMA positions buffer is unusable
上级
97ff5992
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
2 deletion
+61
-2
Staging/AudioDxe/HdaController/HdaController.c
Staging/AudioDxe/HdaController/HdaController.c
+43
-2
Staging/AudioDxe/HdaController/HdaController.h
Staging/AudioDxe/HdaController/HdaController.h
+15
-0
Staging/AudioDxe/HdaController/HdaControllerMem.c
Staging/AudioDxe/HdaController/HdaControllerMem.c
+3
-0
未找到文件。
Staging/AudioDxe/HdaController/HdaController.c
浏览文件 @
b0087a6b
...
...
@@ -63,10 +63,51 @@ HdaControllerStreamOutputPollTimerHandler (
return
;
}
if
(
HdaStream
->
UseLpib
)
{
//
// Get stream position through LPIB register.
//
Status
=
PciIo
->
Mem
.
Read
(
PciIo
,
EfiPciIoWidthFifoUint32
,
PCI_HDA_BAR
,
HDA_REG_SDNLPIB
(
HdaStream
->
Index
),
1
,
&
HdaStreamDmaPos
);
if
(
EFI_ERROR
(
Status
))
{
HdaControllerStreamAbort
(
HdaStream
);
return
;
}
}
else
{
//
// Get stream position through DMA positions buffer.
//
HdaStreamDmaPos
=
HdaStream
->
HdaDev
->
DmaPositions
[
HdaStream
->
Index
].
Position
;
//
// If zero, give the stream a few cycles to catch up before falling back to LPIB.
// Fallback occurs after the set amount of cycles the DMA position is zero.
//
if
(
HdaStreamDmaPos
==
0
&&
!
HdaStream
->
DmaCheckComplete
)
{
if
(
HdaStream
->
DmaCheckCount
>=
HDA_STREAM_DMA_CHECK_THRESH
)
{
HdaStream
->
UseLpib
=
TRUE
;
}
//
// Get stream position through LPIB register in the meantime.
//
DEBUG
((
DEBUG_VERBOSE
,
"AudioDxe: Falling back to LPIB after %u more tries!
\n
"
,
HDA_STREAM_DMA_CHECK_THRESH
-
HdaStream
->
DmaCheckCount
));
Status
=
PciIo
->
Mem
.
Read
(
PciIo
,
EfiPciIoWidthFifoUint32
,
PCI_HDA_BAR
,
HDA_REG_SDNLPIB
(
HdaStream
->
Index
),
1
,
&
HdaStreamDmaPos
);
if
(
EFI_ERROR
(
Status
))
{
HdaControllerStreamAbort
(
HdaStream
);
return
;
}
}
}
//
//
Get stream DMA positi
on.
//
Increment cycle counter. Once complete, store status to avoid false fallbacks later
on.
//
HdaStreamDmaPos
=
HdaStream
->
HdaDev
->
DmaPositions
[
HdaStream
->
Index
].
Position
;
if
(
HdaStream
->
DmaCheckCount
<
HDA_STREAM_DMA_CHECK_THRESH
)
{
HdaStream
->
DmaCheckCount
++
;
}
else
{
HdaStream
->
DmaCheckComplete
=
TRUE
;
}
if
(
HdaStreamDmaPos
>=
HdaStream
->
DmaPositionLast
)
{
DmaChanged
=
HdaStreamDmaPos
-
HdaStream
->
DmaPositionLast
;
}
else
{
...
...
Staging/AudioDxe/HdaController/HdaController.h
浏览文件 @
b0087a6b
...
...
@@ -111,6 +111,8 @@ typedef struct {
#define HDA_STREAM_POLL_TIME (EFI_TIMER_PERIOD_MILLISECONDS(1))
#define HDA_STREAM_BUFFER_PADDING 0x200 // 512 byte pad.
#define HDA_STREAM_DMA_CHECK_THRESH 5
//
// DMA position structure.
//
...
...
@@ -148,6 +150,19 @@ typedef struct {
//
BOOLEAN
IsBidirectional
;
//
// Use LPIB register instead of DMA position buffer.
//
BOOLEAN
UseLpib
;
//
// Count of times DMA position buffer usability is checked.
//
UINT32
DmaCheckCount
;
//
// Indicates whether DMA position buffer usability is complete.
// Ensures we don't accidentally fallback to LPIB if the stream position happens to be zero later on.
//
BOOLEAN
DmaCheckComplete
;
//
// Buffer Descriptor List.
//
HDA_BDL_ENTRY
*
BufferList
;
...
...
Staging/AudioDxe/HdaController/HdaControllerMem.c
浏览文件 @
b0087a6b
...
...
@@ -584,6 +584,9 @@ HdaControllerResetStream (
HdaStream
->
DmaPositionTotal
=
0
;
HdaStream
->
DmaPositionLast
=
0
;
HdaStream
->
DmaPositionChangedMax
=
0
;
HdaStream
->
UseLpib
=
TRUE
;
// TODO: Allow being forced by NVRAM variable?
HdaStream
->
DmaCheckCount
=
0
;
HdaStream
->
DmaCheckComplete
=
FALSE
;
return
TRUE
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录