If the selector lever will not move from P using the proper shift procedure, continue to hold down the brake pedal.

Take the vehicle to an Authorized Mazda Dealer to have the system checked.
Shift-Lock System
Manual Shift ModeActive Driving Display
WARNING
Always adjust the display brightness and position with the vehicle
stopped:
Adjusting the display brightness and position while driving the vehicle
is dangerous as
doing so could distract your attention from the road ahead and lead to
an accident.
...
TCM Removal/Installation [FS5 A EL]
CAUTION:
Do not apply a shock to or touch the projection on the TCM, otherwise it
may not operate normally.
1. Perform the following procedures.
a. Remove the battery cover..
b. Disconnect the negative battery cable.
c. Remove the battery component (ex: battery, battery tray a ...
Lights-On Reminder
The lights-on reminder is operable when
the time setting *1 of the auto headlight off
function is off.
If lights are on and the ignition is switched
to ACC or the ignition is switched off, a
continuous beep sound will be heard when
the driver's door is opened.
*1 If the light switch is le ...