The sunshade can be opened and closed by hand.
The sunshade opens automatically when the moonroof is opened, but must be closed by hand.

CAUTION
Jam-safe Moonroof
Security SystemMazda 6 Owners Manual: Disconnection of the negative battery cable
Before beginning any work, turn the ignition switch to LOCK position,
then disconnect the negative battery cable and wait for more than 1 minute
to allow the backup power supply of the SAS unit to deplete its stored
power. Disconnecting the battery cable will delete the memories of the
...
Mazda 6 Owners Manual: Variable intake-air system (vis) shutter valve actuator inspection (l3)
1. Remove the air hose. (See INTAKE-AIR SYSTEM REMOVAL/INSTALLATION.)
2. Disconnect the vacuum hose from the VIS shutter valve actuator.
3. Connect a vacuum pump to the VIS shutter valve actuator.
4. Apply vacuum and verify that the rod moves.
If the rod dose not move, replace the intake ma ...