Skip to content

Allow unsetting the port_enable_disable bit in portsc #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Demindiro
Copy link
Member

This is necessary to avoid disabling the port when clearing a change bit.

This is necessary to avoid disabling the port when clearing a change
bit.
@toku-sa-n
Copy link
Member

Thank you for the PR, but I think what you need is clear_port_enabled_disabled which clears the bit by writing 1 to it. The bit is RW1C, and writing 0 to it has no effect. Please refer to pages 370 for RW1C and 407 for the bit, the specification revision 1.2.

@Demindiro
Copy link
Member Author

Demindiro commented Sep 3, 2022

Thank you for the PR, but I think what you need is clear_port_enabled_disabled which clears the bit by writing 1 to it. The bit is RW1C, and writing 0 to it has no effect. Please refer to pages 370 for RW1C and 407 for the bit, the specification revision 1.2.

I'm trying to avoid writing a 1 as I don't want the port to be disabled.

For context, I unset the bit here

@toku-sa-n
Copy link
Member

Thank you for the context. I may understand a bit. Is the problem as follows?

  1. You read the PORTSC register whose Port Enabled/Disabled (PED) bit is 1 because the port is enabled.
  2. You modify the value fetched from the register. The PED bit is still 1.
  3. You write back the value to the register, but the port becomes disabled as the PED bit is 1, and writing 1 to the bit disables the port.

@Demindiro
Copy link
Member Author

Yes

@toku-sa-n
Copy link
Member

toku-sa-n commented Sep 4, 2022

Thank you. I didn't notice the problem before. Because this problem is not the PED bit specific, could you instead add the set_0 method with the documentation explaining the situation, the difference between itself and the clear_* method, and how to use it to the rw1c_bit macro?

Demindiro added a commit to Demindiro/xhci that referenced this pull request Sep 5, 2022
This is necessary to avoid clearing certains bits, such as Port
Enable/Disable.

Supersedes rust-osdev#146
@Demindiro
Copy link
Member Author

Superseded by #148

@Demindiro Demindiro closed this Sep 5, 2022
toku-sa-n added a commit that referenced this pull request Sep 9, 2022
* Add set_0_* to rw1c! macro

This is necessary to avoid clearing certains bits, such as Port
Enable/Disable.

Supersedes #146

* Update CHANGELOG

Co-authored-by: Hiroki Tokunaga <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants